ELFDUMP(1) | User Commands | ELFDUMP(1) |
elfdump - dumps selected parts of an object file
elfdump [-cCdegGhHiklmnPrsSuvy] [-p | -w file] [-I index-expr]
[-N name] [-O osabi] [-T type] filename...
The elfdump utility symbolically dumps selected parts of the specified object file(s). The options allow specific portions of the file to be displayed.
The elfdump utility is similar in function to the dump(1) utility. The dump utility offers an older and less user-friendly interface than elfdump, although dump might be more appropriate for certain uses such as in shell scripts.
Archive files, produced by ar(1), can also be inspected with elfdump. In this case, each object within the archive is processed using the options supplied.
elfdump can display the ELF header, program header array, and section header array for any ELF object. It is also able to display the data found in the following types of sections:
Category Option ELF Section Type Dynamic -d SHT_DYNAMIC Global Offset Table (GOT) -G Special. See below. Group -g SHT_GROUP Hardware/Software
Capabilities -H SHT_SUNW_cap Hash Table -h SHT_HASH Interpreter -i Special, see below. Move -m SHT_SUNW_move Note -n SHT_NOTE Relocation -r SHT_RELA
SHT_REL Stack Unwind/Exceptions -u Special. See below. Syminfo -y SHT_SUNW_syminfo Symbol Sort -S SHT_SUNW_symsort
SHT_SUNW_tlssort Symbol Table -s SHT_SYMTAB
SHT_DYNSYM
SHT_SUNW_LDYNSYM
SHT_SUNW_versym Versioning -v SHT_SUNW_verdef
SHT_SUNW_verneed
Interpreter and global offset table sections do not have a special ELF section type, but are instead implemented as SHT_PROGBITS sections with well known names (.interp and .got respectively). elfdump is able to recognize and display these special sections.
Sections used for stack unwinding and exception handling can have the ELF section type SHT_PROGBITS, or SHT_AMD64_UNWIND, depending on the compiler and platform involved. These sections are recognized by name: .eh_frame, .eh_frame_hdr, and .exception_ranges.
When run without options to narrow the information displayed, elfdump displays all available information for each object.
For a complete description of the displayed information, refer to the Linker and Libraries Guide.
The following options are supported:
-c
-C
-d
-e
-g
-G
-h
-H
-i
-I index-expr
example% elfdump -c -I 3 filename
An index-expr can be a single non-negative integer value that specifies a specific item, as shown in the previous example. Alternatively, an index-expr can consist of two such values separated by a colon (:), indicating a range of items. The following example displays the third, fourth, and fifth program headers in a file:
example% elfdump -p -I 3:5 filename
When specifying an index range, the second value can be omitted to indicate the final item in the file. For example, the following statement lists all section headers from the tenth to the end:
example% elfdump -c -I 10: filename
See Matching Options for additional information about the matching options (-I, -N, -T).
-k
-l
-m
-n
-N name
example% elfdump -N .dynsym filename
ELF program headers do not have names. If the -p option is specified, name refers to the program header type, and the behavior of the -N option is identical to that of the -T option. For example, the program header that identifies an interpreter can be displayed using:
example% elfdump -p -N PT_INTERP filename
See Matching Options for additional information about the matching options (-I, -N, -T).
-O osabi
If -O is not used, and the object ELF header specifies a non-generic ABI, the ABI specified by the object is used. If the object specifies the generic ELF ABI, elfdump searches for a .note.ABI-tag section, and if found, identifies the object as having the linux ABI. Otherwise, an object that specifies the generic ELF ABI is assumed to conform to the solaris ABI.
-p
The -p and -w options are mutually exclusive. Only one of these options can be used in a given elfdump invocation
-P
-r
-s
In the case of core files, the shndx field has the value "unknown" since the field does not contain the valid values.
In addition to the standard symbol table information, the version definition index of the symbol is also provided under the ver heading.
See Matching Options for additional information about the matching options (-I, -N, -T).
-S
-T type
example% elfdump -T SHT_DYNSYM filename
The value of type can be a numeric value, or any of the SHT_ symbolic names defined in /usr/include/sys/elf.h. The SHT_ prefix is optional, and type is case insensitive. Therefore, the above example can also be written as:
example% elfdump -T dynsym filename
If the -p option is specified, type refers to the program header type, which allows for the display of specific program headers. For example, the program header that identifies an interpreter can be displayed using:
example% elfdump -p -T PT_INTERP filename
The value of type can be a numeric value, or any of the PT_ symbolic names defined in /usr/include/sys/elf.h. The PT_ prefix is optional, and type is case insensitive. Therefore, the above example can also be written as:
example% elfdump -p -T interp filename
See Matching Options for additional information about the matching options (-I, -N, -T).
-u
-v
-w file
example% elfdump -w text.out -N .text filename
See Matching Options for additional information about the matching options (-I, -N, -T).
The -p and -w options are mutually exclusive. Only one of these options can be used in a given elfdump invocation
-y
The following operand is supported:
filename
The options -I, -N, and -T are collectively referred to as the matching options. These options are used to narrow the range of program headers or sections to examine, by index, name, or type.
The exact interpretation of the matching options depends on the other options used:
Any number and type of matching option can be mixed in a given invocation of elfdump. In this case, elfdump displays the superset of all items matched by any of the matching options used. This feature allows for the selection of complex groupings of items using the most convenient form for specifying each item.
liblddbg.so
See attributes(7) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
Interface Stability | Committed |
ar(1), dump(1), nm(1), pvs(1), elf(3ELF), core(5), attributes(7)
Linker and Libraries Guide
December 19, 2018 | OmniOS |