[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LSU.2.21.2009040921470.22451@pobox.suse.cz>
Date: Fri, 4 Sep 2020 09:54:29 +0200 (CEST)
From: Miroslav Benes <mbenes@...e.cz>
To: Josh Poimboeuf <jpoimboe@...hat.com>
cc: Kristen Carlson Accardi <kristen@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] objtool: support symtab_shndx during dump
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.
> 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.
Miroslav
Powered by blists - more mailing lists