1elfdump(1) User Commands elfdump(1)
2
3
4
6 elfdump - dumps selected parts of an object file
7
9 elfdump [-cCdegGhHiklmnPrsSuvy] [-p | -w file] [-I index-expr]
10 [-N name] [-O osabi] [-T type] filename...
11
12
14 The elfdump utility symbolically dumps selected parts of the specified
15 object file(s). The options allow specific portions of the file to be
16 displayed.
17
18
19 The elfdump utility is similar in function to the dump(1) utility. The
20 dump utility offers an older and less user-friendly interface than elf‐
21 dump, although dump might be more appropriate for certain uses such as
22 in shell scripts.
23
24
25 Archive files, produced by ar(1), can also be inspected with elfdump.
26 In this case, each object within the archive is processed using the
27 options supplied.
28
29
30 elfdump can display the ELF header, program header array, and section
31 header array for any ELF object. It is also able to display the data
32 found in the following types of sections:
33
34 Category Option ELF Section Type
35 Dynamic -d SHT_DYNAMIC
36 Global Offset Table (GOT) -G Special. See below.
37 Group -g SHT_GROUP
38 Hardware/Software
39 Capabilities -H SHT_SUNW_cap
40 Hash Table -h SHT_HASH
41 Interpreter -i Special, see below.
42 Move -m SHT_SUNW_move
43 Note -n SHT_NOTE
44 Relocation -r SHT_RELA
45 SHT_REL
46 Stack Unwind/Exceptions -u Special. See below.
47 Syminfo -y SHT_SUNW_syminfo
48 Symbol Sort -S SHT_SUNW_symsort
49 SHT_SUNW_tlssort
50 Symbol Table -s SHT_SYMTAB
51 SHT_DYNSYM
52 SHT_SUNW_LDYNSYM
53 SHT_SUNW_versym
54 Versioning -v SHT_SUNW_verdef
55 SHT_SUNW_verneed
56
57
58
59
60 Interpreter and global offset table sections do not have a special ELF
61 section type, but are instead implemented as SHT_PROGBITS sections with
62 well known names (.interp and .got respectively). elfdump is able to
63 recognize and display these special sections.
64
65
66 Sections used for stack unwinding and exception handling can have the
67 ELF section type SHT_PROGBITS, or SHT_AMD64_UNWIND, depending on the
68 compiler and platform involved. These sections are recognized by name:
69 .eh_frame, .eh_frame_hdr, and .exception_ranges.
70
71
72 When run without options to narrow the information displayed, elfdump
73 displays all available information for each object.
74
75
76 For a complete description of the displayed information, refer to the
77 Linker and Libraries Guide.
78
80 The following options are supported:
81
82 -c Dumps section header information.
83
84
85 -C Demangles C++ symbol names.
86
87
88 -d Dumps the contents of the .dynamic section.
89
90
91 -e Dumps the ELF header.
92
93
94 -g Dumps the contents of the .group section.
95
96
97 -G Dumps the contents of the .got section.
98
99
100 -h Dumps the contents of the .hash section.
101
102
103 -H Dumps the contents of the .SUNW_cap hardware and
104 software capabilities section.
105
106
107 -i Dumps the contents of the .interp section.
108
109
110 -I index-expr Qualifies the sections or program headers to examine
111 with a specific index or index range. For example,
112 the third section header in a file can be displayed
113 using:
114
115 example% elfdump -c -I 3 filename
116
117
118 An index-expr can be a single non-negative integer
119 value that specifies a specific item, as shown in the
120 previous example. Alternatively, an index-expr can
121 consist of two such values separated by a colon (:),
122 indicating a range of items. The following example
123 displays the third, fourth, and fifth program headers
124 in a file:
125
126 example% elfdump -p -I 3:5 filename
127
128
129 When specifying an index range, the second value can
130 be omitted to indicate the final item in the file.
131 For example, the following statement lists all sec‐
132 tion headers from the tenth to the end:
133
134 example% elfdump -c -I 10: filename
135
136
137 See Matching Options for additional information about
138 the matching options (-I, -N, -T).
139
140
141 -k Calculates the ELF checksum. See gelf_checksum(3ELF).
142
143
144 -l Displays long section names without truncation.
145
146
147 -m Dumps the contents of the .SUNW_move section.
148
149
150 -n Dumps the contents of .note sections. By default,
151 elfdump displays this data without interpretation in
152 hexadecimal form. Core files are an exception. A sub‐
153 set of the core file notes described in core(4) are
154 interpreted by elfdump and displayed in a high level
155 format: NT_PRSTATUS, NT_PRPSINFO, NT_PLATFORM,
156 NT_AUXV, NT_ASRS, NT_PSTATUS, NT_PSINFO, NT_PRCRED,
157 NT_UTSNAME, NT_LWPSTATUS, NT_LWPSINFO, NT_PRPRIV,
158 NT_PRPRIVINFO, NT_CONTENT, and NT_ZONENAME.
159
160
161 -N name Qualifies the sections or program headers to examine
162 with a specific name. For example, in a file that
163 contains more than one symbol table, the .dynsym sym‐
164 bol table can be displayed by itself using:
165
166 example% elfdump -N .dynsym filename
167
168
169 ELF program headers do not have names. If the -p
170 option is specified, name refers to the program
171 header type, and the behavior of the -N option is
172 identical to that of the -T option. For example, the
173 program header that identifies an interpreter can be
174 displayed using:
175
176 example% elfdump -p -N PT_INTERP filename
177
178
179 See Matching Options for additional information about
180 the matching options (-I, -N, -T).
181
182
183 -O osabi Specifies the Operating System ABI to apply when
184 interpreting the object. osabi can be the name or
185 value of any of the ELFOSABI_ constants found in
186 /usr/include/sys/elf.h. For convenience, the ELFOS‐
187 ABI_ prefix may be omitted from these names. Two
188 osabi values are fully supported: solaris is the
189 native ABI of the Solaris operating system. none is
190 the generic ELF ABI. Support for other operating sys‐
191 tem ABIs may be incomplete or missing. Items for
192 which strings are unavailable are displayed in
193 numeric form.
194
195 If -O is not used, and the object ELF header speci‐
196 fies a non-generic ABI, the ABI specified by the
197 object is used. If the object specifies the generic
198 ELF ABI, elfdump searches for a .note.ABI-tag sec‐
199 tion, and if found, identifies the object as having
200 the linux ABI. Otherwise, an object that specifies
201 the generic ELF ABI is assumed to conform to the
202 solaris ABI.
203
204
205 -p Dumps the program headers. Individual program headers
206 can be specified using the matching options (-I, -N,
207 -T). See Matching Options for additional information.
208
209 The -p and -w options are mutually exclusive. Only
210 one of these options can be used in a given elfdump
211 invocation
212
213
214 -P Generate and use alternative section header informa‐
215 tion based on the information from the program head‐
216 ers, ignoring any section header information con‐
217 tained in the file. If the file has no section head‐
218 ers a warning message is printed and this option is
219 automatically selected. Section headers are not used
220 by the system to execute a program. As such, a mali‐
221 cious program can have its section headers stripped
222 or altered to provide misleading information. In con‐
223 trast the program headers must be accurate for the
224 program to be runnable. The use of synthetic section
225 header information derived from the program headers
226 allows files with altered section headers to be exam‐
227 ined.
228
229
230 -r Dumps the contents of the .rel[a] relocation sec‐
231 tions.
232
233
234 -s Dumps the contents of the .SUNW_ldynsym, .dynsym, and
235 .symtab symbol table sections. For archives, the ar‐
236 chive symbol table is also dumped. Individual sec‐
237 tions can be specified with the matching options (-I,
238 -N, -T). An archive symbol table can be specified
239 using the special section name -N ARSYM.
240
241 In the case of core files, the shndx field has the
242 value "unknown" since the field does not contain the
243 valid values.
244
245 In addition to the standard symbol table information,
246 the version definition index of the symbol is also
247 provided under the ver heading.
248
249 See Matching Options for additional information
250 about the matching options (-I, -N, -T).
251
252
253 -S Dumps the contents of the .SUNW_ldynsym and .dynsym
254 symbol table sections sorted in the order given by
255 the .SUNW_dynsymsort and .SUNW_dyntlssort symbol sort
256 sections. Thread Local Storage (TLS) symbols are
257 sorted by offset. Regular symbols are sorted by
258 address. Symbols not referenced by the sort sections
259 are not displayed.
260
261
262 -T type Qualifies the sections or program headers to examine
263 with a specific type. For example, in a file that
264 contains more than one symbol table, the .dynsym sym‐
265 bol table can be displayed by itself using:
266
267 example% elfdump -T SHT_DYNSYM filename
268
269
270 The value of type can be a numeric value, or any of
271 the SHT_ symbolic names defined in
272 /usr/include/sys/elf.h. The SHT_ prefix is optional,
273 and type is case insensitive. Therefore, the above
274 example can also be written as:
275
276 example% elfdump -T dynsym filename
277
278
279 If the -p option is specified, type refers to the
280 program header type, which allows for the display of
281 specific program headers. For example, the program
282 header that identifies an interpreter can be dis‐
283 played using:
284
285 example% elfdump -p -T PT_INTERP filename
286
287
288 The value of type can be a numeric value, or any of
289 the PT_ symbolic names defined in
290 /usr/include/sys/elf.h. The PT_ prefix is optional,
291 and type is case insensitive. Therefore, the above
292 example can also be written as:
293
294 example% elfdump -p -T interp filename
295
296
297 See Matching Options for additional information about
298 the matching options (-I, -N, -T).
299
300
301 -u Dumps the contents of sections used for stack frame
302 unwinding and exception processing.
303
304
305 -v Dumps the contents of the .SUNW_version version sec‐
306 tions.
307
308
309 -w file Writes the contents of sections which are specified
310 with the matching options (-I, -N, -T) to the named
311 file. For example, extracting the .text section of a
312 file can be carried out with:
313
314 example% elfdump -w text.out -N .text filename
315
316
317 See Matching Options for additional information about
318 the matching options (-I, -N, -T).
319
320 The -p and -w options are mutually exclusive. Only
321 one of these options can be used in a given elfdump
322 invocation
323
324
325 -y Dumps the contents of the .SUNW_syminfo section.
326
327
329 The following operand is supported:
330
331 filename The name of the specified object file.
332
333
335 Matching Options
336 The options -I, -N, and -T are collectively referred to as the matching
337 options. These options are used to narrow the range of program headers
338 or sections to examine, by index, name, or type.
339
340
341 The exact interpretation of the matching options depends on the other
342 options used:
343
344 o When used with the -p option, the matching options reference
345 program headers. -I refers to program header indexes. -T
346 refers to program header types. As program headers do not
347 have names, the -N option behaves identically to -T for pro‐
348 gram headers.
349
350 o The matching options are used to select sections by index,
351 name, or type when used with any of the options -c, -g, -m,
352 -n, -r, -s, -S, -u, or -w.
353
354 o If matching options are used alone without any of the
355 options -c, -g, -m, -n, -p-r, -s, -S, -u, or -w, then elf‐
356 dump examines each object, and displays the contents of any
357 sections matched.
358
359
360 Any number and type of matching option can be mixed in a given invoca‐
361 tion of elfdump. In this case, elfdump displays the superset of all
362 items matched by any of the matching options used. This feature allows
363 for the selection of complex groupings of items using the most conve‐
364 nient form for specifying each item.
365
367 liblddbg.so linker debugging library
368
369
371 See attributes(5) for descriptions of the following attributes:
372
373
374
375
376 ┌─────────────────────────────┬─────────────────────────────┐
377 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
378 ├─────────────────────────────┼─────────────────────────────┤
379 │Availability │SUNWbtool │
380 ├─────────────────────────────┼─────────────────────────────┤
381 │Interface Stability │Committed │
382 └─────────────────────────────┴─────────────────────────────┘
383
385 ar(1), dump(1), nm(1), pvs(1), elf(3ELF), core(4), attributes(5)
386
387
388 Linker and Libraries Guide
389
390
391
392SunOS 5.11 3 Apr 2009 elfdump(1)