--- ./scripts/kallsyms.c.orig 2005-03-10 11:00:26.000000000 +0000 +++ ./scripts/kallsyms.c 2005-03-10 11:11:50.000000000 +0000 @@ -499,11 +499,30 @@ static void forget_symbol(unsigned char forget_token(symbol + i, len - i); } +/* sort the symbols by address->name so that even if aliased symbols + * change position, or the symbols are not supplied in address order + * the algorithm will work nevertheless */ + +static int sort_by_address_name(const void *a, const void *b) +{ + struct sym_entry *sa, *sb; + + sa = (struct sym_entry *) a; + sb = (struct sym_entry *) b; + + if (sa->addr != sb->addr) + return sa->addr - sb->addr; + + return strcmp(sa->sym + 1, sb->sym + 1); +} + /* set all the symbol flags and do the initial token count */ static void build_initial_tok_table(void) { int i, use_it, valid; + qsort(table, cnt, sizeof(table[0]), sort_by_address_name); + valid = 0; for (i = 0; i < cnt; i++) { table[i].flags = 0;