This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Improve sh_info=0 and sh_info>=num_sections diagnostic for SHT_REL/SHT_RELA
ClosedPublic

Authored by MaskRay on Nov 9 2021, 12:16 AM.

Details

Summary

PR52408 reported an sh_info=0 instance. I have seen sh_info=0
independently before.

sh_info>=num_sections is probably very rare. Just use one diagnostic for
the two types of errors.

Delete invalid-relocations.test which is covered by invalid/bad-reloc-target.test

Diff Detail

Event Timeline

MaskRay created this revision.Nov 9 2021, 12:16 AM
MaskRay requested review of this revision.Nov 9 2021, 12:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 9 2021, 12:16 AM
MaskRay updated this revision to Diff 385715.Nov 9 2021, 12:18 AM

fatal -> error

MaskRay added inline comments.Nov 9 2021, 12:20 AM
lld/ELF/InputFiles.cpp
839–840

The hack was from D16898.

jhenderson accepted this revision.Nov 9 2021, 1:26 AM

One suggestion, otherwise LGTM.

lld/ELF/InputFiles.cpp
844

I feel like it might be useful to include the section name here, if it's practical.

This revision is now accepted and ready to land.Nov 9 2021, 1:26 AM
MaskRay updated this revision to Diff 385863.Nov 9 2021, 9:53 AM

add section name

This revision was landed with ongoing or failed builds.Nov 9 2021, 9:54 AM
This revision was automatically updated to reflect the committed changes.
lld/ELF/InputFiles.cpp