readelf - yusukew62/docs GitHub Wiki

readelfコマンドメモ

test.c

$ cat test.c 
#include <stdio.h>

int main()
{
  printf("hello world\n");

  return 0;
}

file a.out

$ file a.out
a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, BuildID[sha1]=6a617e65aaf90badcd43b65d3af1df3357b04170, not stripped

cat a.out

$ cat a.out
ELF>?@@?	@@@@@@?@@@@?? ??`?`? ??`?`?@@DDP?td??@?@$$Q?t/lib64/ld-linux-x86-64.so.2GNUGNUja~e??
                                                                                                    ??C?]:??3W?Ap __gmon_start__libc.so.6puts__libc_start_mainGLIBC_2.2.5ui	1```H??s???H???5? ?%? @?%? h??????%? h?????1?I??^H??H???PTI?? ?Ř`H?? H9?r??? H?[??fff.?H?= UH??t?H????`????Ð?UH???@???????Ð????????fffff.?H?l$?L?d$?H?-? L?%| L?l$?L?t$?L?|$?H?\$?H??8L)?A??I??H??I???[???H??t1?@L??L??D??A??H??H9?r?H?\H?l$L?d$L?l$ L?t$(L?|$0H????????UH??SH?H?? H???t??`DH???H?H???u?H?[?Ð?H??o???H??hello world ????<????\
                                         ???tzRx
P                                              ????A?C
<????$T?????Q??_@????????????????????
?@???o`@?@?@                         ?@
=
 `0`@H@ ???o(@???o???o@?`?@?@GCC: (GNU) 4.4.7 20120313 (Red Hat 4.4.7-17).symtab.strtab.shstrtab.interp.note.ABI-tag.note.gnu.build-id.gnu.hash.dynsym.dynstr.gnu.version.gnu.version_r.rela.dyn.rela.plt.init.text.fini.rodata.eh_frame_hdr.eh_frame.ctors.dtors.jcr.dynamic.got.got.plt.data.bss.comment#@ 1<@<$D???o`@N
                                                                                ?@?V?@?=^???ok???o(@(zH@?`@`0
                                                                                                            ??@???@?0??@????@???@??@?$??`??`????`??`?0-? .    ?@@<@`@?@?@(@	H@
`@
  ?@
?@?@?@?@?`?`?`?`````
?@????`??`??`?`
?@????`???`???`???@??`?
   ?@call_gmon_startcrtstuff.c__CTOR_LIST____DTOR_LIST____JCR_LIST____do_global_dtors_auxcompleted.6352dtor_idx.6354frame_dummy__CTOR_END____FRAME_END____JCR_END____do_global_ctors_auxtest.c_GLOBAL_OFFSET_TABLE___init_array_end__init_array_start_DYNAMICdata_start__libc_csu_fini_start__gmon_start___Jv_RegisterClassesputs@@GLIBC_2.2.5_fini__libc_start_main@@GLIBC_2.2.5_IO_stdin_used__data_start__dso_handle__DTOR_END____libc_csu_init__bss_start_end_edatamain_init[wmb

readelf

$ readelf --help
Usage: readelf <option(s)> elf-file(s)
 Display information about the contents of ELF format files
 Options are:
  -a --all               Equivalent to: -h -l -S -s -r -d -V -A -I
  -h --file-header       Display the ELF file header
  -l --program-headers   Display the program headers
     --segments          An alias for --program-headers
  -S --section-headers   Display the sections' header
     --sections          An alias for --section-headers
  -g --section-groups    Display the section groups
  -t --section-details   Display the section details
  -e --headers           Equivalent to: -h -l -S
  -s --syms              Display the symbol table
      --symbols          An alias for --syms
  -n --notes             Display the core notes (if present)
  -r --relocs            Display the relocations (if present)
  -u --unwind            Display the unwind info (if present)
  -d --dynamic           Display the dynamic section (if present)
  -V --version-info      Display the version sections (if present)
  -A --arch-specific     Display architecture specific information (if any).
  -c --archive-index     Display the symbol/file index in an archive
  -D --use-dynamic       Use the dynamic section info when displaying symbols
  -x --hex-dump=<number|name>
                         Dump the contents of section <number|name> as bytes
  -p --string-dump=<number|name>
                         Dump the contents of section <number|name> as strings
  -R --relocated-dump=<number|name>
                         Dump the contents of section <number|name> as relocated bytes
  -w[lLiaprmfFsoR] or
  --debug-dump[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=str,=loc,=Ranges]
                         Display the contents of DWARF2 debug sections
  -I --histogram         Display histogram of bucket list lengths
  -W --wide              Allow output width to exceed 80 characters
  @<file>                Read options from <file>
  -H --help              Display this information
  -v --version           Display the version number of readelf
Report bugs to <http://bugzilla.redhat.com/bugzilla/>

readelf -S

$ cat readelf_S
There are 30 section headers, starting at offset 0x9a0:

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .interp           PROGBITS         0000000000400200  00000200
       000000000000001c  0000000000000000   A       0     0     1
  [ 2] .note.ABI-tag     NOTE             000000000040021c  0000021c
       0000000000000020  0000000000000000   A       0     0     4
  [ 3] .note.gnu.build-i NOTE             000000000040023c  0000023c
       0000000000000024  0000000000000000   A       0     0     4
  [ 4] .gnu.hash         GNU_HASH         0000000000400260  00000260
       000000000000001c  0000000000000000   A       5     0     8
  [ 5] .dynsym           DYNSYM           0000000000400280  00000280
       0000000000000060  0000000000000018   A       6     1     8
  [ 6] .dynstr           STRTAB           00000000004002e0  000002e0
       000000000000003d  0000000000000000   A       0     0     1
  [ 7] .gnu.version      VERSYM           000000000040031e  0000031e
       0000000000000008  0000000000000002   A       5     0     2
  [ 8] .gnu.version_r    VERNEED          0000000000400328  00000328
       0000000000000020  0000000000000000   A       6     1     8
  [ 9] .rela.dyn         RELA             0000000000400348  00000348
       0000000000000018  0000000000000018   A       5     0     8
  [10] .rela.plt         RELA             0000000000400360  00000360
       0000000000000030  0000000000000018   A       5    12     8
  [11] .init             PROGBITS         0000000000400390  00000390
       0000000000000018  0000000000000000  AX       0     0     4
  [12] .plt              PROGBITS         00000000004003a8  000003a8
       0000000000000030  0000000000000010  AX       0     0     4
  [13] .text             PROGBITS         00000000004003e0  000003e0
       00000000000001d8  0000000000000000  AX       0     0     16
  [14] .fini             PROGBITS         00000000004005b8  000005b8
       000000000000000e  0000000000000000  AX       0     0     4
  [15] .rodata           PROGBITS         00000000004005c8  000005c8
       000000000000001c  0000000000000000   A       0     0     8
  [16] .eh_frame_hdr     PROGBITS         00000000004005e4  000005e4
       0000000000000024  0000000000000000   A       0     0     4
  [17] .eh_frame         PROGBITS         0000000000400608  00000608
       000000000000007c  0000000000000000   A       0     0     8
  [18] .ctors            PROGBITS         0000000000600688  00000688
       0000000000000010  0000000000000000  WA       0     0     8
  [19] .dtors            PROGBITS         0000000000600698  00000698
       0000000000000010  0000000000000000  WA       0     0     8
  [20] .jcr              PROGBITS         00000000006006a8  000006a8
       0000000000000008  0000000000000000  WA       0     0     8
  [21] .dynamic          DYNAMIC          00000000006006b0  000006b0
       0000000000000190  0000000000000010  WA       6     0     8
  [22] .got              PROGBITS         0000000000600840  00000840
       0000000000000008  0000000000000008  WA       0     0     8
  [23] .got.plt          PROGBITS         0000000000600848  00000848
       0000000000000028  0000000000000008  WA       0     0     8
  [24] .data             PROGBITS         0000000000600870  00000870
       0000000000000004  0000000000000000  WA       0     0     4
  [25] .bss              NOBITS           0000000000600878  00000874
       0000000000000010  0000000000000000  WA       0     0     8
  [26] .comment          PROGBITS         0000000000000000  00000874
       000000000000002d  0000000000000001  MS       0     0     1
  [27] .shstrtab         STRTAB           0000000000000000  000008a1
       00000000000000fe  0000000000000000           0     0     1
  [28] .symtab           SYMTAB           0000000000000000  00001120
       0000000000000600  0000000000000018          29    46     8
  [29] .strtab           STRTAB           0000000000000000  00001720
       00000000000001f0  0000000000000000           0     0     1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

readelf -V

$ cat readelf_V 

Version symbols section '.gnu.version' contains 4 entries:
 Addr: 000000000040031e  Offset: 0x00031e  Link: 5 (.dynsym)
  000:   0 (*local*)       0 (*local*)       2 (GLIBC_2.2.5)   2 (GLIBC_2.2.5)

Version needs section '.gnu.version_r' contains 1 entries:
 Addr: 0x0000000000400328  Offset: 0x000328  Link: 6 (.dynstr)
  000000: Version: 1  File: libc.so.6  Cnt: 1
  0x0010:   Name: GLIBC_2.2.5  Flags: none  Version: 2

readelf -a

$ cat readelf_a 
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Advanced Micro Devices X86-64
  Version:                           0x1
  Entry point address:               0x4003e0
  Start of program headers:          64 (bytes into file)
  Start of section headers:          2464 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         8
  Size of section headers:           64 (bytes)
  Number of section headers:         30
  Section header string table index: 27

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .interp           PROGBITS         0000000000400200  00000200
       000000000000001c  0000000000000000   A       0     0     1
  [ 2] .note.ABI-tag     NOTE             000000000040021c  0000021c
       0000000000000020  0000000000000000   A       0     0     4
  [ 3] .note.gnu.build-i NOTE             000000000040023c  0000023c
       0000000000000024  0000000000000000   A       0     0     4
  [ 4] .gnu.hash         GNU_HASH         0000000000400260  00000260
       000000000000001c  0000000000000000   A       5     0     8
  [ 5] .dynsym           DYNSYM           0000000000400280  00000280
       0000000000000060  0000000000000018   A       6     1     8
  [ 6] .dynstr           STRTAB           00000000004002e0  000002e0
       000000000000003d  0000000000000000   A       0     0     1
  [ 7] .gnu.version      VERSYM           000000000040031e  0000031e
       0000000000000008  0000000000000002   A       5     0     2
  [ 8] .gnu.version_r    VERNEED          0000000000400328  00000328
       0000000000000020  0000000000000000   A       6     1     8
  [ 9] .rela.dyn         RELA             0000000000400348  00000348
       0000000000000018  0000000000000018   A       5     0     8
  [10] .rela.plt         RELA             0000000000400360  00000360
       0000000000000030  0000000000000018   A       5    12     8
  [11] .init             PROGBITS         0000000000400390  00000390
       0000000000000018  0000000000000000  AX       0     0     4
  [12] .plt              PROGBITS         00000000004003a8  000003a8
       0000000000000030  0000000000000010  AX       0     0     4
  [13] .text             PROGBITS         00000000004003e0  000003e0
       00000000000001d8  0000000000000000  AX       0     0     16
  [14] .fini             PROGBITS         00000000004005b8  000005b8
       000000000000000e  0000000000000000  AX       0     0     4
  [15] .rodata           PROGBITS         00000000004005c8  000005c8
       000000000000001c  0000000000000000   A       0     0     8
  [16] .eh_frame_hdr     PROGBITS         00000000004005e4  000005e4
       0000000000000024  0000000000000000   A       0     0     4
  [17] .eh_frame         PROGBITS         0000000000400608  00000608
       000000000000007c  0000000000000000   A       0     0     8
  [18] .ctors            PROGBITS         0000000000600688  00000688
       0000000000000010  0000000000000000  WA       0     0     8
  [19] .dtors            PROGBITS         0000000000600698  00000698
       0000000000000010  0000000000000000  WA       0     0     8
  [20] .jcr              PROGBITS         00000000006006a8  000006a8
       0000000000000008  0000000000000000  WA       0     0     8
  [21] .dynamic          DYNAMIC          00000000006006b0  000006b0
       0000000000000190  0000000000000010  WA       6     0     8
  [22] .got              PROGBITS         0000000000600840  00000840
       0000000000000008  0000000000000008  WA       0     0     8
  [23] .got.plt          PROGBITS         0000000000600848  00000848
       0000000000000028  0000000000000008  WA       0     0     8
  [24] .data             PROGBITS         0000000000600870  00000870
       0000000000000004  0000000000000000  WA       0     0     4
  [25] .bss              NOBITS           0000000000600878  00000874
       0000000000000010  0000000000000000  WA       0     0     8
  [26] .comment          PROGBITS         0000000000000000  00000874
       000000000000002d  0000000000000001  MS       0     0     1
  [27] .shstrtab         STRTAB           0000000000000000  000008a1
       00000000000000fe  0000000000000000           0     0     1
  [28] .symtab           SYMTAB           0000000000000000  00001120
       0000000000000600  0000000000000018          29    46     8
  [29] .strtab           STRTAB           0000000000000000  00001720
       00000000000001f0  0000000000000000           0     0     1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

There are no section groups in this file.

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  PHDR           0x0000000000000040 0x0000000000400040 0x0000000000400040
                 0x00000000000001c0 0x00000000000001c0  R E    8
  INTERP         0x0000000000000200 0x0000000000400200 0x0000000000400200
                 0x000000000000001c 0x000000000000001c  R      1
      [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
  LOAD           0x0000000000000000 0x0000000000400000 0x0000000000400000
                 0x0000000000000684 0x0000000000000684  R E    200000
  LOAD           0x0000000000000688 0x0000000000600688 0x0000000000600688
                 0x00000000000001ec 0x0000000000000200  RW     200000
  DYNAMIC        0x00000000000006b0 0x00000000006006b0 0x00000000006006b0
                 0x0000000000000190 0x0000000000000190  RW     8
  NOTE           0x000000000000021c 0x000000000040021c 0x000000000040021c
                 0x0000000000000044 0x0000000000000044  R      4
  GNU_EH_FRAME   0x00000000000005e4 0x00000000004005e4 0x00000000004005e4
                 0x0000000000000024 0x0000000000000024  R      4
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     8

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .interp 
   02     .interp .note.ABI-tag .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame 
   03     .ctors .dtors .jcr .dynamic .got .got.plt .data .bss 
   04     .dynamic 
   05     .note.ABI-tag .note.gnu.build-id 
   06     .eh_frame_hdr 
   07     

Dynamic section at offset 0x6b0 contains 20 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000c (INIT)               0x400390
 0x000000000000000d (FINI)               0x4005b8
 0x000000006ffffef5 (GNU_HASH)           0x400260
 0x0000000000000005 (STRTAB)             0x4002e0
 0x0000000000000006 (SYMTAB)             0x400280
 0x000000000000000a (STRSZ)              61 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000003 (PLTGOT)             0x600848
 0x0000000000000002 (PLTRELSZ)           48 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x400360
 0x0000000000000007 (RELA)               0x400348
 0x0000000000000008 (RELASZ)             24 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffffe (VERNEED)            0x400328
 0x000000006fffffff (VERNEEDNUM)         1
 0x000000006ffffff0 (VERSYM)             0x40031e
 0x0000000000000000 (NULL)               0x0

Relocation section '.rela.dyn' at offset 0x348 contains 1 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000600840  000100000006 R_X86_64_GLOB_DAT 0000000000000000 __gmon_start__ + 0

Relocation section '.rela.plt' at offset 0x360 contains 2 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000600860  000200000007 R_X86_64_JUMP_SLO 0000000000000000 puts + 0
000000600868  000300000007 R_X86_64_JUMP_SLO 0000000000000000 __libc_start_main + 0

There are no unwind sections in this file.

Symbol table '.dynsym' contains 4 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND __gmon_start__
     2: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND puts@GLIBC_2.2.5 (2)
     3: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __libc_start_main@GLIBC_2.2.5 (2)

Symbol table '.symtab' contains 64 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000000000400200     0 SECTION LOCAL  DEFAULT    1 
     2: 000000000040021c     0 SECTION LOCAL  DEFAULT    2 
     3: 000000000040023c     0 SECTION LOCAL  DEFAULT    3 
     4: 0000000000400260     0 SECTION LOCAL  DEFAULT    4 
     5: 0000000000400280     0 SECTION LOCAL  DEFAULT    5 
     6: 00000000004002e0     0 SECTION LOCAL  DEFAULT    6 
     7: 000000000040031e     0 SECTION LOCAL  DEFAULT    7 
     8: 0000000000400328     0 SECTION LOCAL  DEFAULT    8 
     9: 0000000000400348     0 SECTION LOCAL  DEFAULT    9 
    10: 0000000000400360     0 SECTION LOCAL  DEFAULT   10 
    11: 0000000000400390     0 SECTION LOCAL  DEFAULT   11 
    12: 00000000004003a8     0 SECTION LOCAL  DEFAULT   12 
    13: 00000000004003e0     0 SECTION LOCAL  DEFAULT   13 
    14: 00000000004005b8     0 SECTION LOCAL  DEFAULT   14 
    15: 00000000004005c8     0 SECTION LOCAL  DEFAULT   15 
    16: 00000000004005e4     0 SECTION LOCAL  DEFAULT   16 
    17: 0000000000400608     0 SECTION LOCAL  DEFAULT   17 
    18: 0000000000600688     0 SECTION LOCAL  DEFAULT   18 
    19: 0000000000600698     0 SECTION LOCAL  DEFAULT   19 
    20: 00000000006006a8     0 SECTION LOCAL  DEFAULT   20 
    21: 00000000006006b0     0 SECTION LOCAL  DEFAULT   21 
    22: 0000000000600840     0 SECTION LOCAL  DEFAULT   22 
    23: 0000000000600848     0 SECTION LOCAL  DEFAULT   23 
    24: 0000000000600870     0 SECTION LOCAL  DEFAULT   24 
    25: 0000000000600878     0 SECTION LOCAL  DEFAULT   25 
    26: 0000000000000000     0 SECTION LOCAL  DEFAULT   26 
    27: 000000000040040c     0 FUNC    LOCAL  DEFAULT   13 call_gmon_start
    28: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS crtstuff.c
    29: 0000000000600688     0 OBJECT  LOCAL  DEFAULT   18 __CTOR_LIST__
    30: 0000000000600698     0 OBJECT  LOCAL  DEFAULT   19 __DTOR_LIST__
    31: 00000000006006a8     0 OBJECT  LOCAL  DEFAULT   20 __JCR_LIST__
    32: 0000000000400430     0 FUNC    LOCAL  DEFAULT   13 __do_global_dtors_aux
    33: 0000000000600878     1 OBJECT  LOCAL  DEFAULT   25 completed.6352
    34: 0000000000600880     8 OBJECT  LOCAL  DEFAULT   25 dtor_idx.6354
    35: 00000000004004a0     0 FUNC    LOCAL  DEFAULT   13 frame_dummy
    36: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS crtstuff.c
    37: 0000000000600690     0 OBJECT  LOCAL  DEFAULT   18 __CTOR_END__
    38: 0000000000400680     0 OBJECT  LOCAL  DEFAULT   17 __FRAME_END__
    39: 00000000006006a8     0 OBJECT  LOCAL  DEFAULT   20 __JCR_END__
    40: 0000000000400580     0 FUNC    LOCAL  DEFAULT   13 __do_global_ctors_aux
    41: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS test.c
    42: 0000000000600848     0 OBJECT  LOCAL  DEFAULT   23 _GLOBAL_OFFSET_TABLE_
    43: 0000000000600684     0 NOTYPE  LOCAL  DEFAULT   18 __init_array_end
    44: 0000000000600684     0 NOTYPE  LOCAL  DEFAULT   18 __init_array_start
    45: 00000000006006b0     0 OBJECT  LOCAL  DEFAULT   21 _DYNAMIC
    46: 0000000000600870     0 NOTYPE  WEAK   DEFAULT   24 data_start
    47: 00000000004004e0     2 FUNC    GLOBAL DEFAULT   13 __libc_csu_fini
    48: 00000000004003e0     0 FUNC    GLOBAL DEFAULT   13 _start
    49: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND __gmon_start__
    50: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND _Jv_RegisterClasses
    51: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND puts@@GLIBC_2.2.5
    52: 00000000004005b8     0 FUNC    GLOBAL DEFAULT   14 _fini
    53: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __libc_start_main@@GLIBC_
    54: 00000000004005c8     4 OBJECT  GLOBAL DEFAULT   15 _IO_stdin_used
    55: 0000000000600870     0 NOTYPE  GLOBAL DEFAULT   24 __data_start
    56: 00000000004005d0     0 OBJECT  GLOBAL HIDDEN    15 __dso_handle
    57: 00000000006006a0     0 OBJECT  GLOBAL HIDDEN    19 __DTOR_END__
    58: 00000000004004f0   137 FUNC    GLOBAL DEFAULT   13 __libc_csu_init
    59: 0000000000600874     0 NOTYPE  GLOBAL DEFAULT  ABS __bss_start
    60: 0000000000600888     0 NOTYPE  GLOBAL DEFAULT  ABS _end
    61: 0000000000600874     0 NOTYPE  GLOBAL DEFAULT  ABS _edata
    62: 00000000004004c4    21 FUNC    GLOBAL DEFAULT   13 main
    63: 0000000000400390     0 FUNC    GLOBAL DEFAULT   11 _init

Version symbols section '.gnu.version' contains 4 entries:
 Addr: 000000000040031e  Offset: 0x00031e  Link: 5 (.dynsym)
  000:   0 (*local*)       0 (*local*)       2 (GLIBC_2.2.5)   2 (GLIBC_2.2.5)

Version needs section '.gnu.version_r' contains 1 entries:
 Addr: 0x0000000000400328  Offset: 0x000328  Link: 6 (.dynstr)
  000000: Version: 1  File: libc.so.6  Cnt: 1
  0x0010:   Name: GLIBC_2.2.5  Flags: none  Version: 2

Notes at offset 0x0000021c with length 0x00000020:
  Owner		Data size	Description
  GNU		0x00000010	NT_GNU_ABI_TAG (ABI version tag)

Notes at offset 0x0000023c with length 0x00000024:
  Owner		Data size	Description
  GNU		0x00000014	NT_GNU_BUILD_ID (unique build ID bitstring)

readelf -d

$ cat readelf_d 

Dynamic section at offset 0x6b0 contains 20 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000c (INIT)               0x400390
 0x000000000000000d (FINI)               0x4005b8
 0x000000006ffffef5 (GNU_HASH)           0x400260
 0x0000000000000005 (STRTAB)             0x4002e0
 0x0000000000000006 (SYMTAB)             0x400280
 0x000000000000000a (STRSZ)              61 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000003 (PLTGOT)             0x600848
 0x0000000000000002 (PLTRELSZ)           48 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x400360
 0x0000000000000007 (RELA)               0x400348
 0x0000000000000008 (RELASZ)             24 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffffe (VERNEED)            0x400328
 0x000000006fffffff (VERNEEDNUM)         1
 0x000000006ffffff0 (VERSYM)             0x40031e
 0x0000000000000000 (NULL)               0x0

readelf

$ cat readelf_e 
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Advanced Micro Devices X86-64
  Version:                           0x1
  Entry point address:               0x4003e0
  Start of program headers:          64 (bytes into file)
  Start of section headers:          2464 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         8
  Size of section headers:           64 (bytes)
  Number of section headers:         30
  Section header string table index: 27

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .interp           PROGBITS         0000000000400200  00000200
       000000000000001c  0000000000000000   A       0     0     1
  [ 2] .note.ABI-tag     NOTE             000000000040021c  0000021c
       0000000000000020  0000000000000000   A       0     0     4
  [ 3] .note.gnu.build-i NOTE             000000000040023c  0000023c
       0000000000000024  0000000000000000   A       0     0     4
  [ 4] .gnu.hash         GNU_HASH         0000000000400260  00000260
       000000000000001c  0000000000000000   A       5     0     8
  [ 5] .dynsym           DYNSYM           0000000000400280  00000280
       0000000000000060  0000000000000018   A       6     1     8
  [ 6] .dynstr           STRTAB           00000000004002e0  000002e0
       000000000000003d  0000000000000000   A       0     0     1
  [ 7] .gnu.version      VERSYM           000000000040031e  0000031e
       0000000000000008  0000000000000002   A       5     0     2
  [ 8] .gnu.version_r    VERNEED          0000000000400328  00000328
       0000000000000020  0000000000000000   A       6     1     8
  [ 9] .rela.dyn         RELA             0000000000400348  00000348
       0000000000000018  0000000000000018   A       5     0     8
  [10] .rela.plt         RELA             0000000000400360  00000360
       0000000000000030  0000000000000018   A       5    12     8
  [11] .init             PROGBITS         0000000000400390  00000390
       0000000000000018  0000000000000000  AX       0     0     4
  [12] .plt              PROGBITS         00000000004003a8  000003a8
       0000000000000030  0000000000000010  AX       0     0     4
  [13] .text             PROGBITS         00000000004003e0  000003e0
       00000000000001d8  0000000000000000  AX       0     0     16
  [14] .fini             PROGBITS         00000000004005b8  000005b8
       000000000000000e  0000000000000000  AX       0     0     4
  [15] .rodata           PROGBITS         00000000004005c8  000005c8
       000000000000001c  0000000000000000   A       0     0     8
  [16] .eh_frame_hdr     PROGBITS         00000000004005e4  000005e4
       0000000000000024  0000000000000000   A       0     0     4
  [17] .eh_frame         PROGBITS         0000000000400608  00000608
       000000000000007c  0000000000000000   A       0     0     8
  [18] .ctors            PROGBITS         0000000000600688  00000688
       0000000000000010  0000000000000000  WA       0     0     8
  [19] .dtors            PROGBITS         0000000000600698  00000698
       0000000000000010  0000000000000000  WA       0     0     8
  [20] .jcr              PROGBITS         00000000006006a8  000006a8
       0000000000000008  0000000000000000  WA       0     0     8
  [21] .dynamic          DYNAMIC          00000000006006b0  000006b0
       0000000000000190  0000000000000010  WA       6     0     8
  [22] .got              PROGBITS         0000000000600840  00000840
       0000000000000008  0000000000000008  WA       0     0     8
  [23] .got.plt          PROGBITS         0000000000600848  00000848
       0000000000000028  0000000000000008  WA       0     0     8
  [24] .data             PROGBITS         0000000000600870  00000870
       0000000000000004  0000000000000000  WA       0     0     4
  [25] .bss              NOBITS           0000000000600878  00000874
       0000000000000010  0000000000000000  WA       0     0     8
  [26] .comment          PROGBITS         0000000000000000  00000874
       000000000000002d  0000000000000001  MS       0     0     1
  [27] .shstrtab         STRTAB           0000000000000000  000008a1
       00000000000000fe  0000000000000000           0     0     1
  [28] .symtab           SYMTAB           0000000000000000  00001120
       0000000000000600  0000000000000018          29    46     8
  [29] .strtab           STRTAB           0000000000000000  00001720
       00000000000001f0  0000000000000000           0     0     1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  PHDR           0x0000000000000040 0x0000000000400040 0x0000000000400040
                 0x00000000000001c0 0x00000000000001c0  R E    8
  INTERP         0x0000000000000200 0x0000000000400200 0x0000000000400200
                 0x000000000000001c 0x000000000000001c  R      1
      [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
  LOAD           0x0000000000000000 0x0000000000400000 0x0000000000400000
                 0x0000000000000684 0x0000000000000684  R E    200000
  LOAD           0x0000000000000688 0x0000000000600688 0x0000000000600688
                 0x00000000000001ec 0x0000000000000200  RW     200000
  DYNAMIC        0x00000000000006b0 0x00000000006006b0 0x00000000006006b0
                 0x0000000000000190 0x0000000000000190  RW     8
  NOTE           0x000000000000021c 0x000000000040021c 0x000000000040021c
                 0x0000000000000044 0x0000000000000044  R      4
  GNU_EH_FRAME   0x00000000000005e4 0x00000000004005e4 0x00000000004005e4
                 0x0000000000000024 0x0000000000000024  R      4
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     8

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .interp 
   02     .interp .note.ABI-tag .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame 
   03     .ctors .dtors .jcr .dynamic .got .got.plt .data .bss 
   04     .dynamic 
   05     .note.ABI-tag .note.gnu.build-id 
   06     .eh_frame_hdr 
   07  

readelf -h

$ cat readelf_h 
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Advanced Micro Devices X86-64
  Version:                           0x1
  Entry point address:               0x4003e0
  Start of program headers:          64 (bytes into file)
  Start of section headers:          2464 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         8
  Size of section headers:           64 (bytes)
  Number of section headers:         30
  Section header string table index: 27

readelf -l

$ cat readelf_l 

Elf file type is EXEC (Executable file)
Entry point 0x4003e0
There are 8 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  PHDR           0x0000000000000040 0x0000000000400040 0x0000000000400040
                 0x00000000000001c0 0x00000000000001c0  R E    8
  INTERP         0x0000000000000200 0x0000000000400200 0x0000000000400200
                 0x000000000000001c 0x000000000000001c  R      1
      [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
  LOAD           0x0000000000000000 0x0000000000400000 0x0000000000400000
                 0x0000000000000684 0x0000000000000684  R E    200000
  LOAD           0x0000000000000688 0x0000000000600688 0x0000000000600688
                 0x00000000000001ec 0x0000000000000200  RW     200000
  DYNAMIC        0x00000000000006b0 0x00000000006006b0 0x00000000006006b0
                 0x0000000000000190 0x0000000000000190  RW     8
  NOTE           0x000000000000021c 0x000000000040021c 0x000000000040021c
                 0x0000000000000044 0x0000000000000044  R      4
  GNU_EH_FRAME   0x00000000000005e4 0x00000000004005e4 0x00000000004005e4
                 0x0000000000000024 0x0000000000000024  R      4
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     8

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .interp 
   02     .interp .note.ABI-tag .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame 
   03     .ctors .dtors .jcr .dynamic .got .got.plt .data .bss 
   04     .dynamic 
   05     .note.ABI-tag .note.gnu.build-id 
   06     .eh_frame_hdr 
   07     

readelf -n

$ cat readelf_n 

Notes at offset 0x0000021c with length 0x00000020:
  Owner		Data size	Description
  GNU		0x00000010	NT_GNU_ABI_TAG (ABI version tag)

Notes at offset 0x0000023c with length 0x00000024:
  Owner		Data size	Description
  GNU		0x00000014	NT_GNU_BUILD_ID (unique build ID bitstring)

readelf -r

$ cat readelf_r 

Relocation section '.rela.dyn' at offset 0x348 contains 1 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000600840  000100000006 R_X86_64_GLOB_DAT 0000000000000000 __gmon_start__ + 0

Relocation section '.rela.plt' at offset 0x360 contains 2 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000600860  000200000007 R_X86_64_JUMP_SLO 0000000000000000 puts + 0
000000600868  000300000007 R_X86_64_JUMP_SLO 0000000000000000 __libc_start_main + 0

readelf -t

$ cat readelf_t 
There are 30 section headers, starting at offset 0x9a0:

Section Headers:
  [Nr] Name
       Type              Address          Offset            Link
       Size              EntSize          Info              Align
       Flags
  [ 0] 
       NULL                   NULL             0000000000000000  0000000000000000  0
       0000000000000000 0000000000000000  0                 0
       [0000000000000000]: 
  [ 1] .interp
       PROGBITS               PROGBITS         0000000000400200  0000000000000200  0
       000000000000001c 0000000000000000  0                 1
       [0000000000000002]: ALLOC
  [ 2] .note.ABI-tag
       NOTE                   NOTE             000000000040021c  000000000000021c  0
       0000000000000020 0000000000000000  0                 4
       [0000000000000002]: ALLOC
  [ 3] .note.gnu.build-id
       NOTE                   NOTE             000000000040023c  000000000000023c  0
       0000000000000024 0000000000000000  0                 4
       [0000000000000002]: ALLOC
  [ 4] .gnu.hash
       GNU_HASH               GNU_HASH         0000000000400260  0000000000000260  5
       000000000000001c 0000000000000000  0                 8
       [0000000000000002]: ALLOC
  [ 5] .dynsym
       DYNSYM                 DYNSYM           0000000000400280  0000000000000280  6
       0000000000000060 0000000000000018  1                 8
       [0000000000000002]: ALLOC
  [ 6] .dynstr
       STRTAB                 STRTAB           00000000004002e0  00000000000002e0  0
       000000000000003d 0000000000000000  0                 1
       [0000000000000002]: ALLOC
  [ 7] .gnu.version
       VERSYM                 VERSYM           000000000040031e  000000000000031e  5
       0000000000000008 0000000000000002  0                 2
       [0000000000000002]: ALLOC
  [ 8] .gnu.version_r
       VERNEED                VERNEED          0000000000400328  0000000000000328  6
       0000000000000020 0000000000000000  1                 8
       [0000000000000002]: ALLOC
  [ 9] .rela.dyn
       RELA                   RELA             0000000000400348  0000000000000348  5
       0000000000000018 0000000000000018  0                 8
       [0000000000000002]: ALLOC
  [10] .rela.plt
       RELA                   RELA             0000000000400360  0000000000000360  5
       0000000000000030 0000000000000018  12                8
       [0000000000000002]: ALLOC
  [11] .init
       PROGBITS               PROGBITS         0000000000400390  0000000000000390  0
       0000000000000018 0000000000000000  0                 4
       [0000000000000006]: ALLOC, EXEC
  [12] .plt
       PROGBITS               PROGBITS         00000000004003a8  00000000000003a8  0
       0000000000000030 0000000000000010  0                 4
       [0000000000000006]: ALLOC, EXEC
  [13] .text
       PROGBITS               PROGBITS         00000000004003e0  00000000000003e0  0
       00000000000001d8 0000000000000000  0                 16
       [0000000000000006]: ALLOC, EXEC
  [14] .fini
       PROGBITS               PROGBITS         00000000004005b8  00000000000005b8  0
       000000000000000e 0000000000000000  0                 4
       [0000000000000006]: ALLOC, EXEC
  [15] .rodata
       PROGBITS               PROGBITS         00000000004005c8  00000000000005c8  0
       000000000000001c 0000000000000000  0                 8
       [0000000000000002]: ALLOC
  [16] .eh_frame_hdr
       PROGBITS               PROGBITS         00000000004005e4  00000000000005e4  0
       0000000000000024 0000000000000000  0                 4
       [0000000000000002]: ALLOC
  [17] .eh_frame
       PROGBITS               PROGBITS         0000000000400608  0000000000000608  0
       000000000000007c 0000000000000000  0                 8
       [0000000000000002]: ALLOC
  [18] .ctors
       PROGBITS               PROGBITS         0000000000600688  0000000000000688  0
       0000000000000010 0000000000000000  0                 8
       [0000000000000003]: WRITE, ALLOC
  [19] .dtors
       PROGBITS               PROGBITS         0000000000600698  0000000000000698  0
       0000000000000010 0000000000000000  0                 8
       [0000000000000003]: WRITE, ALLOC
  [20] .jcr
       PROGBITS               PROGBITS         00000000006006a8  00000000000006a8  0
       0000000000000008 0000000000000000  0                 8
       [0000000000000003]: WRITE, ALLOC
  [21] .dynamic
       DYNAMIC                DYNAMIC          00000000006006b0  00000000000006b0  6
       0000000000000190 0000000000000010  0                 8
       [0000000000000003]: WRITE, ALLOC
  [22] .got
       PROGBITS               PROGBITS         0000000000600840  0000000000000840  0
       0000000000000008 0000000000000008  0                 8
       [0000000000000003]: WRITE, ALLOC
  [23] .got.plt
       PROGBITS               PROGBITS         0000000000600848  0000000000000848  0
       0000000000000028 0000000000000008  0                 8
       [0000000000000003]: WRITE, ALLOC
  [24] .data
       PROGBITS               PROGBITS         0000000000600870  0000000000000870  0
       0000000000000004 0000000000000000  0                 4
       [0000000000000003]: WRITE, ALLOC
  [25] .bss
       NOBITS                 NOBITS           0000000000600878  0000000000000874  0
       0000000000000010 0000000000000000  0                 8
       [0000000000000003]: WRITE, ALLOC
  [26] .comment
       PROGBITS               PROGBITS         0000000000000000  0000000000000874  0
       000000000000002d 0000000000000001  0                 1
       [0000000000000030]: MERGE, STRINGS
  [27] .shstrtab
       STRTAB                 STRTAB           0000000000000000  00000000000008a1  0
       00000000000000fe 0000000000000000  0                 1
       [0000000000000000]: 
  [28] .symtab
       SYMTAB                 SYMTAB           0000000000000000  0000000000001120  29
       0000000000000600 0000000000000018  46                8
       [0000000000000000]: 
  [29] .strtab
       STRTAB                 STRTAB           0000000000000000  0000000000001720  0
       00000000000001f0 0000000000000000  0                 1
       [0000000000000000]: 

readelf -w

$ cat readelf_w 
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_nop
  DW_CFA_nop

00000018 0000001c 0000001c FDE cie=00000000 pc=004004c4..004004d9
  DW_CFA_advance_loc: 1 to 004004c5
  DW_CFA_def_cfa_offset: 16
  DW_CFA_offset: r6 (rbp) at cfa-16
  DW_CFA_advance_loc: 3 to 004004c8
  DW_CFA_def_cfa_register: r6 (rbp)
  DW_CFA_advance_loc: 16 to 004004d8
  DW_CFA_def_cfa: r7 (rsp) ofs 8
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop

00000038 00000014 0000003c FDE cie=00000000 pc=004004e0..004004e2
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop

00000050 00000024 00000054 FDE cie=00000000 pc=004004f0..00400579
  DW_CFA_advance_loc: 17 to 00400501
  DW_CFA_offset: r12 (r12) at cfa-40
  DW_CFA_offset: r6 (rbp) at cfa-48
  DW_CFA_advance_loc: 31 to 00400520
  DW_CFA_def_cfa_offset: 64
  DW_CFA_offset: r3 (rbx) at cfa-56
  DW_CFA_offset: r15 (r15) at cfa-16
  DW_CFA_offset: r14 (r14) at cfa-24
  DW_CFA_offset: r13 (r13) at cfa-32
  DW_CFA_advance_loc1: 88 to 00400578
  DW_CFA_def_cfa_offset: 8
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop

00000078 ZERO terminator
⚠️ **GitHub.com Fallback** ⚠️