[ELF] Allow R_386_GOTOFF from .debug_info
authorFangrui Song <i@maskray.me>
Thu, 4 Feb 2021 17:17:47 +0000 (09:17 -0800)
committerFangrui Song <i@maskray.me>
Thu, 4 Feb 2021 17:17:47 +0000 (09:17 -0800)
commitb3165a70ae83b46dc145f335dfa9690ece361e92
tree80d4b7e64ca6204f7767a3e98fe6dc16b2523d45
parent01b3627c71e99ba3dc533fa42df989e228b007b0
[ELF] Allow R_386_GOTOFF from .debug_info

In GCC emitted .debug_info sections, R_386_GOTOFF may be used to
relocate DW_AT_GNU_call_site_value values
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98946).

R_386_GOTOFF (`S + A - GOT`) is one of the `isStaticLinkTimeConstant` relocation
type which is not PC-relative, so it can be used from non-SHF_ALLOC sections. We
current allow new relocation types as needs come. The diagnostic has caught some
bugs in the past.

Differential Revision: https://reviews.llvm.org/D95994
lld/ELF/InputSection.cpp
lld/test/ELF/non-abs-reloc.s