This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readelf/obj] - Fix extended section symbol indices printed in warnings for MIPS GOT/PLT entries.
ClosedPublic

Authored by grimar on Sep 22 2020, 5:21 AM.

Details

Summary

Recent refactoring introduced a symbol index argument for getFullSymbolName method,
which is only used for reporting error messages about invalid extended symbol indexes.

There are few issues in the implementation and we don't report correct symbol indices
when dumping MIPS GOT/PLT entries currently.

This patch adds test cases and fixes the issue.

Diff Detail

Event Timeline

grimar created this revision.Sep 22 2020, 5:21 AM
grimar requested review of this revision.Sep 22 2020, 5:21 AM
jhenderson accepted this revision.Sep 23 2020, 12:52 AM

Looks good, aside from one question.

llvm/tools/llvm-readobj/ELFDumper.cpp
6707–6708

I don't know MIPS at all. Is getGotDynSyms() equivalent to dynamic_symbols()?

This revision is now accepted and ready to land.Sep 23 2020, 12:52 AM
grimar added inline comments.Sep 23 2020, 2:05 AM
llvm/tools/llvm-readobj/ELFDumper.cpp
6707–6708

No. getGotDynSyms was introduced by me in D87899 and it was a mistake. It returns GotDynSyms, which is:

GotDynSyms = DynSyms.drop_front(*DtGotSym);

where DynSyms == dynamic_symbols()

In this place we want to pass symbol index, so should really use dynamic_symbols()[0] instead of GotDynSyms[0].

This issue was catched by the test case.

This revision was automatically updated to reflect the committed changes.
grimar marked an inline comment as done.