Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux kernel exported symbols

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?

like image 340
beparas Avatar asked Apr 09 '12 08:04

beparas


People also ask

How do I export the kernel symbol?

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.

How do I find exported symbols in Linux?

We can use the readelf command with the -s flag to view exported symbols: $ readelf -s lib.so Symbol table '.

What is kernel 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.

What is Export_symbol_gpl?

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.


1 Answers

The characters in the second column have the same meaning they do in the output from nm:

D d The symbol is in the initialized data section.

S s The symbol is in an uninitialized data section for small objects.

T t The symbol is in the text (code) section.

Uppercase symbols are global/exported; lowercase are local unexported symbols.

like image 192
geekosaur Avatar answered Sep 19 '22 13:09

geekosaur