Repository navigation
feat(libc): support x86-64 unwind register contexts on macOS - #1499
Conversation
klosixgaming-arch
left a comment
There was a problem hiding this comment.
Excellent addition of comprehensive register context capture and restore tests for x86-64 on both Linux and macOS. This is important for verifying the correctness of the unwinder's register transfer operations.
Strengths:
- Comprehensive test coverage including capture, restore, and multi-threaded scenarios (256 iterations per thread)
- Proper handling of platform-specific symbol naming (macOS vs Linux) with appropriate asm directives
- Clean separation into a standalone test target that can be built without submodules or prx libraries
- Good documentation in BUILD.md about how to run the tests on both platforms
Technical notes:
- The approach of using inline assembly probes to verify register capture/restore is correct and thorough
- Proper validation of guard values to ensure no out-of-bounds writes
- Test properly verifies all 17 registers including stack pointer and instruction pointer
- Multi-threaded testing ensures thread-safety of the register context operations
This will improve confidence in the unwinder's correctness across platforms. Ready to merge.
ee57930 to
6e8058f
Compare
6e8058f to
9bdcc02
Compare
|
@adriadam10 Could you review the updated register-context prerequisite? Head |
9bdcc02 to
de230c3
Compare
|
@adriadam10 Current head |
de230c3 to
fbce671
Compare
|
Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head
No title was run. 🤖 Addressed by Claude Code |
|
Checked on Linux x86-64: build and |
…egister-context feat(libc): support x86-64 unwind register contexts on macOS
What
On macOS x86-64,
LibcCaptureRegistersandLibcRestoreRegisterscurrently take the unsupported-platform branch and callabort(). This prevents the guest unwinder from capturing its starting frame or installing a landing-pad context once the macOS unwind path is enabled.Reuse the existing System V x86-64 instruction sequence on Apple hosts, with Mach-O symbol spelling and private visibility instead of ELF assembler directives. The Linux instruction sequence and the Windows implementation are unchanged.
Add behavioral tests for all captured general registers, the caller's stack and return address, and a restore that abandons a nested stack frame and transfers the exception/selector registers and callee-saved registers to a landing pad. The probes also run concurrently on four threads. They build independently of the prx libraries, are registered in the full Linux test suite, and get Debug/Release CI on Linux and Intel macOS.
This is a register-transfer prerequisite for the macOS work in #1 and complements #927. It does not implement frame discovery, Mach-O relinking, or the complete exception runtime. No graphics changes.
Tested
Current head
fbce6710is rebased ontomainat745b775e, which includes #2099 and #2151. The previous SPIRV-Headers build blocker is resolved in this base.git range-diffconfirms the register-transfer source and probes are unchanged; only workflow integration context changed.9bdcc027passed all four Linux/Intel macOS register-context jobs and all three relinker jobs; its full builds failed on the now-resolved upstream header issue. These earlier results are not current-head full-build validation.workflow_dispatchwith a PR number. Please dispatch Build withpr=1499for this head. Automatic register-context/relinker checks may run separately; skipped full-build jobs do not count as passes.Standalone reproduction commands remain in
docs/dev/BUILD.md.amdgcn-amd-amdhsais therefore addressed by upstream, without a duplicate patch in this PR.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed indocs/dev/TechnicalDebt.md.mdfiles or images added to the repository