[lld] [lld][WebAssembly] do not relocate ABOSULTE symbols (PR #153763)
YAMAMOTO Takashi via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 15 01:17:32 PDT 2025
https://github.com/yamt created https://github.com/llvm/llvm-project/pull/153763
Fixes https://github.com/llvm/llvm-project/pull/153537
>From 0196c11b0de9d0e52454c359b263b7b60d829f2f Mon Sep 17 00:00:00 2001
From: YAMAMOTO Takashi <yamamoto at midokura.com>
Date: Fri, 15 Aug 2025 17:15:22 +0900
Subject: [PATCH] [lld][WebAssembly] do not relocate ABOSULTE symbols
Fixes https://github.com/llvm/llvm-project/pull/153537
---
lld/wasm/SyntheticSections.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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();
More information about the llvm-commits
mailing list