6001 strcat(9f) needs a manpage
[unleashed.git] / usr / src / man / man1 / elfdump.1
blobc27e7aef0b9bf2ab48a0d309b5cf371b3719eb74
1 '\" te
2 .\"  Copyright (c) 2009 by Sun Microsystems, Inc.
3 .\" All rights reserved.
4 .\" The contents of this file are subject to the
5 .\" terms of the Common Development and Distribution License (the "License").
6 .\"  You may not use this file except in compliance with the License. You can
7 .\" obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
8 .\"  See the License for the specific language governing permissions and limitations
9 .\" under the License. When distributing Covered Code, include this CDDL HEADER
10 .\" in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.
11 .\"  If applicable, add the following below this CDDL HEADER, with the fields
12 .\" enclosed by brackets "[]" replaced with your own identifying information:
13 .\" Portions Copyright [yyyy] [name of copyright owner]
14 .TH ELFDUMP 1 "Apr 3, 2009"
15 .SH NAME
16 elfdump \- dumps selected parts of an object file
17 .SH SYNOPSIS
18 .LP
19 .nf
20 \fBelfdump\fR [\fB-cCdegGhHiklmnPrsSuvy\fR] [\fB-p | -w file\fR] [\fB-I\fR \fIindex-expr\fR]
21      [\fB-N\fR \fIname\fR] [\fB-O\fR \fIosabi\fR] [\fB-T\fR \fItype\fR] \fIfilename\fR...
22 .fi
24 .SH DESCRIPTION
25 .sp
26 .LP
27 The \fBelfdump\fR utility symbolically dumps selected parts of the specified
28 object file(s). The options allow specific portions of the file to be
29 displayed.
30 .sp
31 .LP
32 The \fBelfdump\fR utility is similar in function to the \fBdump\fR(1) utility.
33 The \fBdump\fR utility offers an older and less user-friendly interface than
34 \fBelfdump\fR, although \fBdump\fR might be more appropriate for certain uses
35 such as in shell scripts.
36 .sp
37 .LP
38 Archive files, produced by \fBar\fR(1), can also be inspected with
39 \fBelfdump\fR. In this case, each object within the archive is processed using
40 the options supplied.
41 .sp
42 .LP
43 \fBelfdump\fR can display the ELF header, program header array, and section
44 header array for any ELF object. It is also able to display the data found in
45 the following types of sections:
46 .sp
47 .in +2
48 .nf
49 Category                        Option       ELF Section Type
50 Dynamic                         -d           SHT_DYNAMIC
51 Global Offset Table (GOT)       -G           Special. See below.
52 Group                           -g           SHT_GROUP
53 Hardware/Software
54      Capabilities               -H           SHT_SUNW_cap
55 Hash Table                      -h           SHT_HASH
56 Interpreter                     -i           Special, see below.
57 Move                            -m           SHT_SUNW_move
58 Note                            -n           SHT_NOTE
59 Relocation                      -r           SHT_RELA
60                                              SHT_REL
61 Stack Unwind/Exceptions         -u           Special. See below.
62 Syminfo                         -y           SHT_SUNW_syminfo
63 Symbol Sort                     -S           SHT_SUNW_symsort
64                                              SHT_SUNW_tlssort
65 Symbol Table                    -s           SHT_SYMTAB
66                                              SHT_DYNSYM
67                                              SHT_SUNW_LDYNSYM
68                                              SHT_SUNW_versym
69 Versioning                      -v           SHT_SUNW_verdef
70                                              SHT_SUNW_verneed
71 .fi
72 .in -2
73 .sp
75 .sp
76 .LP
77 Interpreter and global offset table sections do not have a special ELF section
78 type, but are instead implemented as \fBSHT_PROGBITS\fR sections with well
79 known names (\fB\&.interp\fR and \fB\&.got\fR respectively). \fBelfdump\fR is
80 able to recognize and display these special sections.
81 .sp
82 .LP
83 Sections used for stack unwinding and exception handling can have the ELF
84 section type \fBSHT_PROGBITS\fR, or \fBSHT_AMD64_UNWIND\fR, depending on the
85 compiler and platform involved. These sections are recognized by name:
86 \fB\&.eh_frame\fR, \fB\&.eh_frame_hdr\fR, and \fB\&.exception_ranges\fR.
87 .sp
88 .LP
89 When run without options to narrow the information displayed, \fBelfdump\fR
90 displays all available information for each object.
91 .sp
92 .LP
93 For a complete description of the displayed information, refer to the \fILinker
94 and Libraries Guide\fR.
95 .SH OPTIONS
96 .sp
97 .LP
98 The following options are supported:
99 .sp
100 .ne 2
102 \fB\fB-c\fR\fR
104 .RS 18n
105 Dumps section header information.
109 .ne 2
111 \fB\fB-C\fR\fR
113 .RS 18n
114 Demangles C++ symbol names.
118 .ne 2
120 \fB\fB-d\fR\fR
122 .RS 18n
123 Dumps the contents of the \fB\&.dynamic\fR section.
127 .ne 2
129 \fB\fB-e\fR\fR
131 .RS 18n
132 Dumps the \fBELF\fR header.
136 .ne 2
138 \fB\fB-g\fR\fR
140 .RS 18n
141 Dumps the contents of the \fB\&.group\fR section.
145 .ne 2
147 \fB\fB-G\fR\fR
149 .RS 18n
150 Dumps the contents of the \fB\&.got\fR section.
154 .ne 2
156 \fB\fB-h\fR\fR
158 .RS 18n
159 Dumps the contents of the \fB\&.hash\fR section.
163 .ne 2
165 \fB\fB-H\fR\fR
167 .RS 18n
168 Dumps the contents of the \fB\&.SUNW_cap\fR hardware and software capabilities
169 section.
173 .ne 2
175 \fB\fB-i\fR\fR
177 .RS 18n
178 Dumps the contents of the \fB\&.interp\fR section.
182 .ne 2
184 \fB\fB-I\fR  \fIindex-expr\fR\fR
186 .RS 18n
187 Qualifies the sections or program headers to examine with a specific index or
188 index range. For example, the third section header in a file can be displayed
189 using:
191 .in +2
193 example% \fBelfdump -c -I 3 \fIfilename\fR\fR
195 .in -2
198 An \fIindex-expr\fR can be a single non-negative integer value that specifies a
199 specific item, as shown in the previous example. Alternatively, an
200 \fIindex-expr\fR can consist of two such values separated by a colon (:),
201 indicating a range of items. The following example displays the third, fourth,
202 and fifth program headers in a file:
204 .in +2
206 example% \fBelfdump -p -I 3:5 \fIfilename\fR\fR
208 .in -2
211 When specifying an index range, the second value can be omitted to indicate the
212 final item in the file. For example, the following statement lists all section
213 headers from the tenth to the end:
215 .in +2
217 example% \fBelfdump -c -I 10: \fIfilename\fR\fR
219 .in -2
222 See Matching Options for additional information about the matching options
223 (\fB-I\fR, \fB-N\fR, \fB-T\fR).
227 .ne 2
229 \fB\fB-k\fR\fR
231 .RS 18n
232 Calculates the \fBELF\fR checksum. See \fBgelf_checksum\fR(3ELF).
236 .ne 2
238 \fB\fB-l\fR\fR
240 .RS 18n
241 Displays long section names without truncation.
245 .ne 2
247 \fB\fB-m\fR\fR
249 .RS 18n
250 Dumps the contents of the \fB\&.SUNW_move\fR section.
254 .ne 2
256 \fB\fB-n\fR\fR
258 .RS 18n
259 Dumps the contents of \fB\&.note\fR sections. By default, \fBelfdump\fR
260 displays this data without interpretation in hexadecimal form. Core files are
261 an exception. A subset of the core file notes described in \fBcore\fR(4) are
262 interpreted by \fBelfdump\fR and displayed in a high level format: NT_PRSTATUS,
263 NT_PRPSINFO, NT_PLATFORM, NT_AUXV, NT_ASRS, NT_PSTATUS, NT_PSINFO, NT_PRCRED,
264 NT_UTSNAME, NT_LWPSTATUS, NT_LWPSINFO, NT_PRPRIV, NT_PRPRIVINFO, NT_CONTENT,
265 and NT_ZONENAME.
269 .ne 2
271 \fB\fB-N\fR \fIname\fR\fR
273 .RS 18n
274 Qualifies the sections or program headers to examine with a specific name. For
275 example, in a file that contains more than one symbol table, the
276 \fB\&.dynsym\fR symbol table can be displayed by itself using:
278 .in +2
280 example% \fBelfdump -N .dynsym \fIfilename\fR\fR
282 .in -2
285 ELF program headers do not have names. If the \fB-p\fR option is specified,
286 \fIname\fR refers to the program header type, and the behavior of the \fB-N\fR
287 option is identical to that of the \fB-T\fR option. For example, the program
288 header that identifies an interpreter can be displayed using:
290 .in +2
292 example% \fBelfdump -p -N PT_INTERP \fIfilename\fR\fR
294 .in -2
297 See Matching Options for additional information about the matching options
298 (\fB-I\fR, \fB-N\fR, \fB-T\fR).
302 .ne 2
304 \fB\fB-O\fR \fIosabi\fR\fR
306 .RS 18n
307 Specifies the Operating System ABI to apply when interpreting the object.
308 \fIosabi\fR can be the name or value of any of the \fBELFOSABI_\fR constants
309 found in \fB/usr/include/sys/elf.h\fR. For convenience, the \fBELFOSABI_\fR
310 prefix may be omitted from these names. Two \fIosabi\fR values are fully
311 supported: \fBsolaris\fR is the native ABI of the Solaris operating system.
312 \fBnone\fR is the generic ELF ABI. Support for other operating system ABIs may
313 be incomplete or missing. Items for which strings are unavailable are displayed
314 in numeric form.
316 If \fB-O\fR is not used, and the object ELF header specifies a non-generic ABI,
317 the ABI specified by the object is used. If the object specifies the generic
318 ELF ABI, \fBelfdump\fR searches for a \fB\&.note.ABI-tag\fR section, and if
319 found, identifies the object as having the \fBlinux\fR ABI. Otherwise, an
320 object that specifies the generic ELF ABI is assumed to conform to the
321 \fBsolaris\fR ABI.
325 .ne 2
327 \fB\fB-p\fR\fR
329 .RS 18n
330 Dumps the program headers. Individual program headers can be specified using
331 the matching options (\fB-I\fR, \fB-N\fR, \fB-T\fR). See Matching Options for
332 additional information.
334 The \fB-p\fR and \fB-w\fR options are mutually exclusive. Only one of these
335 options can be used in a given \fBelfdump\fR invocation
339 .ne 2
341 \fB\fB-P\fR\fR
343 .RS 18n
344 Generate and use alternative section header information based on the
345 information from the program headers, ignoring any section header information
346 contained in the file. If the file has no section headers a warning message is
347 printed and this option is automatically selected. Section headers are not used
348 by the system to execute a program. As such, a malicious program can have its
349 section headers stripped or altered to provide misleading information. In
350 contrast the program headers must be accurate for the program to be runnable.
351 The use of synthetic section header information derived from the program
352 headers allows files with altered section headers to be examined.
356 .ne 2
358 \fB\fB-r\fR\fR
360 .RS 18n
361 Dumps the contents of the \fB\&.rel\fR[\fBa\fR] relocation sections.
365 .ne 2
367 \fB\fB-s\fR\fR
369 .RS 18n
370 Dumps the contents of the \fB\&.SUNW_ldynsym\fR, \fB\&.dynsym\fR, and
371 \fB\&.symtab\fR symbol table sections. For archives, the archive symbol table
372 is also dumped. Individual sections can be specified with the matching options
373 (\fB-I\fR, \fB-N\fR, \fB-T\fR). An archive symbol table can be specified using
374 the special section name \fB-N\fR \fBARSYM\fR.
376 In the case of core files, the \fBshndx\fR field has the value "\fBunknown\fR"
377 since the field does not contain the valid values.
379 In addition to the standard symbol table information, the version definition
380 index of the symbol is also provided under the \fBver\fR heading.
382 See Matching Options  for additional information about the matching options
383 (\fB-I\fR, \fB-N\fR, \fB-T\fR).
387 .ne 2
389 \fB\fB-S\fR\fR
391 .RS 18n
392 Dumps the contents of the \fB\&.SUNW_ldynsym\fR and \fB\&.dynsym\fR symbol
393 table sections sorted in the order given by the \fB\&.SUNW_dynsymsort\fR and
394 \fB\&.SUNW_dyntlssort\fR symbol sort sections. Thread Local Storage (TLS)
395 symbols are sorted by offset. Regular symbols are sorted by address. Symbols
396 not referenced by the sort sections are not displayed.
400 .ne 2
402 \fB\fB-T\fR \fItype\fR\fR
404 .RS 18n
405 Qualifies the sections or program headers to examine with a specific type. For
406 example, in a file that contains more than one symbol table, the
407 \fB\&.dynsym\fR symbol table can be displayed by itself using:
409 .in +2
411 example% \fBelfdump -T SHT_DYNSYM \fIfilename\fR\fR
413 .in -2
416 The value of \fItype\fR can be a numeric value, or any of the \fBSHT_\fR
417 symbolic names defined in \fB/usr/include/sys/elf.h\fR. The \fBSHT_\fR prefix
418 is optional, and \fItype\fR is case insensitive. Therefore, the above example
419 can also be written as:
421 .in +2
423 example% \fBelfdump -T dynsym \fIfilename\fR\fR
425 .in -2
428 If the \fB-p\fR option is specified, \fItype\fR refers to the program header
429 type, which allows for the display of specific program headers. For example,
430 the program header that identifies an interpreter can be displayed using:
432 .in +2
434 example% \fBelfdump -p -T PT_INTERP \fIfilename\fR\fR
436 .in -2
439 The value of \fItype\fR can be a numeric value, or any of the \fBPT_\fR
440 symbolic names defined in \fB/usr/include/sys/elf.h\fR. The \fBPT_\fR prefix is
441 optional, and \fItype\fR is case insensitive. Therefore, the above example can
442 also be written as:
444 .in +2
446 example% \fBelfdump -p -T interp \fIfilename\fR\fR
448 .in -2
451 See Matching Options for additional information about the matching options
452 (\fB-I\fR, \fB-N\fR, \fB-T\fR).
456 .ne 2
458 \fB\fB-u\fR\fR
460 .RS 18n
461 Dumps the contents of sections used for stack frame unwinding and exception
462 processing.
466 .ne 2
468 \fB\fB-v\fR\fR
470 .RS 18n
471 Dumps the contents of the \fB\&.SUNW\fR\fI_version\fR version sections.
475 .ne 2
477 \fB\fB-w\fR \fIfile\fR\fR
479 .RS 18n
480 Writes the contents of sections which are specified with the matching options
481 (\fB-I\fR, \fB-N\fR, \fB-T\fR) to the named file. For example, extracting the
482 \fB\&.text\fR section of a file can be carried out with:
484 .in +2
486 example% \fBelfdump -w text.out -N .text \fIfilename\fR\fR
488 .in -2
491 See Matching Options for additional information about the matching options
492 (\fB-I\fR, \fB-N\fR, \fB-T\fR).
494 The \fB-p\fR and \fB-w\fR options are mutually exclusive. Only one of these
495 options can be used in a given \fBelfdump\fR invocation
499 .ne 2
501 \fB\fB-y\fR\fR
503 .RS 18n
504 Dumps the contents of the \fB\&.SUNW_syminfo\fR section.
507 .SH OPERANDS
510 The following operand is supported:
512 .ne 2
514 \fB\fIfilename\fR\fR
516 .RS 12n
517 The name of the specified object file.
520 .SH USAGE
521 .SS "Matching Options"
524 The options \fB-I\fR, \fB-N\fR, and \fB-T\fR are collectively referred to as
525 the \fBmatching options\fR. These options are used to narrow the range of
526 program headers or sections to examine, by index, name, or type.
529 The exact interpretation of the matching options depends on the other options
530 used:
531 .RS +4
533 .ie t \(bu
534 .el o
535 When used with the \fB-p\fR option, the matching options reference program
536 headers. \fB-I\fR refers to program header indexes. \fB-T\fR refers to program
537 header types. As program headers do not have names, the \fB-N\fR option behaves
538 identically to \fB-T\fR for program headers.
540 .RS +4
542 .ie t \(bu
543 .el o
544 The matching options are used to select sections by index, name, or type when
545 used with any of the options \fB-c\fR, \fB-g\fR, \fB-m\fR, \fB-n\fR, \fB-r\fR,
546 \fB-s\fR, \fB-S\fR, \fB-u\fR, or \fB-w\fR.
548 .RS +4
550 .ie t \(bu
551 .el o
552 If matching options are used alone without any of the options \fB-c\fR,
553 \fB-g\fR, \fB-m\fR, \fB-n\fR, \fB-p\fR\fB-r\fR, \fB-s\fR, \fB-S\fR, \fB-u\fR,
554 or \fB-w\fR, then \fBelfdump\fR examines each object, and displays the contents
555 of any sections matched.
559 Any number and type of matching option can be mixed in a given invocation of
560 \fBelfdump\fR. In this case, \fBelfdump\fR displays the superset of all items
561 matched by any of the matching options used. This feature allows for the
562 selection of complex groupings of items using the most convenient form for
563 specifying each item.
564 .SH FILES
566 .ne 2
568 \fB\fBliblddbg.so\fR\fR
570 .RS 15n
571 linker debugging library
574 .SH ATTRIBUTES
577 See \fBattributes\fR(5) for descriptions of the following attributes:
582 box;
583 c | c
584 l | l .
585 ATTRIBUTE TYPE  ATTRIBUTE VALUE
587 Interface Stability     Committed
590 .SH SEE ALSO
593 \fBar\fR(1), \fBdump\fR(1), \fBnm\fR(1), \fBpvs\fR(1), \fBelf\fR(3ELF),
594 \fBcore\fR(4), \fBattributes\fR(5)
597 \fILinker and Libraries Guide\fR