[PATCH] D87899: [llvm-readobj/elf] - Stop reporting invalid extended indexes in warnings for unnamed section symbols.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 18 05:37:23 PDT 2020


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
Herald added subscribers: rupprecht, arphaman, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
grimar requested review of this revision.

We have an issue with `getFullSymbolName`: when it is used for STT_SECTION unnamed symbols, it calls
`getSymbolSectionIndex`, which takes a symbol and a first symbol as arguments.
It uses the first symbol to calculate a symbol index for error reporting.
It is only used for symbols which has st_shndx == SHN_XINDEX.

The problem is that `getFullSymbolName` assumes that the first symbol is
always a first symbol in the `.symtab`, what is wrong.
We might calculate and report a wrong index currently.
I've added a test case revealing that.

This patch adds the "first symbol" argument to `getFullSymbolName` signature,
what fixes the issue.

Depends on D87764 <https://reviews.llvm.org/D87764>.


https://reviews.llvm.org/D87899

Files:
  llvm/test/tools/llvm-readobj/ELF/dyn-symbols.test
  llvm/tools/llvm-readobj/ELFDumper.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87899.292768.patch
Type: text/x-patch
Size: 8332 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200918/a4a15203/attachment.bin>


More information about the llvm-commits mailing list