[PATCH] D74110: [lld][WebAssembly] Allow symbols with explict import names to be undefined at link time.
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 5 23:27:48 PST 2020
sbc100 created this revision.
Herald added subscribers: llvm-commits, sunfish, aheejin, jgravelle-google, dschuff.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D74110
Files:
lld/test/wasm/import-name.ll
lld/wasm/Relocations.cpp
Index: lld/wasm/Relocations.cpp
===================================================================
--- lld/wasm/Relocations.cpp
+++ lld/wasm/Relocations.cpp
@@ -28,6 +28,12 @@
// compiling with -fPIC)
if (isa<DataSymbol>(sym))
return false;
+ // Undefined functions with explicit import name are allowed to be undefined
+ // at link time.
+ if (auto* F = dyn_cast<UndefinedFunction>(sym)) {
+ if (F->importName || F->importModule)
+ return true;
+ }
return (config->allowUndefined ||
config->allowUndefinedSymbols.count(sym->getName()) != 0);
}
Index: lld/test/wasm/import-name.ll
===================================================================
--- lld/test/wasm/import-name.ll
+++ lld/test/wasm/import-name.ll
@@ -1,5 +1,5 @@
; RUN: llc -filetype=obj %s -o %t.o
-; RUN: wasm-ld --allow-undefined -o %t.wasm %t.o
+; RUN: wasm-ld -o %t.wasm %t.o
; RUN: obj2yaml %t.wasm | FileCheck %s
target triple = "wasm32-unknown-unknown"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74110.242812.patch
Type: text/x-patch
Size: 973 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200206/5579d0aa/attachment.bin>
More information about the llvm-commits
mailing list