I want to check the list of symbol exported by the Linux kernel. So I fire the command,
# cat /proc/kallsyms
0000000000000000 D per_cpu__irq_stack_union
0000000000000000 D __per_cpu_start
0000000000004000 D per_cpu__gdt_page
0000000000005000 d per_cpu__exception_stacks
000000000000b000 d per_cpu__idt_desc
000000000000b010 d per_cpu__xen_cr0_value
000000000000b018 D per_cpu__xen_vcpu
000000000000b020 D per_cpu__xen_vcpu_info
000000000000b060 d per_cpu__mc_buffer
000000000000c570 D per_cpu__xen_mc_irq_flags
This is the output I got. My question is that, what is the meaning of each field in this output? The first field looks like the address, I didn't get any reference for second field. Can anybody explain to me the meaning of the values, D,d,t,T,s in second field?
EXPORT_SYMBOL() is specific to the Linux kernel. It is used in the translation unit of the definition to make the symbol available to loadable modules. So EXPORT_SYMBOL is just a mechanism like extern, but it's for reference between loadable modules not file.
We can use the readelf command with the -s flag to view exported symbols: $ readelf -s lib.so Symbol table '.
map file is a symbol table used by the kernel. A symbol table is a look-up between symbol names and their addresses in memory. A symbol name may be the name of a variable or the name of a function. The System.
It is macro to define some symbol (e.g. function) as exportable (seen from kernel loadable modules). If the symbol has no "EXPORT_SYMBOL", it will be not accessible from modules. EXPORT_SYMBOL_GPL will show the symbol only in GPL-licensed modules, and EXPORT_SYMBOL - in modules with any license.
The characters in the second column have the same meaning they do in the output from nm:
DdThe symbol is in the initialized data section.
SsThe symbol is in an uninitialized data section for small objects.
TtThe symbol is in the text (code) section.
Uppercase symbols are global/exported; lowercase are local unexported symbols.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With