Commit 53d20202 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Include Aliases in kallsyms

From: Rusty Russell <rusty@rustcorp.com.au>

Kallsyms discards symbols with the same address, but these are sometimes
useful.  Skip this minor optimization and make kallsyms_lookup deal with
aliases
parent bfb288f1
......@@ -88,14 +88,20 @@ const char *kallsyms_lookup(unsigned long addr,
name += strlen(name) + 1;
}
/* Base symbol size on next symbol. */
if (best + 1 < kallsyms_num_syms)
symbol_end = kallsyms_addresses[best + 1];
else if (is_kernel_inittext(addr))
/* At worst, symbol ends at end of section. */
if (is_kernel_inittext(addr))
symbol_end = (unsigned long)_einittext;
else
symbol_end = (unsigned long)_etext;
/* Search for next non-aliased symbol */
for (i = best+1; i < kallsyms_num_syms; i++) {
if (kallsyms_addresses[i] > kallsyms_addresses[best]) {
symbol_end = kallsyms_addresses[i];
break;
}
}
*symbolsize = symbol_end - kallsyms_addresses[best];
*modname = NULL;
*offset = addr - kallsyms_addresses[best];
......
......@@ -93,7 +93,6 @@ read_map(FILE *in)
static void
write_src(void)
{
unsigned long long last_addr;
int i, valid = 0;
char *prev;
......@@ -111,16 +110,12 @@ write_src(void)
printf(".globl kallsyms_addresses\n");
printf("\tALGN\n");
printf("kallsyms_addresses:\n");
for (i = 0, last_addr = 0; i < cnt; i++) {
for (i = 0; i < cnt; i++) {
if (!symbol_valid(&table[i]))
continue;
if (table[i].addr == last_addr)
continue;
printf("\tPTR\t%#llx\n", table[i].addr);
valid++;
last_addr = table[i].addr;
}
printf("\n");
......@@ -134,20 +129,16 @@ write_src(void)
printf("\tALGN\n");
printf("kallsyms_names:\n");
prev = "";
for (i = 0, last_addr = 0; i < cnt; i++) {
for (i = 0; i < cnt; i++) {
int k;
if (!symbol_valid(&table[i]))
continue;
if (table[i].addr == last_addr)
continue;
for (k = 0; table[i].sym[k] && table[i].sym[k] == prev[k]; ++k)
;
printf("\t.byte 0x%02x\n\t.asciz\t\"%s\"\n", k, table[i].sym + k);
last_addr = table[i].addr;
prev = table[i].sym;
}
printf("\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment