[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 19:21:31 PDT 2020
sbc100 created this revision.
Herald added subscribers: llvm-commits, ecnelises, sunfish, jgravelle-google, dschuff.
Herald added a project: LLVM.
sbc100 requested review of this revision.
Herald added a subscriber: aheejin.
This feature already exists but was limited to function
symbols.
Repository:
rG LLVM Github Monorepo
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,11 +21,14 @@
}
static bool allowUndefined(const Symbol* sym) {
- // Undefined functions with explicit import name are allowed to be undefined
- // at link time.
+ // 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.291760.patch
Type: text/x-patch
Size: 1165 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200915/aa2e4ee3/attachment.bin>
More information about the llvm-commits
mailing list