[PATCH] D65785: [WebAssembly] Fix null pointer in createInitTLSFunction

Guanzhong Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 5 18:06:20 PDT 2019


quantum created this revision.
quantum added reviewers: tlively, aheejin, kripken, sbc100.
Herald added subscribers: llvm-commits, sunfish, jgravelle-google, dschuff.
Herald added a project: LLVM.

`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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65785

Files:
  lld/wasm/Writer.cpp


Index: lld/wasm/Writer.cpp
===================================================================
--- lld/wasm/Writer.cpp
+++ lld/wasm/Writer.cpp
@@ -901,7 +901,7 @@
     createCallCtorsFunction();
   }
 
-  if (config->sharedMemory && !config->shared)
+  if (!config->relocatable && config->sharedMemory && !config->shared)
     createInitTLSFunction();
 
   if (errorCount())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65785.213506.patch
Type: text/x-patch
Size: 375 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190806/9a797ea2/attachment.bin>


More information about the llvm-commits mailing list