Next: elfedit, Previous: dlltool, Up: Top [Contents][Index]
OBJDUMPINCLUDESOURCE:=0 OBJDUMPFULLCONTENTS:= 0 Edit these options to control the.objdump file according to your preferences for the project: CREATEOBJDUMP—The value 1 directs nios2-elf-objdump to run with the options -disassemble, -syms, -all-header, and -source. OBJDUMPINCLUDESOURCE—The value 1 adds the option -source to the. The main purpose of the objdump command is to help in debugging the object file. It is used for the following listed purposes: To retrieve archive header To get the offset of the file. Objdump displays information about one or more object files. The options control what particular information to display. This information is mostly useful to programmers who are working on the compilation tools, as opposed to programmers who just want their program to compile and work.
readelf displays information about one or more ELF format objectfiles. The options control what particular information to display.
elffile… are the object files to be examined. 32-bit and64-bit ELF files are supported, as are archives containing ELF files.
This program performs a similar function to objdump but itgoes into more detail and it exists independently of the BFDlibrary, so if there is a bug in BFD then readelf will not beaffected.
The long and short forms of options, shown here as alternatives, areequivalent. At least one option besides ‘-v’ or ‘-H’ must begiven.
-a--allEquivalent to specifying --file-header,--program-headers, --sections, --symbols,--relocs, --dynamic, --notes,--version-info, --arch-specific, --unwind,--section-groups and --histogram.
Note - this option does not enable --use-dynamic itself, soif that option is not present on the command line then dynamic symbolsand dynamic relocs will not be displayed.
-h--file-headerDisplays the information contained in the ELF header at the start of thefile.
-l--program-headers--segmentsDisplays the information contained in the file’s segment headers, if ithas any.
-S--sections--section-headersDisplays the information contained in the file’s section headers, if ithas any.
-g--section-groupsDisplays the information contained in the file’s section groups, if ithas any.
-t--section-detailsDisplays the detailed section information. Implies -S.
-s--symbols--symsDisplays the entries in symbol table section of the file, if it has one.If a symbol has version information associated with it then this isdisplayed as well. The version string is displayed as a suffix to thesymbol name, preceded by an @ character. For example‘foo@VER_1’. If the version is the default version to be usedwhen resolving unversioned references to the symbol then it isdisplayed as a suffix preceded by two @ characters. For example‘foo@@VER_2’.
--dyn-symsDisplays the entries in dynamic symbol table section of the file, if ithas one. The output format is the same as the format used by the--syms option.
--lto-symsDisplays the contents of any LTO symbol tables in the file.
-C--demangle[=style]Decode (demangle) low-level symbol names into user-level names.This makes C++ function names readable. Different compilers havedifferent mangling styles. The optional demangling style argument canbe used to choose an appropriate demangling style for yourcompiler. See c++filt, for more information on demangling.
--no-demangleDo not demangle low-level symbol names. This is the default.
--recurse-limit--no-recurse-limit--recursion-limit--no-recursion-limitEnables or disables a limit on the amount of recursion performedwhilst demangling strings. Since the name mangling formats allow foran infinite level of recursion it is possible to create strings whosedecoding will exhaust the amount of stack space available on the hostmachine, triggering a memory fault. The limit tries to prevent thisfrom happening by restricting recursion to 2048 levels of nesting.
The default is for this limit to be enabled, but disabling it may benecessary in order to demangle truly complicated names. Note howeverthat if the recursion limit is disabled then stack exhaustion ispossible and any bug reports about such an event will be rejected.
-e--headersDisplay all the headers in the file. Equivalent to -h -l -S.
-n--notesDisplays the contents of the NOTE segments and/or sections, if any.
-r--relocsDisplays the contents of the file’s relocation section, if it has one.
-u--unwindDisplays the contents of the file’s unwind section, if it has one. Onlythe unwind sections for IA64 ELF files, as well as ARM unwind tables(.ARM.exidx / .ARM.extab) are currently supported. Ifsupport is not yet implemented for your architecture you could trydumping the contents of the .eh_frames section using the--debug-dump=frames or --debug-dump=frames-interpoptions.
-d
--dynamicDisplays the contents of the file’s dynamic section, if it has one.
-V--version-infoDisplays the contents of the version sections in the file, it theyexist.
-A--arch-specificDisplays architecture-specific information in the file, if thereis any.
-D--use-dynamicWhen displaying symbols, this option makes readelf use thesymbol hash tables in the file’s dynamic section, rather than thesymbol table sections.
When displaying relocations, this option makes readelfdisplay the dynamic relocations rather than the static relocations.
-L--lint--enable-checksDisplays warning messages about possible problems with the file(s)being examined. If used on its own then all of the contents of thefile(s) will be examined. If used with one of the dumping optionsthen the warning messages will only be produced for the things beingdisplayed.
-x <number or name>--hex-dump=<number or name>Displays the contents of the indicated section as a hexadecimal bytes.A number identifies a particular section by index in the section table;any other string identifies all sections with that name in the object file.
-R <number or name>--relocated-dump=<number or name>Displays the contents of the indicated section as a hexadecimalbytes. A number identifies a particular section by index in thesection table; any other string identifies all sections with that namein the object file. The contents of the section will be relocatedbefore they are displayed.
-p <number or name>--string-dump=<number or name>Displays the contents of the indicated section as printable strings.A number identifies a particular section by index in the section table;any other string identifies all sections with that name in the object file.
-z--decompressRequests that the section(s) being dumped by x, R orp options are decompressed before being displayed. If thesection(s) are not compressed then they are displayed as is.

-c--archive-indexDisplays the file symbol index information contained in the header partof binary archives. Performs the same function as the tcommand to ar, but without using the BFD library. See ar.
-w[lLiaprmfFsOoRtUuTgAckK]--debug-dump[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=str-offsets,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links,=follow-links]Displays the contents of the DWARF debug sections in the file, if anyare present. Compressed debug sections are automatically decompressed(temporarily) before they are displayed. If one or more of theoptional letters or words follows the switch then only those type(s)of data will be dumped. The letters and words refer to the followinginformation:
a=abbrevDisplays the contents of the ‘.debug_abbrev’ section.
A=addrDisplays the contents of the ‘.debug_addr’ section.
c=cu_indexDisplays the contents of the ‘.debug_cu_index’ and/or‘.debug_tu_index’ sections.
f=framesDisplay the raw contents of a ‘.debug_frame’ section.
F=frame-interpDisplay the interpreted contents of a ‘.debug_frame’ section.
g=gdb_indexDisplays the contents of the ‘.gdb_index’ and/or‘.debug_names’ sections.
i=infoDisplays the contents of the ‘.debug_info’ section. Note: theoutput from this option can also be restricted by the use of the --dwarf-depth and --dwarf-start options.
k=linksDisplays the contents of the ‘.gnu_debuglink’ and/or‘.gnu_debugaltlink’ sections. Also displays any links toseparate dwarf object files (dwo), if they are specified by the DW_AT_GNU_dwo_name or DW_AT_dwo_name attributes in the‘.debug_info’ section.
K=follow-linksDisplay the contents of any selected debug sections that are found inlinked, separate debug info file(s). This can result in multipleversions of the same debug section being displayed if it exists inmore than one file.

In addition, when displaying DWARF attributes, if a form is found thatreferences the separate debug info file, then the referenced contentswill also be displayed.
l=rawlineDisplays the contents of the ‘.debug_line’ section in a rawformat.
L=decodedlineDisplays the interpreted contents of the ‘.debug_line’ section.
m=macroDisplays the contents of the ‘.debug_macro’ and/or‘.debug_macinfo’ sections.
o=locDisplays the contents of the ‘.debug_loc’ and/or‘.debug_loclists’ sections.
O=str-offsetsDisplays the contents of the ‘.debug_str_offsets’ section.
p=pubnamesDisplays the contents of the ‘.debug_pubnames’ and/or‘.debug_gnu_pubnames’ sections.
r=arangesDisplays the contents of the ‘.debug_aranges’ section.
R=RangesDisplays the contents of the ‘.debug_ranges’ and/or‘.debug_rnglists’ sections.
s=strDisplays the contents of the ‘.debug_str’, ‘.debug_line_str’and/or ‘.debug_str_offsets’ sections.
t=pubtypeDisplays the contents of the ‘.debug_pubtypes’ and/or‘.debug_gnu_pubtypes’ sections.
T=trace_aranges
Displays the contents of the ‘.trace_aranges’ section.
u=trace_abbrevDisplays the contents of the ‘.trace_abbrev’ section.
U=trace_infoDisplays the contents of the ‘.trace_info’ section.
Note: displaying the contents of ‘.debug_static_funcs’,‘.debug_static_vars’ and ‘debug_weaknames’ sections is notcurrently supported.
--dwarf-depth=nLimit the dump of the .debug_info section to n children.This is only useful with --debug-dump=info. The default isto print all DIEs; the special value 0 for n will also have thiseffect.
With a non-zero value for n, DIEs at or deeper than nlevels will not be printed. The range for n is zero-based.
--dwarf-start=nPrint only DIEs beginning with the DIE numbered n. This is onlyuseful with --debug-dump=info.
If specified, this option will suppress printing of any headerinformation and all DIEs before the DIE numbered n. Onlysiblings and children of the specified DIE will be printed.
This can be used in conjunction with --dwarf-depth.
--ctf=sectionDisplay the contents of the specified CTF section. CTF sections themselvescontain many subsections, all of which are displayed in order.
--ctf-parent=sectionSpecify the name of another section from which the CTF dictionary can inherittypes. (If none is specified, we assume the CTF dictionary inherits typesfrom the default-named member of the archive contained within this section.)
--ctf-symbols=section--ctf-strings=sectionSpecify the name of another section from which the CTF file can inheritstrings and symbols. By default, the .symtab and its linkedstring table are used.
If either of --ctf-symbols or --ctf-strings is specified, theother must be specified as well.
-I--histogramDisplay a histogram of bucket list lengths when displaying the contentsof the symbol tables.
-v--versionDisplay the version number of readelf.
-W--wideDon’t break output lines to fit into 80 columns. By defaultreadelf breaks section header and segment listing lines for64-bit ELF files, so that they fit into 80 columns. This option causesreadelf to print each section header resp. each segment one asingle line, which is far more readable on terminals wider than 80 columns.
-T--silent-truncationNormally when readelf is displaying a symbol name, and it has totruncate the name to fit into an 80 column display, it will add asuffix of [...] to the name. This command line optiondisables this behaviour, allowing 5 more characters of the name to bedisplayed and restoring the old behaviour of readelf (prior to release2.35).
-H--helpDisplay the command-line options understood by readelf.
Next: elfedit, Previous: dlltool, Up: Top [Contents][Index]
What is objdump?
5 objdump examples
Syntax and Options
Related Commands
The Linux objdump command is used to display various types of information stored in object files. This command is mostly used while debugging or by the developers who are working on compilation tools.
Output consisting of only the file header (ELF header) can be displayed using -f option with this command.
Consider the following example :
So we see that the file header was produced in the output.
An object file may consist of various sections. To retrieve information related to all the sections, supply the -s option along with this command.
Consider the following example :
So we see that information related to all the sections was produced in the output.
If we want that the output should consist only of a particular section. Then this can be done using the -j option along with this command.
Consider the following example :
So we see that details related to the section .interp was produced in the output.
Rather than supplying options through command line, a file can be used to supply options to the objdump command.
Consider the following example :
So we see that objdump command successfully accepted the options from a file and produced a relevant output.
Information related to all the headers can be retrieved using -x option along with this command.
Consider the following example :
So we see that a detailed information was produced in the output.
| Short Option | Long Option | Option Description |
|---|---|---|
| -a | –archive-header | If any of the objfile files are archives, display the archive header information (in a format similar to ls -l). Besides the information you could list with ar tv, objdump -a shows the object file format of each archive member. |
| –adjust-vma=offset | When dumping information, first add offset to all the section addresses. This is useful if the section addresses do not correspond to the symbol table, which can happen when putting sections at particular addresses when using a format which can not represent section addresses, such as a.out. | |
| -C | –demangle[=style] | Decode (demangle) low-level symbol names into user-level names. Besides removing any initial underscore perpended by the system, this makes C++ function names readable. Different compilers have different mangling styles. The optional demangling style argument can be used to choose an appropriate demangling style for your compiler. |
| -e | –debugging-tags | Like -g, but the information is generated in a format compatible with ctags tool. |
| -D | –disassemble-all | Like -d, but disassemble the contents of all sections, not just those expected to contain instructions. If the target is an ARM architecture this switch also has the effect of forcing the disassembler to decode pieces of data found in code sections as if they were instructions. |
| -EB, -EL | –endian={big|little} | Specify the endianness of the object files. This only affects disassembly. This can be useful when disassembling a file format which does not describe endianness information, such as S-records. |
| -F | –file-offsets | When disassembling sections, whenever a symbol is displayed, also display the file offset of the region of data that is about to be dumped. If zeros are being skipped, then when disassembly resumes, tell the user how many zeros were skipped and the file offset of the location from where the disassembly resumes. When dumping sections, display the file offset of the location from where the dump starts. |
| -j name | –section=name | Display information only for section name. |
nm
readelf