[PATCH] D87537: [lld][WebAssembly] Error on import/export of mutable global without `mutable-globals` feature

Thomas Lively via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 11 13:01:49 PDT 2020


tlively added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/WebAssembly.cpp:246-252
+  llvm::Reloc::Model RelocationModel;
+  unsigned PICLevel;
+  bool IsPIE;
+  std::tie(RelocationModel, PICLevel, IsPIE) = ParsePICArgs(*this, DriverArgs);
+  if (RelocationModel == llvm::Reloc::PIC_) {
+    CC1Args.push_back("+mutable-globals");
+  }
----------------
This should also check that the user didn't pass `options::OPT_mno_mutable_globals` and a test should be added in clang/test/Driver/wasm-toolchain.c.


================
Comment at: lld/wasm/Writer.cpp:478
+                  toString(*sym) + "`. Use --no-check-features to suppress.");
+          else if (sym->isExported())
+            error(Twine("mutable global exported but 'mutable-globals' feature "
----------------
could this `if (sym->isExported())` be turned into an `assert(sym->isExported())`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87537



More information about the cfe-commits mailing list