From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 07BD23858C60; Fri, 3 Feb 2023 18:24:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 07BD23858C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675448681; bh=JWxXSG5rDj+0gSW3ntI3l4uuQ28Yo8wn9sBVfvGd0yo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=fyh6HW2vjhoo7uhqwd4TlStswlMVli582c+iIIweh6OBWe8uSD/qOjVAtxfsoAd5v pP/nDO9M9bsmlEad7KG4AMMyHVNTNdZOtY2L1kZKUN0r/DXpjMZM1lkNJc/4dhoSIz o4ukSmF9dYF579ksE3cpsBL8TlRf28B+d1rNA4AU= From: "amerey at redhat dot com" To: elfutils-devel@sourceware.org Subject: [Bug tools/28873] Implement eu-readelf -D Date: Fri, 03 Feb 2023 18:24:40 +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: amerey 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: cc 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 Aaron Merey changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |amerey at redhat dot com --- Comment #7 from Aaron Merey --- (In reply to Di Chen from comment #5) > Because I use offset difference between SYMTAB and STRTAB to get the symb= ol > table entry number. > ``` > size_t syments =3D ((offs[i_strtab] - offs[i_symtab]) / > gelf_fsize(ebl->elf, ELF_T_SYM, 1, EV_CURRENT)); > ``` > > For a binary with SYMTAB STRTAB having different order, like upside down,= or > having other section in between. eg. > [...] > It will mess up the syments (symbol table entry number) calculation. This raises an interesting question: how do you calculate the number of sym= bols in .dynsym without using section headers? I figured there'd some kind of "DT_SYMTABNUM" value somewhere but unfortuna= tely the answer doesn't appear to be so straightforward. Judging from the binutils readelf source code you need to use information in the .hash and .gnu.hash sections to calculate the number of entries.=20 To complicate things even more, a binary can contain either .hash or .gnu.h= ash or both and computing the number of .dynsym entries is different in each ca= se. See binutils/readelf.c:get_num_dynamic_syms, you may need to implement some= of this in your patch. --=20 You are receiving this mail because: You are on the CC list for the bug.=