There are 14 section headers, starting at offset 0x3c8:
Section Headers: [Nr] Name Type Address Off Size ES Flg Lk Inf Al [ 0] NULL 0000000000000000 000000 000000 00 0 0 0 [ 1] .text PROGBITS 0000000000000000 000040 000022 00 AX 0 0 1 [ 2] .rela.text RELA 0000000000000000 000308 000030 18 I 11 1 8 [ 3] .data PROGBITS 0000000000000000 000064 000008 00 WA 0 0 4 [ 4] .bss NOBITS 0000000000000000 00006c 000004 00 WA 0 0 4 [ 5] .rodata PROGBITS 0000000000000000 00006c 000011 00 A 0 0 4 [ 6] .comment PROGBITS 0000000000000000 00007d 00002c 01 MS 0 0 1 [ 7] .note.GNU-stack PROGBITS 0000000000000000 0000a9 000000 00 0 0 1 [ 8] .note.gnu.property NOTE 0000000000000000 0000b0 000020 00 A 0 0 8 [ 9] .eh_frame PROGBITS 0000000000000000 0000d0 000038 00 A 0 0 8 [10] .rela.eh_frame RELA 0000000000000000 000338 000018 18 I 11 9 8 [11] .symtab SYMTAB 0000000000000000 000108 000198 18 12 12 8 [12] .strtab STRTAB 0000000000000000 0002a0 000068 00 0 0 1 [13] .shstrtab STRTAB 0000000000000000 000350 000074 00 0 0 1 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)
read symbol by
readelf -sW main.o
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Symbol table '.symtab' contains 17 entries: Num: Value Size Type Bind Vis Ndx Name 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND 1: 0000000000000000 0 FILE LOCAL DEFAULT ABS main.c 2: 0000000000000000 0 SECTION LOCAL DEFAULT 1 3: 0000000000000000 0 SECTION LOCAL DEFAULT 3 4: 0000000000000000 0 SECTION LOCAL DEFAULT 4 5: 0000000000000000 0 SECTION LOCAL DEFAULT 5 6: 0000000000000000 4 OBJECT LOCAL DEFAULT 4 static_var_uninit.2318 7: 0000000000000004 4 OBJECT LOCAL DEFAULT 3 static_var.2317 8: 0000000000000000 0 SECTION LOCAL DEFAULT 7 9: 0000000000000000 0 SECTION LOCAL DEFAULT 8 10: 0000000000000000 0 SECTION LOCAL DEFAULT 9 11: 0000000000000000 0 SECTION LOCAL DEFAULT 6 12: 0000000000000000 4 OBJECT GLOBAL DEFAULT 3 global_init 13: 0000000000000000 4 OBJECT GLOBAL DEFAULT 5 global_const 14: 0000000000000000 34 FUNC GLOBAL DEFAULT 1 main 15: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND _GLOBAL_OFFSET_TABLE_ 16: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND puts
Ndx means the idx in Nr
or use nm
nm main.o
1 2 3 4 5 6 7
0000000000000000 R global_const 0000000000000000 D global_init U _GLOBAL_OFFSET_TABLE_ 0000000000000000 T main U puts 0000000000000004 d static_var.2317 0000000000000000 b static_var_uninit.2318
SYMBOL TABLE: 0000000000000000 l df *ABS* 0000000000000000 main.c 0000000000000000 l d .text 0000000000000000 .text 0000000000000000 l d .data 0000000000000000 .data 0000000000000000 l d .bss 0000000000000000 .bss 0000000000000000 l d .rodata 0000000000000000 .rodata 0000000000000000 l O .bss 0000000000000004 static_var_uninit.2318 0000000000000004 l O .data 0000000000000004 static_var.2317 0000000000000000 l d .note.GNU-stack 0000000000000000 .note.GNU-stack 0000000000000000 l d .note.gnu.property 0000000000000000 .note.gnu.property 0000000000000000 l d .eh_frame 0000000000000000 .eh_frame 0000000000000000 l d .comment 0000000000000000 .comment 0000000000000000 g O .data 0000000000000004 global_init 0000000000000000 g O .rodata 0000000000000004 global_const 0000000000000000 g F .text 0000000000000022 main 0000000000000000 *UND* 0000000000000000 _GLOBAL_OFFSET_TABLE_ 0000000000000000 *UND* 0000000000000000 puts