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

via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 1 05:18:08 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.
----------------
dianqk wrote:

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

Probably nobody noticed this.

```
 /nix/...-binutils-aarch64-unknown-linux-gnu-2.44/bin/ld: /path/1.rcgu.o: unrecognized relocation type 0x13b in section `.rodata..Lswitch.table.bad.rel'
          /nix/...-binutils-aarch64-unknown-linux-gnu-2.44/bin/ld: is this version of the linker - (GNU Binutils) 2.44 - out of date ?
          /nix/...-binutils-aarch64-unknown-linux-gnu-2.44/bin/ld: final link failed: bad value
          collect2: error: ld returned 1 exit status
```

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


More information about the llvm-commits mailing list