[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:53:18 PST 2026


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

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

>From 3f9a15a7b35675605acbc56009f6011e3e42e82d Mon Sep 17 00:00:00 2001
From: Your Name <you at example.com>
Date: Fri, 20 Feb 2026 02:48:43 +0100
Subject: [PATCH] LLD is unable to link musl for x32 - only for DSOs. static
 linking was unaffected

---
 lld/ELF/Arch/X86_64.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
 }



More information about the llvm-commits mailing list