[ELF] Mention section name for STT_SECTION in reportRangeError()
authorFangrui Song <i@maskray.me>
Fri, 3 Mar 2023 20:35:05 +0000 (12:35 -0800)
committerFangrui Song <i@maskray.me>
Fri, 3 Mar 2023 20:35:05 +0000 (12:35 -0800)
commitffa11183303289654d26b8f761dcf54e611058ca
tree78d173ddbcf914ae59180cb15d5b8aa8f598cb66
parent3a748cd01bbf4229b4a6bda208c8b33e96dfba6e
[ELF] Mention section name for STT_SECTION in reportRangeError()

D73518 mentioned non-STT_SECTION symbol names. This patch extends the code to
handle STT_SECTION symbols, where we report the section name.
This change helps at least the following cases with very little code.

* Whether a out-of-range relocation is due to code or data.
* For a relocation in .debug_info, which referenced `.debug_*` section (due to DWARF32 limitation) causes the problem.

Reviewed By: peter.smith

Differential Revision: https://reviews.llvm.org/D145199
lld/ELF/Relocations.cpp
lld/test/ELF/aarch64-movw-error.s
lld/test/ELF/linkerscript/eh-frame-reloc-out-of-range.test
lld/test/ELF/ppc64-reloc-pcrel34-overflow.s
lld/test/ELF/x86-64-reloc-range.s