diff options
Diffstat (limited to 'scripts/kallsyms.c')
-rw-r--r-- | scripts/kallsyms.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 487ac6f37ca2..9a11f9f799f4 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c | |||
@@ -55,6 +55,7 @@ static struct sym_entry *table; | |||
55 | static unsigned int table_size, table_cnt; | 55 | static unsigned int table_size, table_cnt; |
56 | static int all_symbols = 0; | 56 | static int all_symbols = 0; |
57 | static char symbol_prefix_char = '\0'; | 57 | static char symbol_prefix_char = '\0'; |
58 | static unsigned long long kernel_start_addr = 0; | ||
58 | 59 | ||
59 | int token_profit[0x10000]; | 60 | int token_profit[0x10000]; |
60 | 61 | ||
@@ -65,7 +66,10 @@ unsigned char best_table_len[256]; | |||
65 | 66 | ||
66 | static void usage(void) | 67 | static void usage(void) |
67 | { | 68 | { |
68 | fprintf(stderr, "Usage: kallsyms [--all-symbols] [--symbol-prefix=<prefix char>] < in.map > out.S\n"); | 69 | fprintf(stderr, "Usage: kallsyms [--all-symbols] " |
70 | "[--symbol-prefix=<prefix char>] " | ||
71 | "[--page-offset=<CONFIG_PAGE_OFFSET>] " | ||
72 | "< in.map > out.S\n"); | ||
69 | exit(1); | 73 | exit(1); |
70 | } | 74 | } |
71 | 75 | ||
@@ -194,6 +198,9 @@ static int symbol_valid(struct sym_entry *s) | |||
194 | int i; | 198 | int i; |
195 | int offset = 1; | 199 | int offset = 1; |
196 | 200 | ||
201 | if (s->addr < kernel_start_addr) | ||
202 | return 0; | ||
203 | |||
197 | /* skip prefix char */ | 204 | /* skip prefix char */ |
198 | if (symbol_prefix_char && *(s->sym + 1) == symbol_prefix_char) | 205 | if (symbol_prefix_char && *(s->sym + 1) == symbol_prefix_char) |
199 | offset++; | 206 | offset++; |
@@ -646,6 +653,9 @@ int main(int argc, char **argv) | |||
646 | if ((*p == '"' && *(p+2) == '"') || (*p == '\'' && *(p+2) == '\'')) | 653 | if ((*p == '"' && *(p+2) == '"') || (*p == '\'' && *(p+2) == '\'')) |
647 | p++; | 654 | p++; |
648 | symbol_prefix_char = *p; | 655 | symbol_prefix_char = *p; |
656 | } else if (strncmp(argv[i], "--page-offset=", 14) == 0) { | ||
657 | const char *p = &argv[i][14]; | ||
658 | kernel_start_addr = strtoull(p, NULL, 16); | ||
649 | } else | 659 | } else |
650 | usage(); | 660 | usage(); |
651 | } | 661 | } |