10+ objdump Command Examples in Linux

This tutorial explains Linux “objdump” command, options and its usage with examples.

objdump – display information from object files.

Description :

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.

At least one of the options -a, -d, -D, -f, -g, -G, -h, -H, -p, -r, -S, -t, -T, -V, or -x must be given to tell objdump what information to show.

Usage :

objdump [options] objfiles

advertisement
advertisement

Options :

-a, –archive-header
If any input files are archives, display the archive header information. The output includes the object file format of each archive member.

–adjust-vma=offset
Add offset to all section headers before dumping information. Useful if the section addresses do not correspond to the symbol table.

-b bfdname, –target=bfdname
Set the binary file format using its binary file descriptor name, bfdname. Use the -h option for a list of supported formats for your system.

-C [style], –demangle[=style] Decode (demangle) low-level symbol names into user-level names, optionally specifying a mangling style. Removes any initial underscores and makes C++ function names readable.

-d, –disassemble
Display assembler mnemonic names for the machine instructions. Disassemble only sections that are expected to contain instructions.

-D, –disassemble-all
Disassemble all sections, not just those expected to contain instructions.

-EB, –endian=big
-EL, –endian=little

Specify whether the object files are big- or little-endian, for disassembling. Useful for disassembling formats such as S-records (printable ASCII versions of object files) that do not include that information.

-f, –file-header
Display overall header summary information.

advertisement

–file-start-context
When using -S and displaying source code from a file that hasn’t been displayed yet, include context from the start of the file.

-g, –debugging
Display debugging information.

-G, –stabs
Display any stabs (debugging symbol table entries) information, in addition to the contents of any sections requested.

-h, –section-header, –header
Display section-header summary information.

-H, –help
Display help information and exit.

advertisement

-i, –info
Display the architectures and object formats available on your system for use with -b or -m.

-j name, –section=name
Display information for section name.

-l, –line-numbers
Label the display with filename and source code line numbers corresponding to the object code or relocation entries shown. Use with -d, -D, or -r.

-m arch, –architecture=arch
Specify the architecture for disassembling object files. Useful when disassembling files such as S-records that do not include this information.

-M options, –disassembler-options=options
Pass target-specific information to the disassembler. Supported only on some targets.

–no-show-raw-insn
Do not show instructions in hexadecimal when disassembling. This is the default with –prefix-addresses.

-p, –private-headers
Display information specific to the object format. For some formats, no additional information is displayed.

–prefix-addresses
When disassembling, print the complete address on each line.

-r, –reloc
Display relocation entries. With -b or -D, the entries are intermixed with the disassembly.

-R, –dynamic-reloc
Print dynamic relocation entries. Meaningful only for dynamic objects such as certain types of shared libraries.

-s, –full-contents
Display the full contents of any requested sections.

-S, –source
Display source code intermixed with disassembly, if possible. Implies -d.

–show-raw-insn
When disassembling, show instructions in hexadecimal as well as symbolic form. This is the default, except with –prefix-addresses.

–start-address=addr
Start displaying data at the specified address. Applies to -d, -r, and -s.

–stop-address=addr
Stop displaying data at the specified address. Applies to -d, -r, and -s.

-t, –syms
Print symbol table entries.

-T, –dynamic-syms
Print dynamic symbol table entries. Meaningful only for dynamic objects such as certain types of shared libraries.

-V, –version
Print version information and exit.

-w, –wide
Format lines for output devices wider than 80 characters, and do not truncate symbol table names.

-x, –all-headers
Display all available header information. Equivalent to specifying -a -f -h -r -t.

-z, –disassemble-zeroes
Disassemble blocks of zeroes. The default is to skip such blocks.

Examples :

The code used for object files in all the examples is :

$ cat factorial.c
#include<stdio.h>
 
int main(void)
{
    int n = 6;
    float f=1;
    int i = 1;
    for(;i<=n;i++)
        f=f*i;
    printf("\n Factorial is : [%f]\n",f);
    return 0;
}
$ gcc factorial.c

1. Display the contents of the overall file header using -f option

$ gcc factorial.c
mohakkataria@ubuntu:/tmp$ objdump -f a.out
 
a.out:     file format elf64-x86-64
architecture: i386:x86-64, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED

2. Display object format specific file header contents using -p option

$ objdump -p a.out
 
a.out:     file format elf64-x86-64
 
Program Header:
    PHDR off    0x0000000000000040 vaddr 0x0000000000400040 paddr 0x0000000000400040 align 2**3
         filesz 0x00000000000001f8 memsz 0x00000000000001f8 flags r-x
  INTERP off    0x0000000000000238 vaddr 0x0000000000400238 paddr 0x0000000000400238 align 2**0
         filesz 0x000000000000001c memsz 0x000000000000001c flags r--
    LOAD off    0x0000000000000000 vaddr 0x0000000000400000 paddr 0x0000000000400000 align 2**21
         filesz 0x000000000000075c memsz 0x000000000000075c flags r-x
    LOAD off    0x0000000000000e10 vaddr 0x0000000000600e10 paddr 0x0000000000600e10 align 2**21
         filesz 0x0000000000000230 memsz 0x0000000000000238 flags rw-
 DYNAMIC off    0x0000000000000e28 vaddr 0x0000000000600e28 paddr 0x0000000000600e28 align 2**3
         filesz 0x00000000000001d0 memsz 0x00000000000001d0 flags rw-
    NOTE off    0x0000000000000254 vaddr 0x0000000000400254 paddr 0x0000000000400254 align 2**2
         filesz 0x0000000000000044 memsz 0x0000000000000044 flags r--
EH_FRAME off    0x0000000000000650 vaddr 0x0000000000400650 paddr 0x0000000000400650 align 2**2
         filesz 0x0000000000000034 memsz 0x0000000000000034 flags r--
   STACK off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**3
         filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw-
   RELRO off    0x0000000000000e10 vaddr 0x0000000000600e10 paddr 0x0000000000600e10 align 2**0
         filesz 0x00000000000001f0 memsz 0x00000000000001f0 flags r--
 
Dynamic Section:
  NEEDED               libc.so.6
  INIT                 0x00000000004003e0
  FINI                 0x0000000000400624
  INIT_ARRAY           0x0000000000600e10
  INIT_ARRAYSZ         0x0000000000000008
  FINI_ARRAY           0x0000000000600e18
  FINI_ARRAYSZ         0x0000000000000008
  GNU_HASH             0x0000000000400298
  STRTAB               0x0000000000400318
  SYMTAB               0x00000000004002b8
  STRSZ                0x000000000000003f
  SYMENT               0x0000000000000018
  DEBUG                0x0000000000000000
  PLTGOT               0x0000000000601000
  PLTRELSZ             0x0000000000000048
  PLTREL               0x0000000000000007
  JMPREL               0x0000000000400398
  RELA                 0x0000000000400380
  RELASZ               0x0000000000000018
  RELAENT              0x0000000000000018
  VERNEED              0x0000000000400360
  VERNEEDNUM           0x0000000000000001
  VERSYM               0x0000000000400358
 
Version References:
  required from libc.so.6:
    0x09691a75 0x00 02 GLIBC_2.2.5

3. Display the contents of the section headers using -h option

There can be various sections in an object file. Information related to them can be printed using -h option.

$ objdump -h a.out
 
a.out:     file format elf64-x86-64
 
Sections:
Idx Name          Size      VMA               LMA               File off  Algn
  0 .interp       0000001c  0000000000400238  0000000000400238  00000238  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .note.ABI-tag 00000020  0000000000400254  0000000000400254  00000254  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .note.gnu.build-id 00000024  0000000000400274  0000000000400274  00000274  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .gnu.hash     0000001c  0000000000400298  0000000000400298  00000298  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .dynsym       00000060  00000000004002b8  00000000004002b8  000002b8  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .dynstr       0000003f  0000000000400318  0000000000400318  00000318  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 .gnu.version  00000008  0000000000400358  0000000000400358  00000358  2**1
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  7 .gnu.version_r 00000020  0000000000400360  0000000000400360  00000360  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  8 .rela.dyn     00000018  0000000000400380  0000000000400380  00000380  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 .rela.plt     00000048  0000000000400398  0000000000400398  00000398  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 10 .init         0000001a  00000000004003e0  00000000004003e0  000003e0  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 11 .plt          00000040  0000000000400400  0000000000400400  00000400  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 12 .text         000001e4  0000000000400440  0000000000400440  00000440  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 13 .fini         00000009  0000000000400624  0000000000400624  00000624  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 14 .rodata       00000020  0000000000400630  0000000000400630  00000630  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 15 .eh_frame_hdr 00000034  0000000000400650  0000000000400650  00000650  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 16 .eh_frame     000000d4  0000000000400688  0000000000400688  00000688  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 17 .init_array   00000008  0000000000600e10  0000000000600e10  00000e10  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 18 .fini_array   00000008  0000000000600e18  0000000000600e18  00000e18  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 19 .jcr          00000008  0000000000600e20  0000000000600e20  00000e20  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 20 .dynamic      000001d0  0000000000600e28  0000000000600e28  00000e28  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 21 .got          00000008  0000000000600ff8  0000000000600ff8  00000ff8  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 22 .got.plt      00000030  0000000000601000  0000000000601000  00001000  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 23 .data         00000010  0000000000601030  0000000000601030  00001030  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 24 .bss          00000008  0000000000601040  0000000000601040  00001040  2**2
                  ALLOC
 25 .comment      0000002a  0000000000000000  0000000000000000  00001040  2**0
                  CONTENTS, READONLY

4. Display the contents of all headers using -x option

Information related to all the headers in the object file can be retrieved using the -x option.

$ objdump -x a.out
 
a.out:     file format elf64-x86-64
a.out
architecture: i386:x86-64, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x0000000000400440
 
Program Header:
    PHDR off    0x0000000000000040 vaddr 0x0000000000400040 paddr 0x0000000000400040 align 2**3
         filesz 0x00000000000001f8 memsz 0x00000000000001f8 flags r-x
  INTERP off    0x0000000000000238 vaddr 0x0000000000400238 paddr 0x0000000000400238 align 2**0
         filesz 0x000000000000001c memsz 0x000000000000001c flags r--
    LOAD off    0x0000000000000000 vaddr 0x0000000000400000 paddr 0x0000000000400000 align 2**21
         filesz 0x000000000000075c memsz 0x000000000000075c flags r-x
    LOAD off    0x0000000000000e10 vaddr 0x0000000000600e10 paddr 0x0000000000600e10 align 2**21
         filesz 0x0000000000000230 memsz 0x0000000000000238 flags rw-
 DYNAMIC off    0x0000000000000e28 vaddr 0x0000000000600e28 paddr 0x0000000000600e28 align 2**3
         filesz 0x00000000000001d0 memsz 0x00000000000001d0 flags rw-
    NOTE off    0x0000000000000254 vaddr 0x0000000000400254 paddr 0x0000000000400254 align 2**2
         filesz 0x0000000000000044 memsz 0x0000000000000044 flags r--
EH_FRAME off    0x0000000000000650 vaddr 0x0000000000400650 paddr 0x0000000000400650 align 2**2
         filesz 0x0000000000000034 memsz 0x0000000000000034 flags r--
   STACK off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**3
         filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw-
   RELRO off    0x0000000000000e10 vaddr 0x0000000000600e10 paddr 0x0000000000600e10 align 2**0
         filesz 0x00000000000001f0 memsz 0x00000000000001f0 flags r--
 
Dynamic Section:
  NEEDED               libc.so.6
  INIT                 0x00000000004003e0
  FINI                 0x0000000000400624
  INIT_ARRAY           0x0000000000600e10
  INIT_ARRAYSZ         0x0000000000000008
  FINI_ARRAY           0x0000000000600e18
  FINI_ARRAYSZ         0x0000000000000008
  GNU_HASH             0x0000000000400298
  STRTAB               0x0000000000400318
  SYMTAB               0x00000000004002b8
  STRSZ                0x000000000000003f
  SYMENT               0x0000000000000018
  DEBUG                0x0000000000000000
  PLTGOT               0x0000000000601000
  PLTRELSZ             0x0000000000000048
  PLTREL               0x0000000000000007
  JMPREL               0x0000000000400398
  RELA                 0x0000000000400380
  RELASZ               0x0000000000000018
  RELAENT              0x0000000000000018
  VERNEED              0x0000000000400360
  VERNEEDNUM           0x0000000000000001
  VERSYM               0x0000000000400358
 
Version References:
  required from libc.so.6:
    0x09691a75 0x00 02 GLIBC_2.2.5
 
Sections:
Idx Name          Size      VMA               LMA               File off  Algn
  0 .interp       0000001c  0000000000400238  0000000000400238  00000238  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .note.ABI-tag 00000020  0000000000400254  0000000000400254  00000254  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .note.gnu.build-id 00000024  0000000000400274  0000000000400274  00000274  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .gnu.hash     0000001c  0000000000400298  0000000000400298  00000298  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .dynsym       00000060  00000000004002b8  00000000004002b8  000002b8  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .dynstr       0000003f  0000000000400318  0000000000400318  00000318  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 .gnu.version  00000008  0000000000400358  0000000000400358  00000358  2**1
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  7 .gnu.version_r 00000020  0000000000400360  0000000000400360  00000360  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  8 .rela.dyn     00000018  0000000000400380  0000000000400380  00000380  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 .rela.plt     00000048  0000000000400398  0000000000400398  00000398  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 10 .init         0000001a  00000000004003e0  00000000004003e0  000003e0  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 11 .plt          00000040  0000000000400400  0000000000400400  00000400  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 12 .text         000001e4  0000000000400440  0000000000400440  00000440  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 13 .fini         00000009  0000000000400624  0000000000400624  00000624  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 14 .rodata       00000020  0000000000400630  0000000000400630  00000630  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 15 .eh_frame_hdr 00000034  0000000000400650  0000000000400650  00000650  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 16 .eh_frame     000000d4  0000000000400688  0000000000400688  00000688  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 17 .init_array   00000008  0000000000600e10  0000000000600e10  00000e10  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 18 .fini_array   00000008  0000000000600e18  0000000000600e18  00000e18  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 19 .jcr          00000008  0000000000600e20  0000000000600e20  00000e20  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 20 .dynamic      000001d0  0000000000600e28  0000000000600e28  00000e28  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 21 .got          00000008  0000000000600ff8  0000000000600ff8  00000ff8  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 22 .got.plt      00000030  0000000000601000  0000000000601000  00001000  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 23 .data         00000010  0000000000601030  0000000000601030  00001030  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 24 .bss          00000008  0000000000601040  0000000000601040  00001040  2**2
                  ALLOC
 25 .comment      0000002a  0000000000000000  0000000000000000  00001040  2**0
                  CONTENTS, READONLY
SYMBOL TABLE:
0000000000400238 l    d  .interp	0000000000000000              .interp
0000000000400254 l    d  .note.ABI-tag	0000000000000000              .note.ABI-tag
0000000000400274 l    d  .note.gnu.build-id	0000000000000000              .note.gnu.build-id
0000000000400298 l    d  .gnu.hash	0000000000000000              .gnu.hash
00000000004002b8 l    d  .dynsym	0000000000000000              .dynsym
0000000000400318 l    d  .dynstr	0000000000000000              .dynstr
0000000000400358 l    d  .gnu.version	0000000000000000              .gnu.version
0000000000400360 l    d  .gnu.version_r	0000000000000000              .gnu.version_r
0000000000400380 l    d  .rela.dyn	0000000000000000              .rela.dyn
0000000000400398 l    d  .rela.plt	0000000000000000              .rela.plt
00000000004003e0 l    d  .init	0000000000000000              .init
0000000000400400 l    d  .plt	0000000000000000              .plt
0000000000400440 l    d  .text	0000000000000000              .text
0000000000400624 l    d  .fini	0000000000000000              .fini
0000000000400630 l    d  .rodata	0000000000000000              .rodata
0000000000400650 l    d  .eh_frame_hdr	0000000000000000              .eh_frame_hdr
0000000000400688 l    d  .eh_frame	0000000000000000              .eh_frame
0000000000600e10 l    d  .init_array	0000000000000000              .init_array
0000000000600e18 l    d  .fini_array	0000000000000000              .fini_array
0000000000600e20 l    d  .jcr	0000000000000000              .jcr
0000000000600e28 l    d  .dynamic	0000000000000000              .dynamic
0000000000600ff8 l    d  .got	0000000000000000              .got
0000000000601000 l    d  .got.plt	0000000000000000              .got.plt
0000000000601030 l    d  .data	0000000000000000              .data
0000000000601040 l    d  .bss	0000000000000000              .bss
0000000000000000 l    d  .comment	0000000000000000              .comment
0000000000000000 l    df *ABS*	0000000000000000              crtstuff.c
0000000000600e20 l     O .jcr	0000000000000000              __JCR_LIST__
0000000000400470 l     F .text	0000000000000000              deregister_tm_clones
00000000004004a0 l     F .text	0000000000000000              register_tm_clones
00000000004004e0 l     F .text	0000000000000000              __do_global_dtors_aux
0000000000601040 l     O .bss	0000000000000001              completed.6718
0000000000600e18 l     O .fini_array	0000000000000000              __do_global_dtors_aux_fini_array_entry
0000000000400500 l     F .text	0000000000000000              frame_dummy
0000000000600e10 l     O .init_array	0000000000000000              __frame_dummy_init_array_entry
0000000000000000 l    df *ABS*	0000000000000000              factorial.c
0000000000000000 l    df *ABS*	0000000000000000              crtstuff.c
0000000000400758 l     O .eh_frame	0000000000000000              __FRAME_END__
0000000000600e20 l     O .jcr	0000000000000000              __JCR_END__
0000000000000000 l    df *ABS*	0000000000000000              
0000000000600e18 l       .init_array	0000000000000000              __init_array_end
0000000000600e28 l     O .dynamic	0000000000000000              _DYNAMIC
0000000000600e10 l       .init_array	0000000000000000              __init_array_start
0000000000601000 l     O .got.plt	0000000000000000              _GLOBAL_OFFSET_TABLE_
0000000000400620 g     F .text	0000000000000002              __libc_csu_fini
0000000000000000  w      *UND*	0000000000000000              _ITM_deregisterTMCloneTable
0000000000601030  w      .data	0000000000000000              data_start
0000000000601040 g       .data	0000000000000000              _edata
0000000000400624 g     F .fini	0000000000000000              _fini
0000000000000000       F *UND*	0000000000000000              printf@@GLIBC_2.2.5
0000000000000000       F *UND*	0000000000000000              __libc_start_main@@GLIBC_2.2.5
0000000000601030 g       .data	0000000000000000              __data_start
0000000000000000  w      *UND*	0000000000000000              __gmon_start__
0000000000601038 g     O .data	0000000000000000              .hidden __dso_handle
0000000000400630 g     O .rodata	0000000000000004              _IO_stdin_used
0000000000400590 g     F .text	0000000000000089              __libc_csu_init
0000000000601048 g       .bss	0000000000000000              _end
0000000000400440 g     F .text	0000000000000000              _start
0000000000601040 g       .bss	0000000000000000              __bss_start
000000000040052c g     F .text	000000000000005e              main
0000000000000000  w      *UND*	0000000000000000              _Jv_RegisterClasses
0000000000601040 g     O .data	0000000000000000              .hidden __TMC_END__
0000000000000000  w      *UND*	0000000000000000              _ITM_registerTMCloneTable
00000000004003e0 g     F .init	0000000000000000              _init

5. Display assembler contents of executable sections using -d option

$ objdump -d a.out
 
a.out:     file format elf64-x86-64
 
 
Disassembly of section .init:
 
00000000004003e0 <_init>:
  4003e0:	48 83 ec 08          	sub    $0x8,%rsp
  4003e4:	48 8b 05 0d 0c 20 00 	mov    0x200c0d(%rip),%rax        # 600ff8 <_DYNAMIC+0x1d0>
  4003eb:	48 85 c0             	test   %rax,%rax
  4003ee:	74 05                	je     4003f5 <_init+0x15>
  4003f0:	e8 3b 00 00 00       	callq  400430 <__gmon_start__@plt>
  4003f5:	48 83 c4 08          	add    $0x8,%rsp
  4003f9:	c3                   	retq   
 
Disassembly of section .plt:
 
0000000000400400 <printf@plt-0x10>:
  400400:	ff 35 02 0c 20 00    	pushq  0x200c02(%rip)        # 601008 <_GLOBAL_OFFSET_TABLE_+0x8>
  400406:	ff 25 04 0c 20 00    	jmpq   *0x200c04(%rip)        # 601010 <_GLOBAL_OFFSET_TABLE_+0x10>
  40040c:	0f 1f 40 00          	nopl   0x0(%rax)
 
0000000000400410 <printf@plt>:
  400410:	ff 25 02 0c 20 00    	jmpq   *0x200c02(%rip)        # 601018 <_GLOBAL_OFFSET_TABLE_+0x18>
  400416:	68 00 00 00 00       	pushq  $0x0
  40041b:	e9 e0 ff ff ff       	jmpq   400400 <_init+0x20>
 
0000000000400420 <__libc_start_main@plt>:
  400420:	ff 25 fa 0b 20 00    	jmpq   *0x200bfa(%rip)        # 601020 <_GLOBAL_OFFSET_TABLE_+0x20>
  400426:	68 01 00 00 00       	pushq  $0x1
  40042b:	e9 d0 ff ff ff       	jmpq   400400 <_init+0x20>
 
0000000000400430 <__gmon_start__@plt>:
  400430:	ff 25 f2 0b 20 00    	jmpq   *0x200bf2(%rip)        # 601028 <_GLOBAL_OFFSET_TABLE_+0x28>
  400436:	68 02 00 00 00       	pushq  $0x2
  40043b:	e9 c0 ff ff ff       	jmpq   400400 <_init+0x20>
 
Disassembly of section .text:
 
0000000000400440 <_start>:
  400440:	31 ed                	xor    %ebp,%ebp
  400442:	49 89 d1             	mov    %rdx,%r9
  400445:	5e                   	pop    %rsi
  400446:	48 89 e2             	mov    %rsp,%rdx
  400449:	48 83 e4 f0          	and    $0xfffffffffffffff0,%rsp
  40044d:	50                   	push   %rax
  40044e:	54                   	push   %rsp
  40044f:	49 c7 c0 20 06 40 00 	mov    $0x400620,%r8
  400456:	48 c7 c1 90 05 40 00 	mov    $0x400590,%rcx
  40045d:	48 c7 c7 2c 05 40 00 	mov    $0x40052c,%rdi
  400464:	e8 b7 ff ff ff       	callq  400420 <__libc_start_main@plt>
  400469:	f4                   	hlt    
  40046a:	66 90                	xchg   %ax,%ax
  40046c:	0f 1f 40 00          	nopl   0x0(%rax)
 
0000000000400470 <deregister_tm_clones>:
  400470:	b8 47 10 60 00       	mov    $0x601047,%eax
  400475:	55                   	push   %rbp
  400476:	48 2d 40 10 60 00    	sub    $0x601040,%rax
  40047c:	48 83 f8 0e          	cmp    $0xe,%rax
  400480:	48 89 e5             	mov    %rsp,%rbp
  400483:	77 02                	ja     400487 <deregister_tm_clones+0x17>
  400485:	5d                   	pop    %rbp
  400486:	c3                   	retq   
  400487:	b8 00 00 00 00       	mov    $0x0,%eax
  40048c:	48 85 c0             	test   %rax,%rax
  40048f:	74 f4                	je     400485 <deregister_tm_clones+0x15>
  400491:	5d                   	pop    %rbp
  400492:	bf 40 10 60 00       	mov    $0x601040,%edi
  400497:	ff e0                	jmpq   *%rax
  400499:	0f 1f 80 00 00 00 00 	nopl   0x0(%rax)
 
00000000004004a0 <register_tm_clones>:
  4004a0:	b8 40 10 60 00       	mov    $0x601040,%eax
  4004a5:	55                   	push   %rbp
  4004a6:	48 2d 40 10 60 00    	sub    $0x601040,%rax
  4004ac:	48 c1 f8 03          	sar    $0x3,%rax
  4004b0:	48 89 e5             	mov    %rsp,%rbp
  4004b3:	48 89 c2             	mov    %rax,%rdx
  4004b6:	48 c1 ea 3f          	shr    $0x3f,%rdx
  4004ba:	48 01 d0             	add    %rdx,%rax
  4004bd:	48 89 c6             	mov    %rax,%rsi
  4004c0:	48 d1 fe             	sar    %rsi
  4004c3:	75 02                	jne    4004c7 <register_tm_clones+0x27>
  4004c5:	5d                   	pop    %rbp
  4004c6:	c3                   	retq   
  4004c7:	ba 00 00 00 00       	mov    $0x0,%edx
  4004cc:	48 85 d2             	test   %rdx,%rdx
  4004cf:	74 f4                	je     4004c5 <register_tm_clones+0x25>
  4004d1:	5d                   	pop    %rbp
  4004d2:	bf 40 10 60 00       	mov    $0x601040,%edi
  4004d7:	ff e2                	jmpq   *%rdx
  4004d9:	0f 1f 80 00 00 00 00 	nopl   0x0(%rax)
 
00000000004004e0 <__do_global_dtors_aux>:
  4004e0:	80 3d 59 0b 20 00 00 	cmpb   $0x0,0x200b59(%rip)        # 601040 <__TMC_END__>
  4004e7:	75 11                	jne    4004fa <__do_global_dtors_aux+0x1a>
  4004e9:	55                   	push   %rbp
  4004ea:	48 89 e5             	mov    %rsp,%rbp
  4004ed:	e8 7e ff ff ff       	callq  400470 <deregister_tm_clones>
  4004f2:	5d                   	pop    %rbp
  4004f3:	c6 05 46 0b 20 00 01 	movb   $0x1,0x200b46(%rip)        # 601040 <__TMC_END__>
  4004fa:	f3 c3                	repz retq 
  4004fc:	0f 1f 40 00          	nopl   0x0(%rax)
 
0000000000400500 <frame_dummy>:
  400500:	48 83 3d 18 09 20 00 	cmpq   $0x0,0x200918(%rip)        # 600e20 <__JCR_END__>
  400507:	00 
  400508:	74 1b                	je     400525 <frame_dummy+0x25>
  40050a:	b8 00 00 00 00       	mov    $0x0,%eax
  40050f:	48 85 c0             	test   %rax,%rax
  400512:	74 11                	je     400525 <frame_dummy+0x25>
  400514:	55                   	push   %rbp
  400515:	bf 20 0e 60 00       	mov    $0x600e20,%edi
  40051a:	48 89 e5             	mov    %rsp,%rbp
  40051d:	ff d0                	callq  *%rax
  40051f:	5d                   	pop    %rbp
  400520:	e9 7b ff ff ff       	jmpq   4004a0 <register_tm_clones>
  400525:	e9 76 ff ff ff       	jmpq   4004a0 <register_tm_clones>
  40052a:	66 90                	xchg   %ax,%ax
 
000000000040052c <main>:
  40052c:	55                   	push   %rbp
  40052d:	48 89 e5             	mov    %rsp,%rbp
  400530:	48 83 ec 10          	sub    $0x10,%rsp
  400534:	c7 45 fc 06 00 00 00 	movl   $0x6,-0x4(%rbp)
  40053b:	8b 05 0b 01 00 00    	mov    0x10b(%rip),%eax        # 40064c <_IO_stdin_used+0x1c>
  400541:	89 45 f4             	mov    %eax,-0xc(%rbp)
  400544:	c7 45 f8 01 00 00 00 	movl   $0x1,-0x8(%rbp)
  40054b:	eb 17                	jmp    400564 <main+0x38>
  40054d:	f3 0f 2a 45 f8       	cvtsi2ssl -0x8(%rbp),%xmm0
  400552:	f3 0f 10 4d f4       	movss  -0xc(%rbp),%xmm1
  400557:	f3 0f 59 c1          	mulss  %xmm1,%xmm0
  40055b:	f3 0f 11 45 f4       	movss  %xmm0,-0xc(%rbp)
  400560:	83 45 f8 01          	addl   $0x1,-0x8(%rbp)
  400564:	8b 45 f8             	mov    -0x8(%rbp),%eax
  400567:	3b 45 fc             	cmp    -0x4(%rbp),%eax
  40056a:	7e e1                	jle    40054d <main+0x21>
  40056c:	f3 0f 10 45 f4       	movss  -0xc(%rbp),%xmm0
  400571:	0f 5a c0             	cvtps2pd %xmm0,%xmm0
  400574:	bf 34 06 40 00       	mov    $0x400634,%edi
  400579:	b8 01 00 00 00       	mov    $0x1,%eax
  40057e:	e8 8d fe ff ff       	callq  400410 <printf@plt>
  400583:	b8 00 00 00 00       	mov    $0x0,%eax
  400588:	c9                   	leaveq 
  400589:	c3                   	retq   
  40058a:	66 0f 1f 44 00 00    	nopw   0x0(%rax,%rax,1)
 
0000000000400590 <__libc_csu_init>:
  400590:	48 89 6c 24 d8       	mov    %rbp,-0x28(%rsp)
  400595:	4c 89 64 24 e0       	mov    %r12,-0x20(%rsp)
  40059a:	48 8d 2d 77 08 20 00 	lea    0x200877(%rip),%rbp        # 600e18 <__init_array_end>
  4005a1:	4c 8d 25 68 08 20 00 	lea    0x200868(%rip),%r12        # 600e10 <__frame_dummy_init_array_entry>
  4005a8:	48 89 5c 24 d0       	mov    %rbx,-0x30(%rsp)
  4005ad:	4c 89 6c 24 e8       	mov    %r13,-0x18(%rsp)
  4005b2:	4c 89 74 24 f0       	mov    %r14,-0x10(%rsp)
  4005b7:	4c 89 7c 24 f8       	mov    %r15,-0x8(%rsp)
  4005bc:	48 83 ec 38          	sub    $0x38,%rsp
  4005c0:	4c 29 e5             	sub    %r12,%rbp
  4005c3:	41 89 ff             	mov    %edi,%r15d
  4005c6:	49 89 f6             	mov    %rsi,%r14
  4005c9:	48 c1 fd 03          	sar    $0x3,%rbp
  4005cd:	49 89 d5             	mov    %rdx,%r13
  4005d0:	31 db                	xor    %ebx,%ebx
  4005d2:	e8 09 fe ff ff       	callq  4003e0 <_init>
  4005d7:	48 85 ed             	test   %rbp,%rbp
  4005da:	74 1a                	je     4005f6 <__libc_csu_init+0x66>
  4005dc:	0f 1f 40 00          	nopl   0x0(%rax)
  4005e0:	4c 89 ea             	mov    %r13,%rdx
  4005e3:	4c 89 f6             	mov    %r14,%rsi
  4005e6:	44 89 ff             	mov    %r15d,%edi
  4005e9:	41 ff 14 dc          	callq  *(%r12,%rbx,8)
  4005ed:	48 83 c3 01          	add    $0x1,%rbx
  4005f1:	48 39 eb             	cmp    %rbp,%rbx
  4005f4:	75 ea                	jne    4005e0 <__libc_csu_init+0x50>
  4005f6:	48 8b 5c 24 08       	mov    0x8(%rsp),%rbx
  4005fb:	48 8b 6c 24 10       	mov    0x10(%rsp),%rbp
  400600:	4c 8b 64 24 18       	mov    0x18(%rsp),%r12
  400605:	4c 8b 6c 24 20       	mov    0x20(%rsp),%r13
  40060a:	4c 8b 74 24 28       	mov    0x28(%rsp),%r14
  40060f:	4c 8b 7c 24 30       	mov    0x30(%rsp),%r15
  400614:	48 83 c4 38          	add    $0x38,%rsp
  400618:	c3                   	retq   
  400619:	0f 1f 80 00 00 00 00 	nopl   0x0(%rax)
 
0000000000400620 <__libc_csu_fini>:
  400620:	f3 c3                	repz retq 
  400622:	66 90                	xchg   %ax,%ax
 
Disassembly of section .fini:
 
0000000000400624 <_fini>:
  400624:	48 83 ec 08          	sub    $0x8,%rsp
  400628:	48 83 c4 08          	add    $0x8,%rsp
  40062c:	c3                   	retq

6. Display assembler contents of all sections using -D option

In case the assembler contents of all the sections is required in output, the option -D can be used.

a.out:     file format elf64-x86-64
 
 
Disassembly of section .interp:
 
0000000000400238 <.interp>:
  400238:       2f                      (bad)  
  400239:       6c                      insb   (%dx),%es:(%rdi)
  40023a:       69 62 36 34 2f 6c 64    imul   $0x646c2f34,0x36(%rdx),%esp
  400241:       2d 6c 69 6e 75          sub    $0x756e696c,%eax
  400246:       78 2d                   js     400275 <_init-0x16b>
  400248:       78 38                   js     400282 <_init-0x15e>
  40024a:       36                      ss
  40024b:       2d 36 34 2e 73          sub    $0x732e3436,%eax
  400250:       6f                      outsl  %ds:(%rsi),(%dx)
  400251:       2e 32 00                xor    %cs:(%rax),%al
 
Disassembly of section .note.ABI-tag:
 
0000000000400254 <.note.ABI-tag>:
  400254:       04 00                   add    $0x0,%al
  400256:       00 00                   add    %al,(%rax)
400258:       10 00                   adc    %al,(%rax)
  40025a:       00 00                   add    %al,(%rax)
  40025c:       01 00                   add    %eax,(%rax)
  40025e:       00 00                   add    %al,(%rax)
  400260:       47                      rex.RXB
  400261:       4e 55                   rex.WRX push %rbp
  400263:       00 00                   add    %al,(%rax)
  400265:       00 00                   add    %al,(%rax)
  400267:       00 02                   add    %al,(%rdx)
  400269:       00 00                   add    %al,(%rax)
  40026b:       00 06                   add    %al,(%rsi)
  40026d:       00 00                   add    %al,(%rax)
  40026f:       00 18                   add    %bl,(%rax)
  400271:       00 00                   add    %al,(%rax)
        ...
 
Disassembly of section .note.gnu.build-id:
 
0000000000400274 <.note.gnu.build-id>:
  400274:       04 00                   add    $0x0,%al
  400276:       00 00                   add    %al,(%rax)
  400278:       14 00                   adc    $0x0,%al
  40027a:       00 00                   add    %al,(%rax)
40027c:       03 00                   add    (%rax),%eax
  40027e:       00 00                   add    %al,(%rax)
  400280:       47                      rex.RXB
  400281:       4e 55                   rex.WRX push %rbp
  400283:       00 cc                   add    %cl,%ah
  400285:       55                      push   %rbp
  400286:       ad                      lods   %ds:(%rsi),%eax
  400287:       32 30                   xor    (%rax),%dh
  400289:       ea                      (bad)  
  40028a:       a5                      movsl  %ds:(%rsi),%es:(%rdi)
  40028b:       b6 89                   mov    $0x89,%dh
  40028d:       f4                      hlt    
  40028e:       43 2c c0                rex.XB sub $0xc0,%al
  400291:       74 27                   je     4002ba <_init-0x126>
  400293:       4d a8 ec                rex.WRB test $0xec,%al
  400296:       6f                      outsl  %ds:(%rsi),(%dx)
  400297:       34                      .byte 0x34
 
Disassembly of section .gnu.hash:
 
0000000000400298 <.gnu.hash>:
  400298:       01 00                   add    %eax,(%rax)
  40029a:       00 00                   add    %al,(%rax)
.....

7. Display the full contents of all sections using -s option

$ objdump -s a.out
 
a.out:     file format elf64-x86-64
 
Contents of section .interp:
 400238 2f6c6962 36342f6c 642d6c69 6e75782d  /lib64/ld-linux-
 400248 7838362d 36342e73 6f2e3200           x86-64.so.2.    
Contents of section .note.ABI-tag:
 400254 04000000 10000000 01000000 474e5500  ............GNU.
 400264 00000000 02000000 06000000 18000000  ................
Contents of section .note.gnu.build-id:
 400274 04000000 14000000 03000000 474e5500  ............GNU.
 400284 cc55ad32 30eaa5b6 89f4432c c074274d  .U.20.....C,.t'M
 400294 a8ec6f34                             ..o4            
Contents of section .gnu.hash:
 400298 01000000 01000000 01000000 00000000  ................
 4002a8 00000000 00000000 00000000           ............    
Contents of section .dynsym:
 4002b8 00000000 00000000 00000000 00000000  ................
 4002c8 00000000 00000000 0b000000 12000000  ................
 4002d8 00000000 00000000 00000000 00000000  ................
 4002e8 12000000 12000000 00000000 00000000  ................
 4002f8 00000000 00000000 24000000 20000000  ........$... ...
 400308 00000000 00000000 00000000 00000000  ................
Contents of section .dynstr:
 400318 006c6962 632e736f 2e360070 72696e74  .libc.so.6.print
 400328 66005f5f 6c696263 5f737461 72745f6d  f.__libc_start_m
 400338 61696e00 5f5f676d 6f6e5f73 74617274  ain.__gmon_start
 400348 5f5f0047 4c494243 5f322e32 2e3500    __.GLIBC_2.2.5. 
Contents of section .gnu.version:
 400358 00000200 02000000                    ........        
Contents of section .gnu.version_r:
 400360 01000100 01000000 10000000 00000000  ................
 400370 751a6909 00000200 33000000 00000000  u.i.....3.......
Contents of section .rela.dyn:
 400380 f80f6000 00000000 06000000 03000000  ..`.............
 400390 00000000 00000000                    ........        
Contents of section .rela.plt:
 400398 18106000 00000000 07000000 01000000  ..`.............
 4003a8 00000000 00000000 20106000 00000000  ........ .`.....
 4003b8 07000000 02000000 00000000 00000000  ................
 4003c8 28106000 00000000 07000000 03000000  (.`.............
 4003d8 00000000 00000000                    ........        
Contents of section .init:
 4003e0 4883ec08 488b050d 0c200048 85c07405  H...H.... .H..t.
 4003f0 e83b0000 004883c4 08c3               .;...H....      
Contents of section .plt:
 400400 ff35020c 2000ff25 040c2000 0f1f4000  .5.. ..%.. ...@.
 400410 ff25020c 20006800 000000e9 e0ffffff  .%.. .h.........
 400420 ff25fa0b 20006801 000000e9 d0ffffff  .%.. .h.........
 400430 ff25f20b 20006802 000000e9 c0ffffff  .%.. .h.........
Contents of section .text:
 400440 31ed4989 d15e4889 e24883e4 f0505449  1.I..^H..H...PTI
 400450 c7c02006 400048c7 c1900540 0048c7c7  .. [email protected][email protected]..
 400460 2c054000 e8b7ffff fff46690 0f1f4000  ,[email protected]...@.
 400470 b8471060 0055482d 40106000 4883f80e  .G.`.UH-@.`.H...
 400480 4889e577 025dc3b8 00000000 4885c074  H..w.]......H..t
 400490 f45dbf40 106000ff e00f1f80 00000000  .].@.`..........
 4004a0 b8401060 0055482d 40106000 48c1f803  .@.`.UH-@.`.H...
 4004b0 4889e548 89c248c1 ea3f4801 d04889c6  H..H..H..?H..H..
 4004c0 48d1fe75 025dc3ba 00000000 4885d274  H..u.]......H..t
 4004d0 f45dbf40 106000ff e20f1f80 00000000  .].@.`..........
 4004e0 803d590b 20000075 11554889 e5e87eff  .=Y. ..u.UH...~.
 4004f0 ffff5dc6 05460b20 0001f3c3 0f1f4000  ..]..F. ......@.
 400500 48833d18 09200000 741bb800 00000048  H.=.. ..t......H
 400510 85c07411 55bf200e 60004889 e5ffd05d  ..t.U. .`.H....]
 400520 e97bffff ffe976ff ffff6690 554889e5  .{....v...f.UH..
 400530 4883ec10 c745fc06 0000008b 050b0100  H....E..........
 400540 008945f4 c745f801 000000eb 17f30f2a  ..E..E.........*
 400550 45f8f30f 104df4f3 0f59c1f3 0f1145f4  E....M...Y....E.
 400560 8345f801 8b45f83b 45fc7ee1 f30f1045  .E...E.;E.~....E
 400570 f40f5ac0 bf340640 00b80100 0000e88d  ..Z..4.@........
 400580 feffffb8 00000000 c9c3660f 1f440000  ..........f..D..
 400590 48896c24 d84c8964 24e0488d 2d770820  H.l$.L.d$.H.-w. 
 4005a0 004c8d25 68082000 48895c24 d04c896c  .L.%h. .H.\$.L.l
 4005b0 24e84c89 7424f04c 897c24f8 4883ec38  $.L.t$.L.|$.H..8
 4005c0 4c29e541 89ff4989 f648c1fd 034989d5  L).A..I..H...I..
 4005d0 31dbe809 feffff48 85ed741a 0f1f4000  1......H..t...@.
 4005e0 4c89ea4c 89f64489 ff41ff14 dc4883c3  L..L..D..A...H..
 4005f0 014839eb 75ea488b 5c240848 8b6c2410  .H9.u.H.\$.H.l$.
 400600 4c8b6424 184c8b6c 24204c8b 7424284c  L.d$.L.l$ L.t$(L
 400610 8b7c2430 4883c438 c30f1f80 00000000  .|$0H..8........
 400620 f3c36690                             ..f.            
Contents of section .fini:
 400624 4883ec08 4883c408 c3                 H...H....       
Contents of section .rodata:
 400630 01000200 0a204661 63746f72 69616c20  ..... Factorial 
 400640 6973203a 205b2566 5d0a0000 0000803f  is : [%f]......?
Contents of section .eh_frame_hdr:
 400650 011b033b 34000000 05000000 b0fdffff  ...;4...........
 400660 80000000 f0fdffff 50000000 dcfeffff  ........P.......
 400670 a8000000 40ffffff c8000000 d0ffffff  ....@...........
 400680 f0000000                             ....            
Contents of section .eh_frame:
 400688 14000000 00000000 017a5200 01781001  .........zR..x..
 400698 1b0c0708 90010710 14000000 1c000000  ................
 4006a8 98fdffff 2a000000 00000000 00000000  ....*...........
 4006b8 14000000 00000000 017a5200 01781001  .........zR..x..
 4006c8 1b0c0708 90010000 24000000 1c000000  ........$.......
 4006d8 28fdffff 40000000 000e1046 0e184a0f  ([email protected].
 4006e8 0b770880 003f1a3b 2a332422 00000000  .w...?.;*3$"....
 4006f8 1c000000 44000000 2cfeffff 5e000000  ....D...,...^...
 400708 00410e10 8602430d 0602590c 07080000  .A....C...Y.....
 400718 24000000 64000000 70feffff 89000000  $...d...p.......
 400728 004a8606 8c05660e 4083078d 048e038f  .J....f.@.......
 400738 0202580e 08000000 14000000 8c000000  ..X.............
 400748 d8feffff 02000000 00000000 00000000  ................
 400758 00000000                             ....            
Contents of section .init_array:
 600e10 00054000 00000000                    ..@.....        
Contents of section .fini_array:
 600e18 e0044000 00000000                    ..@.....        
Contents of section .jcr:
 600e20 00000000 00000000                    ........        
Contents of section .dynamic:
 600e28 01000000 00000000 01000000 00000000  ................
 600e38 0c000000 00000000 e0034000 00000000  ..........@.....
 600e48 0d000000 00000000 24064000 00000000  ........$.@.....
 600e58 19000000 00000000 100e6000 00000000  ..........`.....
 600e68 1b000000 00000000 08000000 00000000  ................
 600e78 1a000000 00000000 180e6000 00000000  ..........`.....
 600e88 1c000000 00000000 08000000 00000000  ................
 600e98 f5feff6f 00000000 98024000 00000000  ...o......@.....
 600ea8 05000000 00000000 18034000 00000000  ..........@.....
 600eb8 06000000 00000000 b8024000 00000000  ..........@.....
 600ec8 0a000000 00000000 3f000000 00000000  ........?.......
 600ed8 0b000000 00000000 18000000 00000000  ................
 600ee8 15000000 00000000 00000000 00000000  ................
 600ef8 03000000 00000000 00106000 00000000  ..........`.....
 600f08 02000000 00000000 48000000 00000000  ........H.......
 600f18 14000000 00000000 07000000 00000000  ................
 600f28 17000000 00000000 98034000 00000000  ..........@.....
 600f38 07000000 00000000 80034000 00000000  ..........@.....
 600f48 08000000 00000000 18000000 00000000  ................
 600f58 09000000 00000000 18000000 00000000  ................
 600f68 feffff6f 00000000 60034000 00000000  ...o....`.@.....
 600f78 ffffff6f 00000000 01000000 00000000  ...o............
 600f88 f0ffff6f 00000000 58034000 00000000  ...o....X.@.....
 600f98 00000000 00000000 00000000 00000000  ................
 600fa8 00000000 00000000 00000000 00000000  ................
 600fb8 00000000 00000000 00000000 00000000  ................
 600fc8 00000000 00000000 00000000 00000000  ................
 600fd8 00000000 00000000 00000000 00000000  ................
 600fe8 00000000 00000000 00000000 00000000  ................
Contents of section .got:
 600ff8 00000000 00000000                    ........        
Contents of section .got.plt:
 601000 280e6000 00000000 00000000 00000000  (.`.............
 601010 00000000 00000000 16044000 00000000  ..........@.....
 601020 26044000 00000000 36044000 00000000  &[email protected].@.....
Contents of section .data:
 601030 00000000 00000000 00000000 00000000  ................
Contents of section .comment:
 0000 4743433a 20285562 756e7475 2f4c696e  GCC: (Ubuntu/Lin
 0010 61726f20 342e372e 332d3175 62756e74  aro 4.7.3-1ubunt
 0020 75312920 342e372e 3300               u1) 4.7.3.

8. Display debug information using -g option

$ objdump -g a.out
 
a.out:     file format elf64-x86-64
 
Contents of the .eh_frame section:
 
00000000 00000014 00000000 CIE
  Version:               1
  Augmentation:          "zR"
  Code alignment factor: 1
  Data alignment factor: -8
  Return address column: 16
  Augmentation data:     1b
 
  DW_CFA_def_cfa: r7 (rsp) ofs 8
  DW_CFA_offset: r16 (rip) at cfa-8
  DW_CFA_undefined: r16 (rip)
 
00000018 00000014 0000001c FDE cie=00000000 pc=fffffffffffffdb8..fffffffffffffde2
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
 
00000030 00000014 00000000 CIE
  Version:               1
  Augmentation:          "zR"
  Code alignment factor: 1
  Data alignment factor: -8
  Return address column: 16
  Augmentation data:     1b
 
  DW_CFA_def_cfa: r7 (rsp) ofs 8
  DW_CFA_offset: r16 (rip) at cfa-8
  DW_CFA_nop
  DW_CFA_nop
 
00000048 00000024 0000001c FDE cie=00000030 pc=fffffffffffffd78..fffffffffffffdb8
  DW_CFA_def_cfa_offset: 16
  DW_CFA_advance_loc: 6 to fffffffffffffd7e
  DW_CFA_def_cfa_offset: 24
  DW_CFA_advance_loc: 10 to fffffffffffffd88
  DW_CFA_def_cfa_expression (DW_OP_breg7 (rsp): 8; DW_OP_breg16 (rip): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit11; DW_OP_ge; DW_OP_lit3; DW_OP_shl; DW_OP_plus)
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
 
00000070 0000001c 00000044 FDE cie=00000030 pc=fffffffffffffea4..ffffffffffffff02
  DW_CFA_advance_loc: 1 to fffffffffffffea5
  DW_CFA_def_cfa_offset: 16
  DW_CFA_offset: r6 (rbp) at cfa-16
  DW_CFA_advance_loc: 3 to fffffffffffffea8
  DW_CFA_def_cfa_register: r6 (rbp)
  DW_CFA_advance_loc1: 89 to ffffffffffffff01
  DW_CFA_def_cfa: r7 (rsp) ofs 8
  DW_CFA_nop
  DW_CFA_nop
 
00000090 00000024 00000064 FDE cie=00000030 pc=ffffffffffffff08..ffffffffffffff91
  DW_CFA_advance_loc: 10 to ffffffffffffff12
  DW_CFA_offset: r6 (rbp) at cfa-48
  DW_CFA_offset: r12 (r12) at cfa-40
  DW_CFA_advance_loc: 38 to ffffffffffffff38
  DW_CFA_def_cfa_offset: 64
  DW_CFA_offset: r3 (rbx) at cfa-56
  DW_CFA_offset: r13 (r13) at cfa-32
  DW_CFA_offset: r14 (r14) at cfa-24
  DW_CFA_offset: r15 (r15) at cfa-16
  DW_CFA_advance_loc1: 88 to ffffffffffffff90
  DW_CFA_def_cfa_offset: 8
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
 
000000b8 00000014 0000008c FDE cie=00000030 pc=ffffffffffffff98..ffffffffffffff9a
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
 
000000d0 ZERO terminator

9. Display the contents of symbol table (or tables) using the -t option

$ objdump -t a.out
 
a.out:     file format elf64-x86-64
 
SYMBOL TABLE:
0000000000400238 l    d  .interp	0000000000000000              .interp
0000000000400254 l    d  .note.ABI-tag	0000000000000000              .note.ABI-tag
0000000000400274 l    d  .note.gnu.build-id	0000000000000000              .note.gnu.build-id
0000000000400298 l    d  .gnu.hash	0000000000000000              .gnu.hash
00000000004002b8 l    d  .dynsym	0000000000000000              .dynsym
0000000000400318 l    d  .dynstr	0000000000000000              .dynstr
0000000000400358 l    d  .gnu.version	0000000000000000              .gnu.version
0000000000400360 l    d  .gnu.version_r	0000000000000000              .gnu.version_r
0000000000400380 l    d  .rela.dyn	0000000000000000              .rela.dyn
0000000000400398 l    d  .rela.plt	0000000000000000              .rela.plt
00000000004003e0 l    d  .init	0000000000000000              .init
0000000000400400 l    d  .plt	0000000000000000              .plt
0000000000400440 l    d  .text	0000000000000000              .text
0000000000400624 l    d  .fini	0000000000000000              .fini
0000000000400630 l    d  .rodata	0000000000000000              .rodata
0000000000400650 l    d  .eh_frame_hdr	0000000000000000              .eh_frame_hdr
0000000000400688 l    d  .eh_frame	0000000000000000              .eh_frame
0000000000600e10 l    d  .init_array	0000000000000000              .init_array
0000000000600e18 l    d  .fini_array	0000000000000000              .fini_array
0000000000600e20 l    d  .jcr	0000000000000000              .jcr
0000000000600e28 l    d  .dynamic	0000000000000000              .dynamic
0000000000600ff8 l    d  .got	0000000000000000              .got
0000000000601000 l    d  .got.plt	0000000000000000              .got.plt
0000000000601030 l    d  .data	0000000000000000              .data
0000000000601040 l    d  .bss	0000000000000000              .bss
0000000000000000 l    d  .comment	0000000000000000              .comment
0000000000000000 l    df *ABS*	0000000000000000              crtstuff.c
0000000000600e20 l     O .jcr	0000000000000000              __JCR_LIST__
0000000000400470 l     F .text	0000000000000000              deregister_tm_clones
00000000004004a0 l     F .text	0000000000000000              register_tm_clones
00000000004004e0 l     F .text	0000000000000000              __do_global_dtors_aux
0000000000601040 l     O .bss	0000000000000001              completed.6718
0000000000600e18 l     O .fini_array	0000000000000000              __do_global_dtors_aux_fini_array_entry
0000000000400500 l     F .text	0000000000000000              frame_dummy
0000000000600e10 l     O .init_array	0000000000000000              __frame_dummy_init_array_entry
0000000000000000 l    df *ABS*	0000000000000000              factorial.c
0000000000000000 l    df *ABS*	0000000000000000              crtstuff.c
0000000000400758 l     O .eh_frame	0000000000000000              __FRAME_END__
0000000000600e20 l     O .jcr	0000000000000000              __JCR_END__
0000000000000000 l    df *ABS*	0000000000000000              
0000000000600e18 l       .init_array	0000000000000000              __init_array_end
0000000000600e28 l     O .dynamic	0000000000000000              _DYNAMIC
0000000000600e10 l       .init_array	0000000000000000              __init_array_start
0000000000601000 l     O .got.plt	0000000000000000              _GLOBAL_OFFSET_TABLE_
0000000000400620 g     F .text	0000000000000002              __libc_csu_fini
0000000000000000  w      *UND*	0000000000000000              _ITM_deregisterTMCloneTable
0000000000601030  w      .data	0000000000000000              data_start
0000000000601040 g       .data	0000000000000000              _edata
0000000000400624 g     F .fini	0000000000000000              _fini
0000000000000000       F *UND*	0000000000000000              printf@@GLIBC_2.2.5
0000000000000000       F *UND*	0000000000000000              __libc_start_main@@GLIBC_2.2.5
0000000000601030 g       .data	0000000000000000              __data_start
0000000000000000  w      *UND*	0000000000000000              __gmon_start__
0000000000601038 g     O .data	0000000000000000              .hidden __dso_handle
0000000000400630 g     O .rodata	0000000000000004              _IO_stdin_used
0000000000400590 g     F .text	0000000000000089              __libc_csu_init
0000000000601048 g       .bss	0000000000000000              _end
0000000000400440 g     F .text	0000000000000000              _start
0000000000601040 g       .bss	0000000000000000              __bss_start
000000000040052c g     F .text	000000000000005e              main
0000000000000000  w      *UND*	0000000000000000              _Jv_RegisterClasses
0000000000601040 g     O .data	0000000000000000              .hidden __TMC_END__
0000000000000000  w      *UND*	0000000000000000              _ITM_registerTMCloneTable
00000000004003e0 g     F .init	0000000000000000              _init

10. Display the contents of dynamic symbol table using -T option

$ objdump -T a.out
 
a.out:     file format elf64-x86-64
 
DYNAMIC SYMBOL TABLE:
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 printf
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 __libc_start_main
0000000000000000  w   D  *UND*	0000000000000000              __gmon_start__

11. Display the dynamic relocation entries in the file using -R option

$ objdump -R a.out
 
a.out:     file format elf64-x86-64
 
DYNAMIC RELOCATION RECORDS
OFFSET           TYPE              VALUE 
0000000000600ff8 R_X86_64_GLOB_DAT  __gmon_start__
0000000000601018 R_X86_64_JUMP_SLOT  printf
0000000000601020 R_X86_64_JUMP_SLOT  __libc_start_main
0000000000601028 R_X86_64_JUMP_SLOT  __gmon_start__

12. Display section of interest using -j option

$ objdump -s -j .rodata a.out
 
a.out:     file format elf64-x86-64
 
Contents of section .rodata:
 400630 01000200 0a204661 63746f72 69616c20  ..... Factorial 
 400640 6973203a 205b2566 5d0a0000 0000803f  is : [%f]......?

13. Accept input options from a file using @ option

$ cat options.txt
-v -i

Execute the objdump by calling the options.txt file as shown below. This displays the same output as above, as it is reading the options from the options.txt file.

$ objdump @options.txt
GNU objdump (GNU Binutils for Ubuntu) 2.20.1-system.20100303
Copyright 2009 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.

Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.

If you wish to look at all Linux commands and their usage examples, go to Linux Commands Tutorial.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.