This is an archive of the discontinued LLVM Phabricator instance.

[llvm-objdump] -r: print non-SHF_ALLOC relocations for non-ET_REL files
ClosedPublic

Authored by MaskRay on Jun 30 2022, 5:48 PM.

Details

Summary

ET_EXEC and ET_DYN files may contain non-SHF_ALLOC relocation sections
(e.g. ld --emit-relocs). Match GNU objdump by dumping them.

  • Remove Object/dynamic-reloc.test. Replace it with a -r RUN line in dynamic-relocs.test
  • Update relocations-in-nonreloc.test to set sh_link/sh_info. GNU objdump seems to ignore a SHT_REL/SHT_RELA section not linking to SHT_SYMTAB. The test did not test what it intended to test.

Fix https://github.com/llvm/llvm-project/issues/41246

Diff Detail

Event Timeline

MaskRay created this revision.Jun 30 2022, 5:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 30 2022, 5:48 PM
MaskRay requested review of this revision.Jun 30 2022, 5:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 30 2022, 5:48 PM
jhenderson accepted this revision.Jul 1 2022, 1:20 AM

Looks good with 2 nits.

llvm/test/tools/llvm-objdump/ELF/relocations-in-nonreloc.test
4–9

Nits: 1) you've only got one YAML block, so you don't need the --docnum option. 2) If the third case is just to sanity check the dumping matches, you should consider adding an additional comment to note this.

This revision is now accepted and ready to land.Jul 1 2022, 1:20 AM
MaskRay updated this revision to Diff 441706.Jul 1 2022, 9:05 AM
MaskRay marked an inline comment as done.

improve test

This revision was landed with ongoing or failed builds.Jul 1 2022, 9:08 AM
This revision was automatically updated to reflect the committed changes.
llvm/test/tools/llvm-objdump/ELF/relocations-in-nonreloc.test