From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-x1136.google.com (mail-yw1-x1136.google.com [IPv6:2607:f8b0:4864:20::1136]) by sourceware.org (Postfix) with ESMTPS id A54873852655; Fri, 7 Jul 2023 15:26:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A54873852655 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yw1-x1136.google.com with SMTP id 00721157ae682-579de633419so26521307b3.3; Fri, 07 Jul 2023 08:26:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688743607; x=1691335607; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ErLrAv/++Hs9ND8JknX+kGv0HvHaqir6OSbGTgIzgf0=; b=eOA079fQKqR3UrNQh4w3THv5mi6ZsPa/kuE7dhynf92J/1hwuywxQsbcQ28VytzYz0 O+Npe6/7W6HL3CpHvnK/ym1SLWaNUi1HjEe6ffX/7Bm2aPVb2ZiN02HSDTOdViZ7kC8h 7u47T+YZCqgDEIDfaxo8N8eTyPK15G4o+88kyVnvI3/Syj3FPqtZRIod4Kz6YyNgD+I2 8eSY339hXS/AdagziYluvA+rwaIwE9pYIbldZlFZlSF6tv4Zh7kjNDhC2oFJJlGE/Bjs C4ARqh2CJ2/szBPqVGy58zd+8n97C0XV4NltJZ1+BhAmNLcAR42O7CMm7ikmry3tSvmn Gr1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688743607; x=1691335607; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ErLrAv/++Hs9ND8JknX+kGv0HvHaqir6OSbGTgIzgf0=; b=FdO6Zo4MI3bLybi+1OvGoP9EFeK+gC1MC3/5pdNrZ7es+iDgYRtNqn8A7IyylM9HCN o2HLfZmkwBBGw0dNIX00DjNhYK9GTHa5tllxGnT72lYN3aCyhsHd7KapalyDBTPaq78l c7fyvR8l7lcnUvxUgnQUu6bNSn221dk3xN0WXvHvQ6ciRPUN1Cw+oxiRiksbNu0zMk6V UejdoW+Y1iGflgoUX3muUm9C045XjStofHrRPa2ie8szU5JVYI85vLCIdAE4kx1aL+TX JwTInJ6wUbmvYezxPw4W+Xf6IBgFNlEDTNNcke1pOqIhpKG4sudNlS/3aBwJjEI1yyt7 D7PA== X-Gm-Message-State: ABy/qLbhmN2TMIwPrHy/Alom/ohfG2/hHsqPnEvbTPugS3FbLeH7Xa6+ qAuJd3LRADC215JFnN9Svgw/qE15rx2LhF7zl2Y= X-Google-Smtp-Source: APBJJlH2eVN9CRD6o2+XzNaIrP0jgow47MR6r0uj+5m+ERBCpH7Xsr7wIUTTYDWRUZjs5URLnRbGr35jlsTHWeuP/3U= X-Received: by 2002:a0d:d706:0:b0:568:8b24:fd5f with SMTP id z6-20020a0dd706000000b005688b24fd5fmr5313677ywd.7.1688743606952; Fri, 07 Jul 2023 08:26:46 -0700 (PDT) MIME-Version: 1.0 References: <20230606175846.399377-1-hjl.tools@gmail.com> <20230606175846.399377-4-hjl.tools@gmail.com> In-Reply-To: From: "H.J. Lu" Date: Fri, 7 Jul 2023 08:26:11 -0700 Message-ID: Subject: Re: [PATCH v4 3/7] bfd: Improve nm and objdump without section header To: Simon Marchi Cc: binutils@sourceware.org, Alan Modra , Florian Weimer , Kaylee Blake , "gdb-patches@sourceware.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3015.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, Jun 30, 2023 at 7:12=E2=80=AFPM Simon Marchi wrote: > > On 6/6/23 13:58, H.J. Lu wrote: > > When there is no section header in an executable or shared library, we > > reconstruct dynamic symbol table from the PT_DYNAMIC segment, which > > contains DT_HASH/DT_GNU_HASH/DT_MIPS_XHASH, DT_STRTAB, DT_SYMTAB, > > DT_STRSZ, and DT_SYMENT entries, to improve nm and objdump. For DT_HAS= H, > > the number of dynamic symbol table entries equals the number of chains. > > For DT_GNU_HASH/DT_MIPS_XHASH, only defined symbols with non-STB_LOCAL > > indings are in hash table. Since DT_GNU_HASH/DT_MIPS_XHASH place all > > symbols with STB_LOCAL binding before symbols with other bindings and > > all undefined symbols defined ones in dynamic symbol table, the highest > > symbol index in DT_GNU_HASH/DT_MIPS_XHASH is the highest dynamic symbol > > table index. We can also get symbol version from DT_VERSYM, DT_VERDEF > > and DT_VERNEED entries. > > > > dt_symtab, dt_versym, dt_verdef, dt_verneed, dt_symtab_count, > > dt_verdef_count, dt_verneed_count and dt_strtab are added to > > elf_obj_tdata to store dynamic symbol table information. > > Hi, > > This broke a GDB test: > > gdb/ $ make check TESTS=3D"gdb.base/eu-strip-infcall.exp" > FAIL: gdb.base/eu-strip-infcall.exp: gdb_breakpoint: set breakpoint a= t main > > Looking at gdb/testsuite/gdb.log, before: > > (gdb) file /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb= .base/eu-strip-infcall/eu-strip-infcall > > Reading symbols from /home/smarchi/build/binutils-gdb/gdb/testsuite/o= utputs/gdb.base/eu-strip-infcall/eu-strip-infcall... > > Reading symbols from /home/smarchi/build/binutils-gdb/gdb/testsuite/o= utputs/gdb.base/eu-strip-infcall/eu-strip-infcall.debug... > > > and after: > > (gdb) file /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.bas= e/eu-strip-infcall/eu-strip-infcall > > Reading symbols from /home/smarchi/build/binutils-gdb/gdb/testsuite/outpu= ts/gdb.base/eu-strip-infcall/eu-strip-infcall... > > warning: `/home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.base= /eu-strip-infcall/eu-strip-infcall.debug': can't read symbols: file format = not recognized. > > (No debugging symbols found in /home/smarchi/build/binutils-gdb/gdb/tests= uite/outputs/gdb.base/eu-strip-infcall/eu-strip-infcall) > > > Can you please check if it's a problem with your patch, or if it's really= a malformed file? > > Thanks, > > Simon It works for me: $ make check TESTS=3D"gdb.base/eu-strip-infcall.exp" .... =3D=3D=3D gdb Summary =3D=3D=3D # of expected passes 1 My change only impacts files without section header. eu-strip-infcall.exp d= oes "eu-strip -f ${binfile}.debug $binfile", which doesn't remove section heade= r. --=20 H.J.