version 1, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
KALLSYMS |
|
|
2 |
!!!KALLSYMS |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
OPTIONS |
|
|
7 |
LINKER PASSES |
|
|
8 |
DATA FORMAT |
|
|
9 |
SEE ALSO |
|
|
10 |
HISTORY |
|
|
11 |
---- |
|
|
12 |
!!NAME |
|
|
13 |
|
|
|
14 |
|
|
|
15 |
kallsyms - Extract all kernel symbols for debugging |
|
|
16 |
!!SYNOPSIS |
|
|
17 |
|
|
|
18 |
|
|
|
19 |
__kallsyms__ [[-Vh] kernel_filename |
|
|
20 |
!!DESCRIPTION |
|
|
21 |
|
|
|
22 |
|
|
|
23 |
__Kallsyms__ extracts all the non-stack symbols from a |
|
|
24 |
kernel and builds a data blob that can be linked into that |
|
|
25 |
kernel for use by debuggers. |
|
|
26 |
|
|
|
27 |
|
|
|
28 |
A normal kernel only exports symbols that are used by |
|
|
29 |
modules. For debugging you may want a list of all the |
|
|
30 |
non-stack symbols, not just the exported ones. |
|
|
31 |
__kallsyms__ extracts all sections and symbols from a |
|
|
32 |
kernel, constructs a list of the sections, symbols and their |
|
|
33 |
addresses and writes a relocatable object containing just |
|
|
34 |
the __kallsyms section. After the __kallsyms section is |
|
|
35 |
linked into the kernel and the kernel has been booted, any |
|
|
36 |
debugger can use the data in the __kallsyms section to get |
|
|
37 |
better symbol resolution. |
|
|
38 |
|
|
|
39 |
|
|
|
40 |
For example, a debugger can use the __kallsyms data to |
|
|
41 |
resolve a kernel address to: |
|
|
42 |
|
|
|
43 |
|
|
|
44 |
* |
|
|
45 |
|
|
|
46 |
|
|
|
47 |
The owning kernel or module. |
|
|
48 |
|
|
|
49 |
|
|
|
50 |
* |
|
|
51 |
|
|
|
52 |
|
|
|
53 |
The section within the owning code. |
|
|
54 |
|
|
|
55 |
|
|
|
56 |
* |
|
|
57 |
|
|
|
58 |
|
|
|
59 |
The nearest symbol. |
|
|
60 |
!!OPTIONS |
|
|
61 |
|
|
|
62 |
|
|
|
63 |
__-h__, __--help__ |
|
|
64 |
|
|
|
65 |
|
|
|
66 |
Display a summary of options and exit. |
|
|
67 |
|
|
|
68 |
|
|
|
69 |
__-V__, __--version__ |
|
|
70 |
|
|
|
71 |
|
|
|
72 |
Display the version of __kallsyms__ and |
|
|
73 |
exit. |
|
|
74 |
!!LINKER PASSES |
|
|
75 |
|
|
|
76 |
|
|
|
77 |
To create a kernel containing an accurate __kallsyms |
|
|
78 |
section, you have to make four linker passes instead of the |
|
|
79 |
normal single link step. kallsyms and the linker are fast, |
|
|
80 |
the three extra steps take a few seconds on a |
|
|
81 |
P200. |
|
|
82 |
|
|
|
83 |
|
|
|
84 |
1 |
|
|
85 |
|
|
|
86 |
|
|
|
87 |
The initial build of the kernel, without any __kallsyms |
|
|
88 |
data. Run __kallsyms__ against the output of this link, |
|
|
89 |
creating a relocatable object which contains all the |
|
|
90 |
sections and symbols in the raw kernel. |
|
|
91 |
|
|
|
92 |
|
|
|
93 |
2 |
|
|
94 |
|
|
|
95 |
|
|
|
96 |
Link the kernel again, this time including the |
|
|
97 |
__kallsyms__ output from step (1). Adding the __kallsyms |
|
|
98 |
section changes the number of sections and many of the |
|
|
99 |
kernel symbol offsets so run __kallsyms__ again against |
|
|
100 |
the second link, again saving the relocatable |
|
|
101 |
output. |
|
|
102 |
|
|
|
103 |
|
|
|
104 |
3 |
|
|
105 |
|
|
|
106 |
|
|
|
107 |
Link the kernel again, this time including the |
|
|
108 |
__kallsyms__ output from step (2). Run __kallsyms__ |
|
|
109 |
against the latest version of the kernel. The size and |
|
|
110 |
position of the __kallsyms section on this run is now |
|
|
111 |
stable, none of the kernel sections or symbols will change |
|
|
112 |
after this run. The __kallsyms__ output contains the |
|
|
113 |
final values of the kernel symbols. |
|
|
114 |
|
|
|
115 |
|
|
|
116 |
4 |
|
|
117 |
|
|
|
118 |
|
|
|
119 |
Link the final kernel, including the __kallsyms__ output |
|
|
120 |
from step (3). |
|
|
121 |
!!DATA FORMAT |
|
|
122 |
|
|
|
123 |
|
|
|
124 |
The __kallsyms section is a bit unusual. It deliberately has |
|
|
125 |
no relocatable data, all |
|
|
126 |
|
|
|
127 |
|
|
|
128 |
''/usr/include/sys/kallsyms.h'' contains the mappings for |
|
|
129 |
the __kallsyms data. |
|
|
130 |
|
|
|
131 |
|
|
|
132 |
__Header__ |
|
|
133 |
|
|
|
134 |
|
|
|
135 |
* |
|
|
136 |
|
|
|
137 |
|
|
|
138 |
Size of header. |
|
|
139 |
|
|
|
140 |
|
|
|
141 |
* |
|
|
142 |
|
|
|
143 |
|
|
|
144 |
Total size of the __kallsyms data, including |
|
|
145 |
strings. |
|
|
146 |
|
|
|
147 |
|
|
|
148 |
* |
|
|
149 |
|
|
|
150 |
|
|
|
151 |
Number of sections. This only included sections which are |
|
|
152 |
loaded into memory. |
|
|
153 |
|
|
|
154 |
|
|
|
155 |
* |
|
|
156 |
|
|
|
157 |
|
|
|
158 |
Offset to the first section entry from start of the |
|
|
159 |
__kallsyms header. |
|
|
160 |
|
|
|
161 |
|
|
|
162 |
* |
|
|
163 |
|
|
|
164 |
|
|
|
165 |
Size of each section entry, excluding the name |
|
|
166 |
string. |
|
|
167 |
|
|
|
168 |
|
|
|
169 |
* |
|
|
170 |
|
|
|
171 |
|
|
|
172 |
Number of symbols. |
|
|
173 |
|
|
|
174 |
|
|
|
175 |
* |
|
|
176 |
|
|
|
177 |
|
|
|
178 |
Offset to the first symbol entry from the start of the |
|
|
179 |
__kallsyms header. |
|
|
180 |
|
|
|
181 |
|
|
|
182 |
* |
|
|
183 |
|
|
|
184 |
|
|
|
185 |
Size of each symbol entry, excluding the name |
|
|
186 |
string. |
|
|
187 |
|
|
|
188 |
|
|
|
189 |
* |
|
|
190 |
|
|
|
191 |
|
|
|
192 |
Offset to the first string from the start of the __kallsyms |
|
|
193 |
header. |
|
|
194 |
|
|
|
195 |
|
|
|
196 |
* |
|
|
197 |
|
|
|
198 |
|
|
|
199 |
Start address of the first section[[1]. |
|
|
200 |
|
|
|
201 |
|
|
|
202 |
* |
|
|
203 |
|
|
|
204 |
|
|
|
205 |
End address of the last section[[1]. |
|
|
206 |
|
|
|
207 |
|
|
|
208 |
__Section entry__ |
|
|
209 |
|
|
|
210 |
|
|
|
211 |
One entry per loaded section. Since __kallsyms is a loaded |
|
|
212 |
section, if the input file contains a __kallsyms section |
|
|
213 |
then it is included in this list. |
|
|
214 |
|
|
|
215 |
|
|
|
216 |
* |
|
|
217 |
|
|
|
218 |
|
|
|
219 |
Start of the section within the kernel[[1]. |
|
|
220 |
|
|
|
221 |
|
|
|
222 |
* |
|
|
223 |
|
|
|
224 |
|
|
|
225 |
Size of section. |
|
|
226 |
|
|
|
227 |
|
|
|
228 |
* |
|
|
229 |
|
|
|
230 |
|
|
|
231 |
Offset to the name of section, from the start of the |
|
|
232 |
__kallsyms strings. |
|
|
233 |
|
|
|
234 |
|
|
|
235 |
* |
|
|
236 |
|
|
|
237 |
|
|
|
238 |
Section flags, from the original Elf section. |
|
|
239 |
|
|
|
240 |
|
|
|
241 |
__Symbol entry__ |
|
|
242 |
|
|
|
243 |
|
|
|
244 |
One per symbol in the input file. Only symbols that fall |
|
|
245 |
within loaded sections are stored. |
|
|
246 |
|
|
|
247 |
|
|
|
248 |
* |
|
|
249 |
|
|
|
250 |
|
|
|
251 |
Offset to the __kallsyms section entry that this symbol |
|
|
252 |
falls within. The offset is from the start of the __kallsyms |
|
|
253 |
section entries. |
|
|
254 |
|
|
|
255 |
|
|
|
256 |
* |
|
|
257 |
|
|
|
258 |
|
|
|
259 |
Address of the symbol within the kernel[[1]. The symbols are |
|
|
260 |
sorted in ascending order on this field. |
|
|
261 |
|
|
|
262 |
|
|
|
263 |
* |
|
|
264 |
|
|
|
265 |
|
|
|
266 |
Offset to the name of symbol, from the start of the |
|
|
267 |
__kallsyms strings. |
|
|
268 |
|
|
|
269 |
|
|
|
270 |
__Strings__ |
|
|
271 |
|
|
|
272 |
|
|
|
273 |
A set of NUL terminated strings. Each name is referenced |
|
|
274 |
using an offset from the start of the __kallsyms string |
|
|
275 |
area. |
|
|
276 |
|
|
|
277 |
|
|
|
278 |
__Note [[1]__ |
|
|
279 |
|
|
|
280 |
|
|
|
281 |
These fields are exceptions to the |
|
|
282 |
!!SEE ALSO |
|
|
283 |
|
|
|
284 |
|
|
|
285 |
insmod(8). |
|
|
286 |
!!HISTORY |
|
|
287 |
|
|
|
288 |
|
|
|
289 |
Initial version by Keith Owens |
|
|
290 |
---- |