[PATCH] D77192: [WebAssembly] EmscriptenEHSjLj: Make __invoke_ functions as imported
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 31 22:32:47 PDT 2020
sbc100 updated this revision to Diff 254091.
sbc100 added a comment.
more
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77192/new/
https://reviews.llvm.org/D77192
Files:
llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
Index: llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
===================================================================
--- llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
+++ llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
@@ -344,6 +344,20 @@
return Sig;
}
+static void markAsImported(Function *F) {
+ // Tell the linker that this function is expected to be imported from the
+ // 'env' module.
+ llvm::AttrBuilder B;
+ if (!F->hasFnAttribute("wasm-import-module")) {
+ B.addAttribute("wasm-import-module", "env");
+ F->addAttributes(llvm::AttributeList::FunctionIndex, B);
+ }
+ if (!F->hasFnAttribute("wasm-import-name")) {
+ B.addAttribute("wasm-import-name", F->getName());
+ F->addAttributes(llvm::AttributeList::FunctionIndex, B);
+ }
+}
+
// Returns __cxa_find_matching_catch_N function, where N = NumClauses + 2.
// This is because a landingpad instruction contains two more arguments, a
// personality function and a cleanup bit, and __cxa_find_matching_catch_N
@@ -360,6 +374,7 @@
Function *F = Function::Create(
FTy, GlobalValue::ExternalLinkage,
"__cxa_find_matching_catch_" + Twine(NumClauses + 2), &M);
+ markAsImported(F);
FindMatchingCatches[NumClauses] = F;
return F;
}
@@ -469,6 +484,7 @@
CalleeFTy->isVarArg());
Function *F =
Function::Create(FTy, GlobalValue::ExternalLinkage, "__invoke_" + Sig, M);
+ markAsImported(F);
InvokeWrappers[Sig] = F;
return F;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77192.254091.patch
Type: text/x-patch
Size: 1546 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200401/23e80e88/attachment.bin>
More information about the llvm-commits
mailing list