aboutsummaryrefslogtreecommitdiff
path: root/lld/wasm/Writer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/wasm/Writer.cpp')
-rw-r--r--lld/wasm/Writer.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp
index b704677..0d36893 100644
--- a/lld/wasm/Writer.cpp
+++ b/lld/wasm/Writer.cpp
@@ -576,7 +576,7 @@ void Writer::populateTargetFeatures() {
if (ctx.isPic) {
// This should not be necessary because all PIC objects should
- // contain the mutable-globals feature.
+ // contain the `mutable-globals` feature.
// TODO (https://github.com/llvm/llvm-project/issues/51681)
allowed.insert("mutable-globals");
}
@@ -703,10 +703,12 @@ void Writer::checkImportExportTargetFeatures() {
}
}
for (const Symbol *sym : out.exportSec->exportedSymbols) {
- if (isa<GlobalSymbol>(sym)) {
- error(Twine("mutable global exported but 'mutable-globals' feature "
- "not present in inputs: `") +
- toString(*sym) + "`. Use --no-check-features to suppress.");
+ if (auto *global = dyn_cast<GlobalSymbol>(sym)) {
+ if (global->getGlobalType()->Mutable) {
+ error(Twine("mutable global exported but 'mutable-globals' feature "
+ "not present in inputs: `") +
+ toString(*sym) + "`. Use --no-check-features to suppress.");
+ }
}
}
}