[lld] LLD is unable to link musl for x32 - only for DSOs. static linking wa… (PR #182419)

via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 19 17:54:04 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lld

Author: None (daunabomba)

<details>
<summary>Changes</summary>

Add support for dynamic relocations in ELF32 x86-64 target.

This trivial change enables the linker to handle dynamic relocations x32 ABI  No functional changes to other architectures or ABIs.

Tested with same DSO/loader musl libc

---
Full diff: https://github.com/llvm/llvm-project/pull/182419.diff


1 Files Affected:

- (modified) lld/ELF/Arch/X86_64.cpp (+1-1) 


``````````diff
diff --git a/lld/ELF/Arch/X86_64.cpp b/lld/ELF/Arch/X86_64.cpp
index 4ee6ea1cb6183..613ccefec5433 100644
--- a/lld/ELF/Arch/X86_64.cpp
+++ b/lld/ELF/Arch/X86_64.cpp
@@ -438,7 +438,7 @@ void X86_64::writePlt(uint8_t *buf, const Symbol &sym,
 
 RelType X86_64::getDynRel(RelType type) const {
   if (type == R_X86_64_64 || type == R_X86_64_PC64 || type == R_X86_64_SIZE32 ||
-      type == R_X86_64_SIZE64)
+      type == R_X86_64_SIZE64 || type == R_X86_64_32)
     return type;
   return R_X86_64_NONE;
 }

``````````

</details>


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


More information about the llvm-commits mailing list