This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readelf/obj] - Refine the implementation of `printGNUVersionSectionProlog`
ClosedPublic

Authored by grimar on Nov 23 2020, 6:58 AM.

Details

Summary

This:

  1. Changes its signature.
  2. Refines the name of local variable (SymTabName->LinkedSecName, because SHT_GNU_verneed/SHT_GNU_verdef are linked with the string table, not with the symbol table).
  3. Stops using the unwrapOrError inside.

Diff Detail

Event Timeline

grimar created this revision.Nov 23 2020, 6:58 AM
Herald added a project: Restricted Project. · View Herald Transcript
grimar requested review of this revision.Nov 23 2020, 6:58 AM
MaskRay accepted this revision.Nov 23 2020, 5:53 PM

LGTM. binutils/readelf.c:process_version_sections uses sh_link as well.

This revision is now accepted and ready to land.Nov 23 2020, 5:53 PM
jhenderson added inline comments.Nov 24 2020, 12:46 AM
llvm/test/tools/llvm-readobj/ELF/verdef-invalid.test
77
llvm/test/tools/llvm-readobj/ELF/verneed-invalid.test
403
llvm/test/tools/llvm-readobj/ELF/versym-invalid.test
81–82

This provided incidental coverage of the section having sh_link 0 and therefore that the target section was empty. Is this covered elsewhere/worth continuing to cover (with a dedicated test case)?

126
grimar updated this revision to Diff 307269.Nov 24 2020, 12:57 AM
grimar marked 4 inline comments as done.
  • Addressed review comments.
llvm/test/tools/llvm-readobj/ELF/versym-invalid.test
81–82

We explicitly check the sh_link == 0 case on line ~30:

# RUN: yaml2obj --docnum=1 -DLINK=0x0 %s -o %t2
# RUN: llvm-readelf -V %t2 2>&1 | FileCheck -DFILE=%t2 %s --check-prefix=INVALID-SYMBOL-TABLE-GNU
# RUN: llvm-readobj -V %t2 2>&1 | FileCheck -DFILE=%t2 %s --check-prefix=INVALID-SYMBOL-TABLE-LLVM
jhenderson accepted this revision.Nov 24 2020, 12:59 AM

Okay, LGTM.