[lld] [llvm] [llvm][lld] Support R_AARCH64_GOTPCREL32 (PR #72584)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat May 31 12:42:49 PDT 2025


MaskRay wrote:

I don't have a Rust development environment, but these components are likely involved:

* Rust LLVM IR producer
* llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp
* llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:handleIndirectSymViaGOTPCRel  This converts GOT-equivalent `Constant` uses to GOTPCREL style fixups.
* llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp lowers GOTPCREL style fixups to relocations, where R_AARCH64_GOTPCREL32 is not supported by GNU ld or older LLD.

Implementing a workaround in LLVM's Transforms or CodeGen sections might seem appealing for broader IR producer support, but we generally aim to avoid adding linker compatibility checks...
I'm currently leaning towards Rust implementing the workaround within its IR producer...


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


More information about the llvm-commits mailing list