[PATCH] D88506: [lld][WebAssembly] Allow exporting of mutable globals

Thomas Lively via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 29 12:35:26 PDT 2020


tlively added a comment.

I think it's kind of confusing that export-all doesn't actually export all the symbols. What if we instead made export-all exactly equivalent to individually exporting all the symbols so that it errors out if mutable-globals is not enabled and any of the symbols is a mutable global? Then we could add a `--no-export=<symbol>` flag that users or drivers could use to filter out the mutable global symbols if they can't enable mutable-globals and need to avoid the error.



================
Comment at: lld/wasm/Writer.cpp:456
 
-  if (!config->relocatable && used.count("mutable-globals") == 0) {
+  if (!config->relocatable && allowed.count("mutable-globals") == 0) {
     for (const Symbol *sym : out.importSec->importedSymbols) {
----------------
Oops! Nice catch.


================
Comment at: lld/wasm/Writer.cpp:579
+        // Without this check `--export-all` would cause any program using the
+        // stack pointer to export a mutable global even if non of the input
+        // files were built with the `mutable-globals` feature.
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88506/new/

https://reviews.llvm.org/D88506



More information about the llvm-commits mailing list