Skip to content

Fix custom EHFrame registration on llvm21#60358

Closed
yuyichao wants to merge 1 commit intomasterfrom
yyc/llvm21-2
Closed

Fix custom EHFrame registration on llvm21#60358
yuyichao wants to merge 1 commit intomasterfrom
yyc/llvm21-2

Conversation

@yuyichao
Copy link
Copy Markdown
Contributor

@yuyichao yuyichao commented Dec 10, 2025

Also split out of #59946.

Ref llvm/llvm-project@76d5a79

@ararslan ararslan added the compiler:llvm For issues that relate to LLVM label Dec 16, 2025
@gbaraldi gbaraldi requested a review from xal-0 February 24, 2026 14:36
gbaraldi added a commit that referenced this pull request Mar 9, 2026
LLVM 21 removes `jitlink::EHFrameRegistrar` and changes the
`EHFrameRegistrationPlugin` constructor to use a factory method.
Add `JLEHFrameRegistrationPlugin` which uses JITLink allocation
actions for EH frame registration/deregistration, and update the
`JuliaOJIT` constructor with version guards.

Supersedes #60358.

Co-Authored-By: yuyichao <yyc1992@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
xal-0 pushed a commit to xal-0/julia that referenced this pull request Mar 9, 2026
LLVM 21 removes `jitlink::EHFrameRegistrar` and changes the
`EHFrameRegistrationPlugin` constructor to use a factory method.
Add `JLEHFrameRegistrationPlugin` which uses JITLink allocation
actions for EH frame registration/deregistration, and update the
`JuliaOJIT` constructor with version guards.

Supersedes JuliaLang#60358.

Co-Authored-By: yuyichao <yyc1992@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
xal-0 added a commit that referenced this pull request Mar 11, 2026
LLVM 21 removes `jitlink::EHFrameRegistrar` and changes the
`EHFrameRegistrationPlugin` constructor to use a factory method.  Use the new
EHFrameRegistrationPlugin constructor to pass our register/deregister actions.

Supersedes #60358.

Co-Authored-By: yuyichao <yyc1992@gmail.com>
Co-Authored-By: Sam Schweigel <sam.schweigel@juliahub.com>
oscardssmith pushed a commit that referenced this pull request Mar 11, 2026
## Summary

- Add `withContextDo` compatibility shim for `ThreadSafeContext` API
changes in LLVM 21 (which removes `getLock()`, `Lock`, and
`getContext()` in favor of callback-based `withContextDo`)
- Replace all manual lock/unlock patterns with scoped `withContextDo`
callbacks across `jitlayers.h`, `jitlayers.cpp`, `aotcompile.cpp`, and
`disasm.cpp`
- Add `JLEHFrameRegistrationPlugin` for LLVM 21+ (which removes
`jitlink::EHFrameRegistrar`), using JITLink allocation actions for EH
frame registration
- Debug asserts ensure `get_context()`/`get_module()` are only called
inside `withContextDo` scope
- Lock hierarchy respected: TSC locks released before
`addOutput()`/`R->replace()` which can trigger materialization

Supersedes #59946 and #60358, forward-porting those changes to current
master.

## Test plan

- [x] Builds and passes smoke test on LLVM 20
- [x] Builds and passes smoke test on LLVM 21 (tested with libLLVM
21.1.2 JLL)
- [ ] CI

This pull request was written with the assistance of generative AI
(Claude).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

There is quite a few whitespace changes so ignoring it is quite helpful

---------

Co-authored-by: yuyichao <yyc1992@gmail.com>
Co-authored-by: Sam Schweigel <sam.schweigel@juliahub.com>
@giordano
Copy link
Copy Markdown
Member

Superseded by #61273, right?

@oscardssmith
Copy link
Copy Markdown
Member

yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler:llvm For issues that relate to LLVM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants