$ readelf -h SimpleSection.o ELF Header: Magic: 7f454c 46020101000000000000000000 Class: ELF64 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: REL (Relocatable file) Machine: Advanced Micro Devices X86-64 Version: 0x1 Entry point address: 0x0 Start of program headers: 0 (bytes into file) Start of section headers: 1104 (bytes into file) Flags: 0x0 Size of this header: 64 (bytes) Size of program headers: 0 (bytes) Number of program headers: 0 Size of section headers: 64 (bytes) Number of section headers: 13 Section header string table index: 12
$ readelf -S SimpleSection.o There are 13 section headers, starting at offset 0x450:
Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align [ 0] NULL000000000000000000000000 00000000000000000000000000000000000 [ 1] .text PROGBITS 000000000000000000000040 00000000000000570000000000000000 AX 001 [ 2] .rela.text RELA 000000000000000000000340 00000000000000780000000000000018 I 1018 [ 3] .data PROGBITS 000000000000000000000098 00000000000000080000000000000000 WA 004 [ 4] .bss NOBITS 0000000000000000000000a0 00000000000000040000000000000000 WA 004 [ 5] .rodata PROGBITS 0000000000000000000000a0 00000000000000040000000000000000 A 001 [ 6] .comment PROGBITS 0000000000000000000000a4 000000000000002a 0000000000000001 MS 001 [ 7] .note.GNU-stack PROGBITS 0000000000000000000000ce 00000000000000000000000000000000001 [ 8] .eh_frame PROGBITS 0000000000000000000000d0 00000000000000580000000000000000 A 008 [ 9] .rela.eh_frame RELA 0000000000000000000003b8 00000000000000300000000000000018 I 1088 [10] .symtab SYMTAB 000000000000000000000128 0000000000000198000000000000001811118 [11] .strtab STRTAB 0000000000000000000002c0 000000000000007c 0000000000000000001 [12] .shstrtab STRTAB 0000000000000000000003e8 00000000000000610000000000000000001 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings), I (info), L (link order), O (extra OS processing required), G (group), T (TLS), C (compressed), x (unknown), o (OS specific), E (exclude), l (large), p (processor specific)
Symbol table '.symtab' contains 17 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000000000000 NOTYPE LOCAL DEFAULT UND 1: 00000000000000000 FILE LOCAL DEFAULT ABS SimpleSection.c 2: 00000000000000000 SECTION LOCAL DEFAULT 1 3: 00000000000000000 SECTION LOCAL DEFAULT 3 4: 00000000000000000 SECTION LOCAL DEFAULT 4 5: 00000000000000000 SECTION LOCAL DEFAULT 5 6: 00000000000000044 OBJECT LOCAL DEFAULT 3 static_var.1802 7: 00000000000000004 OBJECT LOCAL DEFAULT 4 static_var2.1803 8: 00000000000000000 SECTION LOCAL DEFAULT 7 9: 00000000000000000 SECTION LOCAL DEFAULT 8 10: 00000000000000000 SECTION LOCAL DEFAULT 6 11: 00000000000000004 OBJECT GLOBAL DEFAULT 3 global_init_var 12: 00000000000000044 OBJECT GLOBAL DEFAULT COM global_uninit_var 13: 000000000000000036 FUNC GLOBAL DEFAULT 1 func1 14: 00000000000000000 NOTYPE GLOBAL DEFAULT UND _GLOBAL_OFFSET_TABLE_ 15: 00000000000000000 NOTYPE GLOBAL DEFAULT UND printf 16: 000000000000002451 FUNC GLOBAL DEFAULT 1 main