[PATCH] D111171: [lld][WebAssembly] Create optional internal symbols only after LTO object as been added
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 5 11:22:44 PDT 2021
sbc100 created this revision.
Herald added subscribers: ormris, wingo, ecnelises, steven_wu, sunfish, hiraditya, jgravelle-google, inglorion, dschuff.
sbc100 requested review of this revision.
Herald added subscribers: llvm-commits, aheejin.
Herald added a project: LLVM.
This is important for the cases where new symbols can be introduced
during LTO. Specifically this happens for during TLS-lowering where
references to `__tls_base` can be introduced.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D111171
Files:
lld/test/wasm/lto/tls.ll
lld/wasm/Driver.cpp
Index: lld/wasm/Driver.cpp
===================================================================
--- lld/wasm/Driver.cpp
+++ lld/wasm/Driver.cpp
@@ -947,8 +947,6 @@
}
}
- createOptionalSymbols();
-
if (errorCount())
return;
@@ -976,6 +974,8 @@
if (errorCount())
return;
+ createOptionalSymbols();
+
// Resolve any variant symbols that were created due to signature
// mismatchs.
symtab->handleSymbolVariants();
Index: lld/test/wasm/lto/tls.ll
===================================================================
--- /dev/null
+++ lld/test/wasm/lto/tls.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as %s -o %t1.o
+; RUN: wasm-ld --export=tsp_int %t1.o -o %t
+
+target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
+target triple = "wasm32-unknown-unknown"
+
+ at tsp_int = thread_local global i32 1
+
+define void @_start() {
+ %val = load i32, i32* @tsp_int
+ ret void
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111171.377312.patch
Type: text/x-patch
Size: 899 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211005/aaa65220/attachment.bin>
More information about the llvm-commits
mailing list