Objdump

  1. Objdump 2 Articles. Even More Firmware In Your Firmware. October 1, 2020 by Kerry Scharfglass 13 Comments. There are many ways to update an embedded system in the field. Images can fly through.
  2. The objdump utility displays information about one or more object files. The options control what particular information to display. The objfile arguments identify the object files to be examined. When you specify archives, objdump shows information on each of the member object files.
  1. How To Use Objdump
  2. Objdump

When objcopy generates a raw binary file, it will essentially produce a memory dump of the contents of the input object file. All symbols and relocation information will be discarded. The memory dump will start at the load address of the lowest section copied into the output file. The -j.text option.

What is objdump?
5 objdump examples
Syntax and Options
Related Commands

What is objdump?

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.

5 objdump Examples

1. Display file header using -f option

How To Use Objdump

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.

2. Display information related to all the sections using -s option

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.

3. Display a particular section using -j option

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.

Objdump

4. Accept the options from file by using @ option

Rather than supplying options through command line, a file can be used to supply options to the objdump command.

Consider the following example :

Objdump

So we see that objdump command successfully accepted the options from a file and produced a relevant output.

Objdump

5. Display all the header information using -x option

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.

Syntax and Options

Short OptionLong OptionOption Description
-a–archive-headerIf 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=offsetWhen 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-tagsLike -g, but the information is generated in a format compatible with ctags tool.
-D–disassemble-allLike -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-offsetsWhen 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=nameDisplay information only for section name.

Related Commands

nm
readelf