Skip to content

RuntimeLibcalls: Add entries for some exception related functions #147914

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

Merged

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Jul 10, 2025

SjLjEHPrepare and WasmEHPrepare directly emit calls to these by
name, and these are not tracked in RuntimeLibcalls. It will be easier
to fix this when RuntimeLibcalls is turned into an analysis, so just
add the entries for now.

@llvmbot
Copy link
Member

llvmbot commented Jul 10, 2025

@llvm/pr-subscribers-llvm-ir

Author: Matt Arsenault (arsenm)

Changes

SjLjEHPrepare and WasmEHPrepare directly emit calls to these by
name, and these are not tracked in RuntimeLibcalls. It will be easier
to fix this when RuntimeLibcalls is turned into an analysis, so just
add the entries for now.


Full diff: https://github.com/llvm/llvm-project/pull/147914.diff

1 Files Affected:

  • (modified) llvm/include/llvm/IR/RuntimeLibcalls.td (+6)
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index f7598979ca4c5..29de1206a8974 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -263,6 +263,9 @@ foreach MemSize = [1, 2, 4, 8, 16] in {
 
 // Exception handling
 def UNWIND_RESUME : RuntimeLibcall;
+def UNWIND_REGISTER : RuntimeLibcall;
+def UNWIND_UNREGISTER : RuntimeLibcall;
+def UNWIND_CALL_PERSONALITY : RuntimeLibcall;
 def CXA_END_CLEANUP : RuntimeLibcall;
 
 // Note: there are two sets of atomics libcalls; see
@@ -918,6 +921,9 @@ defm sincos : LibmLongDoubleLibCall;
 def bzero : RuntimeLibcallImpl<BZERO>;
 def __bzero : RuntimeLibcallImpl<BZERO>;
 def _Unwind_SjLj_Resume : RuntimeLibcallImpl<UNWIND_RESUME>;
+def _Unwind_SjLj_Register : RuntimeLibcallImpl<UNWIND_REGISTER>;
+def _Unwind_SjLj_Unregister : RuntimeLibcallImpl<UNWIND_UNREGISTER>;
+def _Unwind_CallPersonality : RuntimeLibcallImpl<UNWIND_CALL_PERSONALITY>;
 
 // Used on OpenBSD
 def __stack_smash_handler : RuntimeLibcallImpl<STACK_SMASH_HANDLER>;

@arsenm
Copy link
Contributor Author

arsenm commented Jul 15, 2025

ping

@arsenm arsenm force-pushed the users/arsenm/stack-protector/use-runtime-libcalls-for-libcall-names branch from 927865a to 9ae77cd Compare July 15, 2025 08:04
@arsenm arsenm force-pushed the users/arsenm/runtime-libcalls/add-exception-libcall-entries branch from ed4c2aa to 562bee8 Compare July 15, 2025 08:04
Copy link
Collaborator

@RKSimon RKSimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor Author

arsenm commented Jul 15, 2025

Merge activity

  • Jul 15, 9:34 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jul 15, 9:38 AM UTC: Graphite rebased this pull request as part of a merge.
  • Jul 15, 9:40 AM UTC: @arsenm merged this pull request with Graphite.

@arsenm arsenm force-pushed the users/arsenm/stack-protector/use-runtime-libcalls-for-libcall-names branch from 9ae77cd to c312171 Compare July 15, 2025 09:35
Base automatically changed from users/arsenm/stack-protector/use-runtime-libcalls-for-libcall-names to main July 15, 2025 09:38
SjLjEHPrepare and WasmEHPrepare directly emit calls to these by
name, and these are not tracked in RuntimeLibcalls. It will be easier
to fix this when RuntimeLibcalls is turned into an analysis, so just
add the entries for now.
@arsenm arsenm force-pushed the users/arsenm/runtime-libcalls/add-exception-libcall-entries branch from 562bee8 to f467d13 Compare July 15, 2025 09:38
@arsenm arsenm merged commit e68ef11 into main Jul 15, 2025
5 of 9 checks passed
@arsenm arsenm deleted the users/arsenm/runtime-libcalls/add-exception-libcall-entries branch July 15, 2025 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants