Skip to content

Commit a664cad

Browse files
authored
Wasm: Fix hardcoding _Unwind_CallPersonality function name (llvm#167612)
1 parent ce32b73 commit a664cad

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

llvm/lib/CodeGen/WasmEHPrepare.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
#include "llvm/IR/IRBuilder.h"
8686
#include "llvm/IR/IntrinsicsWebAssembly.h"
8787
#include "llvm/IR/Module.h"
88+
#include "llvm/IR/RuntimeLibcalls.h"
8889
#include "llvm/InitializePasses.h"
8990
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
9091

@@ -273,8 +274,13 @@ bool WasmEHPrepareImpl::prepareEHPads(Function &F) {
273274
// instruction selection.
274275
CatchF = Intrinsic::getOrInsertDeclaration(&M, Intrinsic::wasm_catch);
275276

277+
// FIXME: Verify this is really supported for current module.
278+
StringRef UnwindCallPersonalityName =
279+
RTLIB::RuntimeLibcallsInfo::getLibcallImplName(
280+
RTLIB::impl__Unwind_CallPersonality);
281+
276282
// _Unwind_CallPersonality() wrapper function, which calls the personality
277-
CallPersonalityF = M.getOrInsertFunction("_Unwind_CallPersonality",
283+
CallPersonalityF = M.getOrInsertFunction(UnwindCallPersonalityName,
278284
IRB.getInt32Ty(), IRB.getPtrTy());
279285
if (Function *F = dyn_cast<Function>(CallPersonalityF.getCallee()))
280286
F->setDoesNotThrow();

0 commit comments

Comments
 (0)