diff options
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/Kbuild.include | 9 | ||||
| -rw-r--r-- | scripts/Makefile.build | 2 | ||||
| -rw-r--r-- | scripts/Makefile.lib | 1 | ||||
| -rwxr-xr-x | scripts/checkpatch.pl | 4 | ||||
| -rw-r--r-- | scripts/gcc-ld | 29 | ||||
| -rw-r--r-- | scripts/gen_initramfs_list.sh | 2 | ||||
| -rwxr-xr-x | scripts/get_maintainer.pl | 2 | ||||
| -rwxr-xr-x | scripts/ld-version.sh | 8 | ||||
| -rw-r--r-- | scripts/mod/file2alias.c | 4 | ||||
| -rw-r--r-- | scripts/mod/modpost.c | 38 | ||||
| -rw-r--r-- | scripts/mod/modpost.h | 2 |
11 files changed, 91 insertions, 10 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 547e15daf03d..93a0da26582b 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
| @@ -155,6 +155,15 @@ ld-option = $(call try-run,\ | |||
| 155 | # Important: no spaces around options | 155 | # Important: no spaces around options |
| 156 | ar-option = $(call try-run, $(AR) rc$(1) "$$TMP",$(1),$(2)) | 156 | ar-option = $(call try-run, $(AR) rc$(1) "$$TMP",$(1),$(2)) |
| 157 | 157 | ||
| 158 | # ld-version | ||
| 159 | # Usage: $(call ld-version) | ||
| 160 | # Note this is mainly for HJ Lu's 3 number binutil versions | ||
| 161 | ld-version = $(shell $(LD) --version | $(srctree)/scripts/ld-version.sh) | ||
| 162 | |||
| 163 | # ld-ifversion | ||
| 164 | # Usage: $(call ld-ifversion, -ge, 22252, y) | ||
| 165 | ld-ifversion = $(shell [ $(call ld-version) $(1) $(2) ] && echo $(3)) | ||
| 166 | |||
| 158 | ###### | 167 | ###### |
| 159 | 168 | ||
| 160 | ### | 169 | ### |
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index d5d859c80729..9f0ee22b914f 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
| @@ -198,7 +198,7 @@ $(multi-objs-y:.o=.s) : modname = $(modname-multi) | |||
| 198 | $(multi-objs-y:.o=.lst) : modname = $(modname-multi) | 198 | $(multi-objs-y:.o=.lst) : modname = $(modname-multi) |
| 199 | 199 | ||
| 200 | quiet_cmd_cc_s_c = CC $(quiet_modtag) $@ | 200 | quiet_cmd_cc_s_c = CC $(quiet_modtag) $@ |
| 201 | cmd_cc_s_c = $(CC) $(c_flags) -fverbose-asm -S -o $@ $< | 201 | cmd_cc_s_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm -S -o $@ $< |
| 202 | 202 | ||
| 203 | $(obj)/%.s: $(src)/%.c FORCE | 203 | $(obj)/%.s: $(src)/%.c FORCE |
| 204 | $(call if_changed_dep,cc_s_c) | 204 | $(call if_changed_dep,cc_s_c) |
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 49392ecbef17..79c059e70860 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
| @@ -152,6 +152,7 @@ ld_flags = $(LDFLAGS) $(ldflags-y) | |||
| 152 | dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \ | 152 | dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \ |
| 153 | -I$(srctree)/arch/$(SRCARCH)/boot/dts \ | 153 | -I$(srctree)/arch/$(SRCARCH)/boot/dts \ |
| 154 | -I$(srctree)/arch/$(SRCARCH)/boot/dts/include \ | 154 | -I$(srctree)/arch/$(SRCARCH)/boot/dts/include \ |
| 155 | -I$(srctree)/drivers/of/testcase-data \ | ||
| 155 | -undef -D__DTS__ | 156 | -undef -D__DTS__ |
| 156 | 157 | ||
| 157 | # Finds the multi-part object the current object will be linked into | 158 | # Finds the multi-part object the current object will be linked into |
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 0ea2a1e24ade..464dcef79b35 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
| @@ -471,7 +471,7 @@ sub seed_camelcase_includes { | |||
| 471 | 471 | ||
| 472 | $camelcase_seeded = 1; | 472 | $camelcase_seeded = 1; |
| 473 | 473 | ||
| 474 | if (-d ".git") { | 474 | if (-e ".git") { |
| 475 | my $git_last_include_commit = `git log --no-merges --pretty=format:"%h%n" -1 -- include`; | 475 | my $git_last_include_commit = `git log --no-merges --pretty=format:"%h%n" -1 -- include`; |
| 476 | chomp $git_last_include_commit; | 476 | chomp $git_last_include_commit; |
| 477 | $camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit"; | 477 | $camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit"; |
| @@ -499,7 +499,7 @@ sub seed_camelcase_includes { | |||
| 499 | return; | 499 | return; |
| 500 | } | 500 | } |
| 501 | 501 | ||
| 502 | if (-d ".git") { | 502 | if (-e ".git") { |
| 503 | $files = `git ls-files "include/*.h"`; | 503 | $files = `git ls-files "include/*.h"`; |
| 504 | @include_files = split('\n', $files); | 504 | @include_files = split('\n', $files); |
| 505 | } | 505 | } |
diff --git a/scripts/gcc-ld b/scripts/gcc-ld new file mode 100644 index 000000000000..cadab9a13ed7 --- /dev/null +++ b/scripts/gcc-ld | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # run gcc with ld options | ||
| 3 | # used as a wrapper to execute link time optimizations | ||
| 4 | # yes virginia, this is not pretty | ||
| 5 | |||
| 6 | ARGS="-nostdlib" | ||
| 7 | |||
| 8 | while [ "$1" != "" ] ; do | ||
| 9 | case "$1" in | ||
| 10 | -save-temps|-m32|-m64) N="$1" ;; | ||
| 11 | -r) N="$1" ;; | ||
| 12 | -[Wg]*) N="$1" ;; | ||
| 13 | -[olv]|-[Ofd]*|-nostdlib) N="$1" ;; | ||
| 14 | --end-group|--start-group) | ||
| 15 | N="-Wl,$1" ;; | ||
| 16 | -[RTFGhIezcbyYu]*|\ | ||
| 17 | --script|--defsym|-init|-Map|--oformat|-rpath|\ | ||
| 18 | -rpath-link|--sort-section|--section-start|-Tbss|-Tdata|-Ttext|\ | ||
| 19 | --version-script|--dynamic-list|--version-exports-symbol|--wrap|-m) | ||
| 20 | A="$1" ; shift ; N="-Wl,$A,$1" ;; | ||
| 21 | -[m]*) N="$1" ;; | ||
| 22 | -*) N="-Wl,$1" ;; | ||
| 23 | *) N="$1" ;; | ||
| 24 | esac | ||
| 25 | ARGS="$ARGS $N" | ||
| 26 | shift | ||
| 27 | done | ||
| 28 | |||
| 29 | exec $CC $ARGS | ||
diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh index ef474098d9f1..17fa901418ae 100644 --- a/scripts/gen_initramfs_list.sh +++ b/scripts/gen_initramfs_list.sh | |||
| @@ -257,7 +257,7 @@ case "$arg" in | |||
| 257 | && compr="lzop -9 -f" | 257 | && compr="lzop -9 -f" |
| 258 | echo "$output_file" | grep -q "\.lz4$" \ | 258 | echo "$output_file" | grep -q "\.lz4$" \ |
| 259 | && [ -x "`which lz4 2> /dev/null`" ] \ | 259 | && [ -x "`which lz4 2> /dev/null`" ] \ |
| 260 | && compr="lz4 -9 -f" | 260 | && compr="lz4 -l -9 -f" |
| 261 | echo "$output_file" | grep -q "\.cpio$" && compr="cat" | 261 | echo "$output_file" | grep -q "\.cpio$" && compr="cat" |
| 262 | shift | 262 | shift |
| 263 | ;; | 263 | ;; |
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 9c3986f4140c..41987885bd31 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl | |||
| @@ -95,7 +95,7 @@ my %VCS_cmds; | |||
| 95 | 95 | ||
| 96 | my %VCS_cmds_git = ( | 96 | my %VCS_cmds_git = ( |
| 97 | "execute_cmd" => \&git_execute_cmd, | 97 | "execute_cmd" => \&git_execute_cmd, |
| 98 | "available" => '(which("git") ne "") && (-d ".git")', | 98 | "available" => '(which("git") ne "") && (-e ".git")', |
| 99 | "find_signers_cmd" => | 99 | "find_signers_cmd" => |
| 100 | "git log --no-color --follow --since=\$email_git_since " . | 100 | "git log --no-color --follow --since=\$email_git_since " . |
| 101 | '--numstat --no-merges ' . | 101 | '--numstat --no-merges ' . |
diff --git a/scripts/ld-version.sh b/scripts/ld-version.sh new file mode 100755 index 000000000000..198580d245e0 --- /dev/null +++ b/scripts/ld-version.sh | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | #!/usr/bin/awk -f | ||
| 2 | # extract linker version number from stdin and turn into single number | ||
| 3 | { | ||
| 4 | gsub(".*)", ""); | ||
| 5 | split($1,a, "."); | ||
| 6 | print a[1]*10000000 + a[2]*100000 + a[3]*10000 + a[4]*100 + a[5]; | ||
| 7 | exit | ||
| 8 | } | ||
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 23708636b05c..25e5cb0aaef6 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
| @@ -210,8 +210,8 @@ static void do_usb_entry(void *symval, | |||
| 210 | range_lo < 0x9 ? "[%X-9" : "[%X", | 210 | range_lo < 0x9 ? "[%X-9" : "[%X", |
| 211 | range_lo); | 211 | range_lo); |
| 212 | sprintf(alias + strlen(alias), | 212 | sprintf(alias + strlen(alias), |
| 213 | range_hi > 0xA ? "a-%X]" : "%X]", | 213 | range_hi > 0xA ? "A-%X]" : "%X]", |
| 214 | range_lo); | 214 | range_hi); |
| 215 | } | 215 | } |
| 216 | } | 216 | } |
| 217 | if (bcdDevice_initial_digits < (sizeof(bcdDevice_lo) * 2 - 1)) | 217 | if (bcdDevice_initial_digits < (sizeof(bcdDevice_lo) * 2 - 1)) |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 40610984a1b5..066355673930 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
| @@ -623,7 +623,10 @@ static void handle_modversions(struct module *mod, struct elf_info *info, | |||
| 623 | 623 | ||
| 624 | switch (sym->st_shndx) { | 624 | switch (sym->st_shndx) { |
| 625 | case SHN_COMMON: | 625 | case SHN_COMMON: |
| 626 | warn("\"%s\" [%s] is COMMON symbol\n", symname, mod->name); | 626 | if (!strncmp(symname, "__gnu_lto_", sizeof("__gnu_lto_")-1)) { |
| 627 | /* Should warn here, but modpost runs before the linker */ | ||
| 628 | } else | ||
| 629 | warn("\"%s\" [%s] is COMMON symbol\n", symname, mod->name); | ||
| 627 | break; | 630 | break; |
| 628 | case SHN_UNDEF: | 631 | case SHN_UNDEF: |
| 629 | /* undefined symbol */ | 632 | /* undefined symbol */ |
| @@ -849,6 +852,7 @@ static const char *section_white_list[] = | |||
| 849 | ".xt.lit", /* xtensa */ | 852 | ".xt.lit", /* xtensa */ |
| 850 | ".arcextmap*", /* arc */ | 853 | ".arcextmap*", /* arc */ |
| 851 | ".gnu.linkonce.arcext*", /* arc : modules */ | 854 | ".gnu.linkonce.arcext*", /* arc : modules */ |
| 855 | ".gnu.lto*", | ||
| 852 | NULL | 856 | NULL |
| 853 | }; | 857 | }; |
| 854 | 858 | ||
| @@ -1455,6 +1459,10 @@ static void check_section_mismatch(const char *modname, struct elf_info *elf, | |||
| 1455 | to = find_elf_symbol(elf, r->r_addend, sym); | 1459 | to = find_elf_symbol(elf, r->r_addend, sym); |
| 1456 | tosym = sym_name(elf, to); | 1460 | tosym = sym_name(elf, to); |
| 1457 | 1461 | ||
| 1462 | if (!strncmp(fromsym, "reference___initcall", | ||
| 1463 | sizeof("reference___initcall")-1)) | ||
| 1464 | return; | ||
| 1465 | |||
| 1458 | /* check whitelist - we may ignore it */ | 1466 | /* check whitelist - we may ignore it */ |
| 1459 | if (secref_whitelist(mismatch, | 1467 | if (secref_whitelist(mismatch, |
| 1460 | fromsec, fromsym, tosec, tosym)) { | 1468 | fromsec, fromsym, tosec, tosym)) { |
| @@ -1502,6 +1510,16 @@ static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) | |||
| 1502 | #define R_ARM_JUMP24 29 | 1510 | #define R_ARM_JUMP24 29 |
| 1503 | #endif | 1511 | #endif |
| 1504 | 1512 | ||
| 1513 | #ifndef R_ARM_THM_CALL | ||
| 1514 | #define R_ARM_THM_CALL 10 | ||
| 1515 | #endif | ||
| 1516 | #ifndef R_ARM_THM_JUMP24 | ||
| 1517 | #define R_ARM_THM_JUMP24 30 | ||
| 1518 | #endif | ||
| 1519 | #ifndef R_ARM_THM_JUMP19 | ||
| 1520 | #define R_ARM_THM_JUMP19 51 | ||
| 1521 | #endif | ||
| 1522 | |||
| 1505 | static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) | 1523 | static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) |
| 1506 | { | 1524 | { |
| 1507 | unsigned int r_typ = ELF_R_TYPE(r->r_info); | 1525 | unsigned int r_typ = ELF_R_TYPE(r->r_info); |
| @@ -1515,6 +1533,9 @@ static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) | |||
| 1515 | case R_ARM_PC24: | 1533 | case R_ARM_PC24: |
| 1516 | case R_ARM_CALL: | 1534 | case R_ARM_CALL: |
| 1517 | case R_ARM_JUMP24: | 1535 | case R_ARM_JUMP24: |
| 1536 | case R_ARM_THM_CALL: | ||
| 1537 | case R_ARM_THM_JUMP24: | ||
| 1538 | case R_ARM_THM_JUMP19: | ||
| 1518 | /* From ARM ABI: ((S + A) | T) - P */ | 1539 | /* From ARM ABI: ((S + A) | T) - P */ |
| 1519 | r->r_addend = (int)(long)(elf->hdr + | 1540 | r->r_addend = (int)(long)(elf->hdr + |
| 1520 | sechdr->sh_offset + | 1541 | sechdr->sh_offset + |
| @@ -1680,6 +1701,19 @@ static void check_sec_ref(struct module *mod, const char *modname, | |||
| 1680 | } | 1701 | } |
| 1681 | } | 1702 | } |
| 1682 | 1703 | ||
| 1704 | static char *remove_dot(char *s) | ||
| 1705 | { | ||
| 1706 | char *end; | ||
| 1707 | int n = strcspn(s, "."); | ||
| 1708 | |||
| 1709 | if (n > 0 && s[n] != 0) { | ||
| 1710 | strtoul(s + n + 1, &end, 10); | ||
| 1711 | if (end > s + n + 1 && (*end == '.' || *end == 0)) | ||
| 1712 | s[n] = 0; | ||
| 1713 | } | ||
| 1714 | return s; | ||
| 1715 | } | ||
| 1716 | |||
| 1683 | static void read_symbols(char *modname) | 1717 | static void read_symbols(char *modname) |
| 1684 | { | 1718 | { |
| 1685 | const char *symname; | 1719 | const char *symname; |
| @@ -1718,7 +1752,7 @@ static void read_symbols(char *modname) | |||
| 1718 | } | 1752 | } |
| 1719 | 1753 | ||
| 1720 | for (sym = info.symtab_start; sym < info.symtab_stop; sym++) { | 1754 | for (sym = info.symtab_start; sym < info.symtab_stop; sym++) { |
| 1721 | symname = info.strtab + sym->st_name; | 1755 | symname = remove_dot(info.strtab + sym->st_name); |
| 1722 | 1756 | ||
| 1723 | handle_modversions(mod, &info, sym, symname); | 1757 | handle_modversions(mod, &info, sym, symname); |
| 1724 | handle_moddevtable(mod, &info, sym, symname); | 1758 | handle_moddevtable(mod, &info, sym, symname); |
diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h index 51207e4d5f8b..168b43dc0a59 100644 --- a/scripts/mod/modpost.h +++ b/scripts/mod/modpost.h | |||
| @@ -127,7 +127,7 @@ struct elf_info { | |||
| 127 | Elf_Section export_gpl_sec; | 127 | Elf_Section export_gpl_sec; |
| 128 | Elf_Section export_unused_gpl_sec; | 128 | Elf_Section export_unused_gpl_sec; |
| 129 | Elf_Section export_gpl_future_sec; | 129 | Elf_Section export_gpl_future_sec; |
| 130 | const char *strtab; | 130 | char *strtab; |
| 131 | char *modinfo; | 131 | char *modinfo; |
| 132 | unsigned int modinfo_len; | 132 | unsigned int modinfo_len; |
| 133 | 133 | ||
