Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | #!/bin/sh -x |
2 | # Based on the vmlinux file create the System.map file | |
3 | # System.map is used by module-init tools and some debugging | |
943ffb58 | 4 | # tools to retrieve the actual addresses of symbols in the kernel. |
1da177e4 LT |
5 | # |
6 | # Usage | |
7 | # mksysmap vmlinux System.map | |
8 | ||
9 | ||
10 | ##### | |
11 | # Generate System.map (actual filename passed as second argument) | |
12 | ||
13 | # $NM produces the following output: | |
14 | # f0081e80 T alloc_vfsmnt | |
15 | ||
16 | # The second row specify the type of the symbol: | |
17 | # A = Absolute | |
18 | # B = Uninitialised data (.bss) | |
4fec5420 | 19 | # C = Common symbol |
1da177e4 LT |
20 | # D = Initialised data |
21 | # G = Initialised data for small objects | |
22 | # I = Indirect reference to another symbol | |
23 | # N = Debugging symbol | |
24 | # R = Read only | |
25 | # S = Uninitialised data for small objects | |
26 | # T = Text code symbol | |
27 | # U = Undefined symbol | |
28 | # V = Weak symbol | |
29 | # W = Weak symbol | |
30 | # Corresponding small letters are local symbols | |
31 | ||
32 | # For System.map filter away: | |
33 | # a - local absolute symbols | |
34 | # U - undefined global symbols | |
aab34ac8 | 35 | # N - debugging symbols |
1da177e4 LT |
36 | # w - local weak symbols |
37 | ||
38 | # readprofile starts reading symbols when _stext is found, and | |
39 | # continue until it finds a symbol which is not either of 'T', 't', | |
c1346169 MY |
40 | # 'W' or 'w'. |
41 | # | |
42 | # Ignored prefixes: | |
a2833d1b MY |
43 | # $ - local symbols for ARM, MIPS, etc. |
44 | # .L - local labels, .LBB,.Ltmpxxx,.L__unnamed_xx,.LASANPC, etc. | |
c1346169 | 45 | # __crc_ - modversions |
d32b55f4 MY |
46 | # __kstrtab_ - EXPORT_SYMBOL (symbol name) |
47 | # __kstrtabns_ - EXPORT_SYMBOL (namespace) | |
a2833d1b MY |
48 | # |
49 | # Ignored symbols: | |
50 | # L0 - for LoongArch? | |
51 | ||
52 | $NM -n $1 | grep -v \ | |
53 | -e ' [aNUw] ' \ | |
54 | -e ' \$' \ | |
55 | -e ' \.L' \ | |
56 | -e ' __crc_' \ | |
d32b55f4 MY |
57 | -e ' __kstrtab_' \ |
58 | -e ' __kstrtabns_' \ | |
a2833d1b MY |
59 | -e ' L0$' \ |
60 | > $2 |