Linux kernel exported symbols
Asked Answered
T

2

17

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?

Tirade answered 9/4, 2012 at 8:45 Comment(0)
S
21

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.

Stumpage answered 9/4, 2012 at 8:53 Comment(0)
T
0

Regarding symbols exported by the Linux kernel

The /proc/kallsyms and System.map files contain the list of symbols that are present in the Linux kernel. However, only symbols that are marked in kernel with EXPORT_SYMBOL and some other related macros are available to external kernel modules. Symbols from /proc/kallsyms that are marked with T - global/exported - are available to kernel code, but not all of them are available to external kernel modules.

There is Module.symvers file that lists symbols that are available to external kernel modules. As Linux kernel documentation - link - says: "During a kernel build, a file named Module.symvers will be generated. Module.symvers contains all exported symbols from the kernel and compiled modules".

References:

Thirza answered 20/12, 2023 at 15:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.