5 /* These will be re-linked against their real values during the second link stage */
6 extern const unsigned long kallsyms_addresses
[] __attribute__((weak
));
7 extern const unsigned long kallsyms_num_syms
__attribute__((weak
));
8 extern const u8 kallsyms_names
[] __attribute__((weak
));
10 extern const u8 kallsyms_token_table
[] __attribute__((weak
));
11 extern const u16 kallsyms_token_index
[] __attribute__((weak
));
13 extern const unsigned long kallsyms_markers
[] __attribute__((weak
));
15 /* expand a compressed symbol data into the resulting uncompressed string,
16 given the offset to where the symbol is in the compressed stream */
17 static unsigned int kallsyms_expand_symbol(unsigned int off
, char *result
)
19 int len
, skipped_first
= 0;
20 const u8
*tptr
, *data
;
22 /* get the compressed symbol length from the first symbol byte */
23 data
= &kallsyms_names
[off
];
27 /* update the offset to return the offset for the next symbol on
28 * the compressed stream */
31 /* for every byte on the compressed symbol data, copy the table
32 entry for that byte */
34 tptr
= &kallsyms_token_table
[ kallsyms_token_index
[*data
] ];
50 /* return to offset to the next symbol */
54 /* Lookup the address for this symbol. Returns 0 if not found. */
55 unsigned long kallsyms_lookup_name(const char *name
)
57 char namebuf
[KSYM_NAME_LEN
];
61 for (i
= 0, off
= 0; i
< kallsyms_num_syms
; i
++) {
62 off
= kallsyms_expand_symbol(off
, namebuf
);
64 if (strcmp(namebuf
, name
) == 0)
65 return kallsyms_addresses
[i
];
67 // return module_kallsyms_lookup_name(name);