$OpenBSD: patch-tools_lld_ELF_InputSection_cpp,v 1.7 2021/08/14 02:46:18 jca Exp $

[ELF] Allow R_386_GOTOFF from .debug_info.

Index: tools/lld/ELF/InputSection.cpp
--- tools/lld/ELF/InputSection.cpp.orig
+++ tools/lld/ELF/InputSection.cpp
@@ -891,7 +891,10 @@ void InputSection::relocateNonAlloc(uint8_t *buf, Arra
       continue;
     }
 
-    if (expr != R_ABS && expr != R_DTPREL && expr != R_RISCV_ADD) {
+    // R_ABS/R_DTPREL and some other relocations can be used from non-SHF_ALLOC
+    // sections.
+    if (expr != R_ABS && expr != R_DTPREL && expr != R_GOTPLTREL &&
+        expr != R_RISCV_ADD) {
       std::string msg = getLocation<ELFT>(offset) +
                         ": has non-ABS relocation " + toString(type) +
                         " against symbol '" + toString(sym) + "'";
