[ELF] Improve sh_info=0 and sh_info>=num_sections diagnostic for SHT_REL/SHT_RELA
authorFangrui Song <i@maskray.me>
Tue, 9 Nov 2021 17:54:12 +0000 (09:54 -0800)
committerFangrui Song <i@maskray.me>
Tue, 9 Nov 2021 17:54:12 +0000 (09:54 -0800)
commit213d1849a4b9f5579c964086097391907df37a04
treeb4e70cb13f142ca3a670a74ef84fcc183e2ef92c
parent384b4e0d332ec6fc4f9fc279d12aadc162eaf3a0
[ELF] Improve sh_info=0 and sh_info>=num_sections diagnostic for SHT_REL/SHT_RELA

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

Differential Revision: https://reviews.llvm.org/D113466
lld/ELF/InputFiles.cpp
lld/ELF/InputFiles.h
lld/test/ELF/invalid-relocations.test [deleted file]
lld/test/ELF/invalid/bad-reloc-target.test