-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Wasm: Fix hardcoding _Unwind_CallPersonality function name #167612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wasm: Fix hardcoding _Unwind_CallPersonality function name #167612
Conversation
|
@llvm/pr-subscribers-backend-webassembly Author: Matt Arsenault (arsenm) ChangesFull diff: https://github.com/llvm/llvm-project/pull/167612.diff 1 Files Affected:
diff --git a/llvm/lib/CodeGen/WasmEHPrepare.cpp b/llvm/lib/CodeGen/WasmEHPrepare.cpp
index 1ea3e6bcb15ce..a9a2df406143e 100644
--- a/llvm/lib/CodeGen/WasmEHPrepare.cpp
+++ b/llvm/lib/CodeGen/WasmEHPrepare.cpp
@@ -85,6 +85,7 @@
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/IntrinsicsWebAssembly.h"
#include "llvm/IR/Module.h"
+#include "llvm/IR/RuntimeLibcalls.h"
#include "llvm/InitializePasses.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
@@ -273,8 +274,13 @@ bool WasmEHPrepareImpl::prepareEHPads(Function &F) {
// instruction selection.
CatchF = Intrinsic::getOrInsertDeclaration(&M, Intrinsic::wasm_catch);
+ // FIXME: Verify this is really supported for current module.
+ StringRef UnwindCallPersonalityName =
+ RTLIB::RuntimeLibcallsInfo::getLibcallImplName(
+ RTLIB::_Unwind_CallPersonality);
+
// _Unwind_CallPersonality() wrapper function, which calls the personality
- CallPersonalityF = M.getOrInsertFunction("_Unwind_CallPersonality",
+ CallPersonalityF = M.getOrInsertFunction(UnwindCallPersonalityName,
IRB.getInt32Ty(), IRB.getPtrTy());
if (Function *F = dyn_cast<Function>(CallPersonalityF.getCallee()))
F->setDoesNotThrow();
|
fe8e8a2 to
d79bdb3
Compare
|
Should there be something in an implementation file or tablegen somewhere that actually defines the name? |
Yes, this is defined in RuntimeLibcalls.td. RTLIB::impl__Unwind_CallPersonality directly corresponds to this string. This is the bare minimum to stop using the hardcoded name. Technically this should be querying which implementation from LibcallLoweringInfo from UNWIND_CALL_PERSONALITY, but that requires future boilerplate |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/110/builds/6262 Here is the relevant piece of the build log for the reference |

No description provided.