[PATCH] D87666: [lld][WebAssembly] Allow globals imports via import_name/import_module
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 14 20:34:56 PDT 2020
sbc100 updated this revision to Diff 291767.
sbc100 added a comment.
feedback
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87666/new/
https://reviews.llvm.org/D87666
Files:
lld/test/wasm/mutable-globals.s
lld/wasm/Relocations.cpp
Index: lld/wasm/Relocations.cpp
===================================================================
--- lld/wasm/Relocations.cpp
+++ lld/wasm/Relocations.cpp
@@ -21,10 +21,13 @@
}
static bool allowUndefined(const Symbol* sym) {
- // Undefined functions with explicit import name are allowed to be undefined
- // at link time.
- if (auto *F = dyn_cast<UndefinedFunction>(sym))
- if (F->importName)
+ // Undefined functions and globals with explicit import name are allowed to be
+ // undefined at link time.
+ if (auto *f = dyn_cast<UndefinedFunction>(sym))
+ if (f->importName)
+ return true;
+ if (auto *g = dyn_cast<UndefinedGlobal>(sym))
+ if (g->importName)
return true;
return (config->allowUndefined ||
config->allowUndefinedSymbols.count(sym->getName()) != 0);
Index: lld/test/wasm/mutable-globals.s
===================================================================
--- lld/test/wasm/mutable-globals.s
+++ lld/test/wasm/mutable-globals.s
@@ -9,5 +9,7 @@
end_function
.globaltype foo, i32
+.import_module foo, env
+.import_name foo, foo
# CHECK: error: mutable global imported but 'mutable-globals' feature not present in inputs: `foo`. Use --no-check-features to suppress.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87666.291767.patch
Type: text/x-patch
Size: 1237 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200915/b7a0e7c1/attachment.bin>
More information about the llvm-commits
mailing list