[WebAssembly] Fix null pointer in createInitTLSFunction
authorGuanzhong Chen <gzchen@google.com>
Tue, 6 Aug 2019 20:09:04 +0000 (20:09 +0000)
committerGuanzhong Chen <gzchen@google.com>
Tue, 6 Aug 2019 20:09:04 +0000 (20:09 +0000)
commit0cb776e61a74418574f698bdd2bcf2276eabf8b8
treeb88682d3d42554614d7a0eadf201370e69ed73ac
parent53e9c2d76be160dc5b68162f6943f4ebe92607f4
[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
lld/test/wasm/relocatable.ll
lld/wasm/Writer.cpp