From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DF322385841A; Mon, 16 Jan 2023 13:30:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DF322385841A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673875816; bh=oJra/K+xMrBgELmO2McVOrr+FhlyEE3aDEwSiVUzFOk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ETrxLPyUj6/1vOLRuQC81IDGmEncDDYY4AyG9LxqkNDUNvvEUj0zK5sY09e0RNFKV lJfspxJds25qcu8YAylau5PKDoLDZFSaomiSXAbFaY0GKxOKYE8Hu0JlqfxoV9717v 63ofKbdRPuJF1Two5+BkwO8VJmE/dgtGt5q8j5ks= From: "dichen at redhat dot com" To: elfutils-devel@sourceware.org Subject: [Bug tools/28873] Implement eu-readelf -D Date: Mon, 16 Jan 2023 13:30:16 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: elfutils X-Bugzilla-Component: tools X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dichen at redhat dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: dichen at redhat dot com X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D28873 --- Comment #5 from Di Chen --- Created attachment 14600 --> https://sourceware.org/bugzilla/attachment.cgi?id=3D14600&action=3Ded= it 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=20 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UNDEF=20 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 sect= ion. ``` $ readelf -Dd ~/test/a.out=20 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 =3D ((offs[i_strtab] - offs[i_symtab]) / gelf_fsize(ebl->elf, ELF_T_SYM, 1, EV_CURRENT)); ``` --=20 You are receiving this mail because: You are on the CC list for the bug.=