[lld] [lld][WebAssembly] do not relocate ABOSULTE symbols (PR #153763)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 15 01:18:05 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lld

Author: YAMAMOTO Takashi (yamt)

<details>
<summary>Changes</summary>

Fixes https://github.com/llvm/llvm-project/pull/153537

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


1 Files Affected:

- (modified) lld/wasm/SyntheticSections.cpp (+4-1) 


``````````diff
diff --git a/lld/wasm/SyntheticSections.cpp b/lld/wasm/SyntheticSections.cpp
index e1192706ea913..6c1c4391ea0d7 100644
--- a/lld/wasm/SyntheticSections.cpp
+++ b/lld/wasm/SyntheticSections.cpp
@@ -442,6 +442,8 @@ void GlobalSection::generateRelocationCode(raw_ostream &os, bool TLS) const {
   for (const Symbol *sym : internalGotSymbols) {
     if (TLS != sym->isTLS())
       continue;
+    if (sym->flags & WASM_SYMBOL_ABSOLUTE)
+      continue;
 
     if (auto *d = dyn_cast<DefinedData>(sym)) {
       // Get __memory_base
@@ -503,7 +505,8 @@ void GlobalSection::writeBody() {
     bool useExtendedConst = false;
     uint32_t globalIdx;
     int64_t offset;
-    if (ctx.arg.extendedConst && ctx.isPic) {
+    if (ctx.arg.extendedConst && ctx.isPic &&
+        (sym->flags & WASM_SYMBOL_ABSOLUTE) == 0) {
       if (auto *d = dyn_cast<DefinedData>(sym)) {
         if (!sym->isTLS()) {
           globalIdx = ctx.sym.memoryBase->getGlobalIndex();

``````````

</details>


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


More information about the llvm-commits mailing list