aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-03-31 17:13:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-03-31 17:13:25 -0400
commit176ab02d4916f09d5d8cb63372d142df4378cdea (patch)
tree7039b1282e7b34341789a5416fbd7ca5da0e557a /scripts/mod
parente06df6a7eae1ab1ef4deb076aeeaed90e948e5c0 (diff)
parentef178f9238b142cc1020265e176b20d27fd02ba9 (diff)
Merge branch 'x86-asmlinkage-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 LTO changes from Peter Anvin: "More infrastructure work in preparation for link-time optimization (LTO). Most of these changes is to make sure symbols accessed from assembly code are properly marked as visible so the linker doesn't remove them. My understanding is that the changes to support LTO are still not upstream in binutils, but are on the way there. This patchset should conclude the x86-specific changes, and remaining patches to actually enable LTO will be fed through the Kbuild tree (other than keeping up with changes to the x86 code base, of course), although not necessarily in this merge window" * 'x86-asmlinkage-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (25 commits) Kbuild, lto: Handle basic LTO in modpost Kbuild, lto: Disable LTO for asm-offsets.c Kbuild, lto: Add a gcc-ld script to let run gcc as ld Kbuild, lto: add ld-version and ld-ifversion macros Kbuild, lto: Drop .number postfixes in modpost Kbuild, lto, workaround: Don't warn for initcall_reference in modpost lto: Disable LTO for sys_ni lto: Handle LTO common symbols in module loader lto, workaround: Add workaround for initcall reordering lto: Make asmlinkage __visible x86, lto: Disable LTO for the x86 VDSO initconst, x86: Fix initconst mistake in ts5500 code initconst: Fix initconst mistake in dcdbas asmlinkage: Make trace_hardirqs_on/off_caller visible asmlinkage, x86: Fix 32bit memcpy for LTO asmlinkage Make __stack_chk_failed and memcmp visible asmlinkage: Mark rwsem functions that can be called from assembler asmlinkage asmlinkage: Make main_extable_sort_needed visible asmlinkage, mutex: Mark __visible asmlinkage: Make trace_hardirq visible ...
Diffstat (limited to 'scripts/mod')
-rw-r--r--scripts/mod/modpost.c25
-rw-r--r--scripts/mod/modpost.h2
2 files changed, 24 insertions, 3 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 99a45fdc1bbf..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)) {
@@ -1693,6 +1701,19 @@ static void check_sec_ref(struct module *mod, const char *modname,
1693 } 1701 }
1694} 1702}
1695 1703
1704static 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
1696static void read_symbols(char *modname) 1717static void read_symbols(char *modname)
1697{ 1718{
1698 const char *symname; 1719 const char *symname;
@@ -1731,7 +1752,7 @@ static void read_symbols(char *modname)
1731 } 1752 }
1732 1753
1733 for (sym = info.symtab_start; sym < info.symtab_stop; sym++) { 1754 for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
1734 symname = info.strtab + sym->st_name; 1755 symname = remove_dot(info.strtab + sym->st_name);
1735 1756
1736 handle_modversions(mod, &info, sym, symname); 1757 handle_modversions(mod, &info, sym, symname);
1737 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