Skip to content

Commit

Permalink
Kbuild, lto: Drop .number postfixes in modpost
Browse files Browse the repository at this point in the history
LTO turns all global symbols effectively into statics. This
has the side effect that they all have a .NUMBER postfix to make
them unique. In modpost drop this postfix because it confuses
it.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/1391846481-31491-8-git-send-email-ak@linux.intel.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
  • Loading branch information
Andi Kleen authored and H. Peter Anvin committed Feb 14, 2014
1 parent 77ab21a commit 7d02b49
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion scripts/mod/modpost.c
Original file line number Diff line number Diff line change
Expand Up @@ -1684,6 +1684,19 @@ static void check_sec_ref(struct module *mod, const char *modname,
}
}

static char *remove_dot(char *s)
{
char *end;
int n = strcspn(s, ".");

if (n > 0 && s[n] != 0) {
strtoul(s + n + 1, &end, 10);
if (end > s + n + 1 && (*end == '.' || *end == 0))
s[n] = 0;
}
return s;
}

static void read_symbols(char *modname)
{
const char *symname;
Expand Down Expand Up @@ -1722,7 +1735,7 @@ static void read_symbols(char *modname)
}

for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
symname = info.strtab + sym->st_name;
symname = remove_dot(info.strtab + sym->st_name);

handle_modversions(mod, &info, sym, symname);
handle_moddevtable(mod, &info, sym, symname);
Expand Down
2 changes: 1 addition & 1 deletion scripts/mod/modpost.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ struct elf_info {
Elf_Section export_gpl_sec;
Elf_Section export_unused_gpl_sec;
Elf_Section export_gpl_future_sec;
const char *strtab;
char *strtab;
char *modinfo;
unsigned int modinfo_len;

Expand Down

0 comments on commit 7d02b49

Please sign in to comment.