Skip to content
This repository has been archived by the owner on Nov 14, 2021. It is now read-only.

Commit

Permalink
kbuild, kallsyms: Ignore source file weak symbols
Browse files Browse the repository at this point in the history
With LTO gcc-nm generates some strange weak symbols for each source
file. These are outside the normal kernel range and confuse
kallsyms, resulting in incorrect kallsyms tables.

Just ignore them as they are not needed for symbolization.

Signed-off-by: Andi Kleen <[email protected]>
Signed-off-by: Adam W. Willis <[email protected]>
  • Loading branch information
Andi Kleen authored and 0ctobot committed Aug 30, 2021
1 parent 8e488f4 commit 4c20b9a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion scripts/kallsyms.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static int check_symbol_range(const char *sym, unsigned long long addr,

static int read_symbol(FILE *in, struct sym_entry *s)
{
char sym[500], stype;
char sym[500], stype, *p;
int rc;

rc = fscanf(in, "%llx %c %499s\n", &s->addr, &stype, sym);
Expand Down Expand Up @@ -150,6 +150,17 @@ static int read_symbol(FILE *in, struct sym_entry *s)
/* exclude debugging symbols */
else if (stype == 'N' || stype == 'n')
return -1;
/* gcc-nm produces extra weak symbols for C files
* in the form
* 000000000003aa8b W version.c.36323a88
* ignore they are outside the supported range
* and confuse the symbol generation, and they
* are not useful for symbolization.
*/
else if ((stype = 'W' || stype == 'w') &&
(p = strstr(sym, ".c.")) &&
isxdigit(p[3]))
return -1;
/* exclude s390 kasan local symbols */
else if (!strncmp(sym, ".LASANPC", 8))
return -1;
Expand Down

0 comments on commit 4c20b9a

Please sign in to comment.