From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Miroslav Benes <mbenes@suse.cz>
Cc: Kristen Carlson Accardi <kristen@linux.intel.com>,
Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] objtool: support symtab_shndx during dump
Date: Fri, 4 Sep 2020 09:17:20 -0500 [thread overview]
Message-ID: <20200904141720.qdnesfk3dxl3rlpz@treble> (raw)
In-Reply-To: <alpine.LSU.2.21.2009040921470.22451@pobox.suse.cz>
On Fri, Sep 04, 2020 at 09:54:29AM +0200, Miroslav Benes wrote:
> On Thu, 3 Sep 2020, Josh Poimboeuf wrote:
>
> > On Wed, Aug 12, 2020 at 10:57:11AM -0700, Kristen Carlson Accardi wrote:
> >
> > > if (GELF_ST_TYPE(sym.st_info) == STT_SECTION) {
> > > - scn = elf_getscn(elf, sym.st_shndx);
> > > + if ((sym.st_shndx > SHN_UNDEF &&
> > > + sym.st_shndx < SHN_LORESERVE) ||
> > > + (xsymtab && sym.st_shndx == SHN_XINDEX)) {
> > > + if (sym.st_shndx != SHN_XINDEX)
> > > + shndx = sym.st_shndx;
> >
> > The sym.st_shndx checks are redundant, if 'sym.st_shndx == SHN_XINDEX'
> > then 'sym.st_shndx != SHN_XINDEX' can't be true.
>
> It is probably a copy-paste from read_symbols() in elf.c, where the logic
> is different.
Yeah.
> > Actually I think this can be even further simplified to something like
> >
> > if (!shndx)
> > shndx = sym.st_shndx;
>
> This relies on the fact that gelf_getsymshndx() always initializes shndx,
> no? I think it would be better to initialize it in orc_dump() too. Safer
> and easier to read. It applies to Kristen's patch as well. I missed that.
Agreed.
--
Josh
prev parent reply other threads:[~2020-09-04 14:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-12 17:57 [PATCH] objtool: support symtab_shndx during dump Kristen Carlson Accardi
2020-09-03 11:43 ` Miroslav Benes
2020-09-03 15:35 ` Josh Poimboeuf
2020-09-04 7:54 ` Miroslav Benes
2020-09-04 14:17 ` Josh Poimboeuf [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200904141720.qdnesfk3dxl3rlpz@treble \
--to=jpoimboe@redhat.com \
--cc=kristen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).