[llvm] [RelLookupTableConverter] Drop unnamed_addr to avoid generating GOTPCREL relocations (PR #142304)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 1 03:28:38 PDT 2025


================
@@ -110,6 +110,11 @@ static GlobalVariable *createRelLookupTable(Function &Func,
 
   for (Use &Operand : LookupTableArr->operands()) {
     Constant *Element = cast<Constant>(Operand);
+    // Drop unnamed_addr to avoid matching pattern in
+    // `handleIndirectSymViaGOTPCRel`, which generates GOTPCREL relocations not
+    // supported by the GNU linker and LLD versions below 18 on aarch64.
----------------
nikic wrote:

As we are working around problems with specific linkers on specific platforms, we should add triple checks like you originally had, for aarch64 and for x86-darwin (and list which linker versions are affected, so this can be removed in the future).

Does BFD not support GOTPCREL on aarch64 even in the newest version?

https://github.com/llvm/llvm-project/pull/142304


More information about the llvm-commits mailing list