[WebAssembly] Fix null pointer in createInitTLSFunction
Summary:
`createSyntheticSymbols`, which creates `WasmSym::InitTLS`, is only called
when `!config->relocatable`, but this condition is not checked when calling
`createInitTLSFunction`.
This diff checks `!config->relocatable` before calling `createInitTLSFunction`.
Fixes https://github.com/emscripten-core/emscripten/issues/9155.
Reviewers: tlively, aheejin, kripken, sbc100
Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65785
llvm-svn: 368078
diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp
index 2dbff1b..2e1af22 100644
--- a/lld/wasm/Writer.cpp
+++ b/lld/wasm/Writer.cpp
@@ -901,7 +901,7 @@
createCallCtorsFunction();
}
- if (config->sharedMemory && !config->shared)
+ if (!config->relocatable && config->sharedMemory && !config->shared)
createInitTLSFunction();
if (errorCount())