Skip to content

Commit

Permalink
Merge tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/rusty/linux

Pull ARM kallsyms fix from Rusty Russell:
 "Last minute perf unbreakage for ARM modules; spent a day in
  linux-next"

* tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
  scripts/kallsyms: filter symbols not in kernel address space
  • Loading branch information
torvalds committed Nov 2, 2013
2 parents 9c41f4e + f6537f2 commit 9dc8c89
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 11 additions & 1 deletion scripts/kallsyms.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ static struct sym_entry *table;
static unsigned int table_size, table_cnt;
static int all_symbols = 0;
static char symbol_prefix_char = '\0';
static unsigned long long kernel_start_addr = 0;

int token_profit[0x10000];

Expand All @@ -65,7 +66,10 @@ unsigned char best_table_len[256];

static void usage(void)
{
fprintf(stderr, "Usage: kallsyms [--all-symbols] [--symbol-prefix=<prefix char>] < in.map > out.S\n");
fprintf(stderr, "Usage: kallsyms [--all-symbols] "
"[--symbol-prefix=<prefix char>] "
"[--page-offset=<CONFIG_PAGE_OFFSET>] "
"< in.map > out.S\n");
exit(1);
}

Expand Down Expand Up @@ -194,6 +198,9 @@ static int symbol_valid(struct sym_entry *s)
int i;
int offset = 1;

if (s->addr < kernel_start_addr)
return 0;

/* skip prefix char */
if (symbol_prefix_char && *(s->sym + 1) == symbol_prefix_char)
offset++;
Expand Down Expand Up @@ -646,6 +653,9 @@ int main(int argc, char **argv)
if ((*p == '"' && *(p+2) == '"') || (*p == '\'' && *(p+2) == '\''))
p++;
symbol_prefix_char = *p;
} else if (strncmp(argv[i], "--page-offset=", 14) == 0) {
const char *p = &argv[i][14];
kernel_start_addr = strtoull(p, NULL, 16);
} else
usage();
}
Expand Down
2 changes: 2 additions & 0 deletions scripts/link-vmlinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ kallsyms()
kallsymopt="${kallsymopt} --all-symbols"
fi

kallsymopt="${kallsymopt} --page-offset=$CONFIG_PAGE_OFFSET"

local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \
${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}"

Expand Down

0 comments on commit 9dc8c89

Please sign in to comment.