diff --git a/lld/test/wasm/lto/tls.ll b/lld/test/wasm/lto/tls.ll new file mode 100644 --- /dev/null +++ b/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" + +@tsp_int = thread_local global i32 1 + +define void @_start() { + %val = load i32, i32* @tsp_int + ret void +} diff --git a/lld/wasm/Driver.cpp b/lld/wasm/Driver.cpp --- a/lld/wasm/Driver.cpp +++ b/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();