-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Revert "[lld][WebAssembly] Do not relocate ABSOLUTE symbols" #154371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This reverts commit 9247be8.
@llvm/pr-subscribers-lld-wasm @llvm/pr-subscribers-lld Author: Sam Clegg (sbc100) ChangesReverts llvm/llvm-project#153763 This caused a bunch of failures on the emscripten waterfall, specifically most of the lsan tests started failing. Full diff: https://github.com/llvm/llvm-project/pull/154371.diff 2 Files Affected:
diff --git a/lld/test/wasm/pie.s b/lld/test/wasm/pie.s
index 433958e149d8f..21eac79207318 100644
--- a/lld/test/wasm/pie.s
+++ b/lld/test/wasm/pie.s
@@ -2,7 +2,7 @@
# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-emscripten %S/Inputs/internal_func.s -o %t.internal_func.o
# RUN: wasm-ld --no-gc-sections --experimental-pic -pie --unresolved-symbols=import-dynamic -o %t.wasm %t.o %t.internal_func.o
# RUN: obj2yaml %t.wasm | FileCheck %s
-# RUN: llvm-objdump --disassemble-symbols=__wasm_call_ctors,__wasm_apply_data_relocs,__wasm_apply_global_relocs --no-show-raw-insn --no-leading-addr %t.wasm | FileCheck %s --check-prefixes DISASSEM
+# RUN: llvm-objdump --disassemble-symbols=__wasm_call_ctors,__wasm_apply_data_relocs --no-show-raw-insn --no-leading-addr %t.wasm | FileCheck %s --check-prefixes DISASSEM
.functype external_func () -> ()
.functype internal_func1 () -> (i32)
@@ -41,9 +41,6 @@ foo:
drop
global.get __stack_pointer
- drop
-
- global.get __wasm_first_page_end@GOT
end_function
get_data_address:
@@ -148,18 +145,6 @@ _start:
# DISASSEM-LABEL: <__wasm_apply_data_relocs>:
# DISASSEM: end
-# global 6 is __wasm_first_page_end, which is ABSOLUTE and
-# thus should not be relocated.
-#
-# DISASSEM-LABEL: <__wasm_apply_global_relocs>:
-# DISASSEM: global.set 4
-# DISASSEM: global.set 5
-# DISASSEM-NOT: global.set 6
-# DISASSEM: global.set 7
-# DISASSEM: global.set 8
-# DISASSEM: global.set 9
-# DISASSEM: end
-
# Run the same test with extended-const support. When this is available
# we don't need __wasm_apply_global_relocs and instead rely on the add
# instruction in the InitExpr. We also, therefore, do not need these globals
@@ -188,23 +173,17 @@ _start:
# EXTENDED-CONST-NEXT: Type: I32
# EXTENDED-CONST-NEXT: Mutable: false
# EXTENDED-CONST-NEXT: InitExpr:
-# EXTENDED-CONST-NEXT: Opcode: I32_CONST
-# EXTENDED-CONST-NEXT: Value: 65536
-# EXTENDED-CONST-NEXT: - Index: 7
-# EXTENDED-CONST-NEXT: Type: I32
-# EXTENDED-CONST-NEXT: Mutable: false
-# EXTENDED-CONST-NEXT: InitExpr:
# EXTENDED-CONST-NEXT: Extended: true
# This instruction sequence decodes to:
# (global.get[0x23] 0x1 i32.const[0x41] 0x0C i32.add[0x6A] end[0x0b])
# EXTENDED-CONST-NEXT: Body: 2301410C6A0B
-# EXTENDED-CONST-NEXT: - Index: 8
+# EXTENDED-CONST-NEXT: - Index: 7
# EXTENDED-CONST-NEXT: Type: I32
# EXTENDED-CONST-NEXT: Mutable: false
# EXTENDED-CONST-NEXT: InitExpr:
# EXTENDED-CONST-NEXT: Opcode: GLOBAL_GET
# EXTENDED-CONST-NEXT: Index: 2
-# EXTENDED-CONST-NEXT: - Index: 9
+# EXTENDED-CONST-NEXT: - Index: 8
# EXTENDED-CONST-NEXT: Type: I32
# EXTENDED-CONST-NEXT: Mutable: false
# EXTENDED-CONST-NEXT: InitExpr:
diff --git a/lld/wasm/SyntheticSections.cpp b/lld/wasm/SyntheticSections.cpp
index e26f818fc2ca0..e1192706ea913 100644
--- a/lld/wasm/SyntheticSections.cpp
+++ b/lld/wasm/SyntheticSections.cpp
@@ -440,8 +440,6 @@ void GlobalSection::generateRelocationCode(raw_ostream &os, bool TLS) const {
: WASM_OPCODE_I32_ADD;
for (const Symbol *sym : internalGotSymbols) {
- if (sym->flags & WASM_SYMBOL_ABSOLUTE)
- continue;
if (TLS != sym->isTLS())
continue;
@@ -505,8 +503,7 @@ void GlobalSection::writeBody() {
bool useExtendedConst = false;
uint32_t globalIdx;
int64_t offset;
- if (ctx.arg.extendedConst && ctx.isPic &&
- (sym->flags & WASM_SYMBOL_ABSOLUTE) == 0) {
+ if (ctx.arg.extendedConst && ctx.isPic) {
if (auto *d = dyn_cast<DefinedData>(sym)) {
if (!sym->isTLS()) {
globalIdx = ctx.sym.memoryBase->getGlobalIndex();
|
dschuff
approved these changes
Aug 19, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reverts #153763
This caused a bunch of failures on the emscripten waterfall, specifically most of the lsan tests started failing.