https://sourceware.org/bugzilla/show_bug.cgi?id=28873
--- Comment #5 from Di Chen <dichen at redhat dot com> --- Created attachment 14600 --> https://sourceware.org/bugzilla/attachment.cgi?id=14600&action=edit readelf: display dynamic symtab without section headers ``` # failed to print symtab of a binary which has section headers removed. $ ./src/readelf -s ~/test/a.out # it works with "-D" for a binary which has section headers removed. $ ./src/readelf -Ds ~/test/a.out 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UNDEF 1: 0000000000000000 0 FUNC GLOBAL DEFAULT UNDEF __libc_start_main@GLIBC_2.34 (2) 2: 0000000000000000 0 NOTYPE WEAK DEFAULT UNDEF __gmon_start__ ``` It works well for binaries which has SYMTAB section right after STRTAB section. ``` $ readelf -Dd ~/test/a.out Dynamic section at offset 0x2e60 contains 20 entries: Tag Type Name/Value 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] 0x000000000000000c (INIT) 0x401000 0x000000000000000d (FINI) 0x401124 0x0000000000000019 (INIT_ARRAY) 0x403e50 0x000000000000001b (INIT_ARRAYSZ) 8 (bytes) 0x000000000000001a (FINI_ARRAY) 0x403e58 0x000000000000001c (FINI_ARRAYSZ) 8 (bytes) 0x000000006ffffef5 (GNU_HASH) 0x4003c0 0x0000000000000005 (STRTAB) 0x400428 0x0000000000000006 (SYMTAB) 0x4003e0 0x000000000000000a (STRSZ) 55 (bytes) 0x000000000000000b (SYMENT) 24 (bytes) 0x0000000000000015 (DEBUG) 0x0 0x0000000000000007 (RELA) 0x400488 0x0000000000000008 (RELASZ) 48 (bytes) 0x0000000000000009 (RELAENT) 24 (bytes) 0x000000006ffffffe (VERNEED) 0x400468 0x000000006fffffff (VERNEEDNUM) 1 0x000000006ffffff0 (VERSYM) 0x400460 0x0000000000000000 (NULL) 0x0 ``` Because I use offset difference between SYMTAB and STRTAB to get the symbol table entry number. ``` size_t syments = ((offs[i_strtab] - offs[i_symtab]) / gelf_fsize(ebl->elf, ELF_T_SYM, 1, EV_CURRENT)); ``` -- You are receiving this mail because: You are on the CC list for the bug.