Repository navigation
[AArch64] Preserve erased frames through C++ cleanup - #64
Open
wizardengineer wants to merge 2 commits into
Open
wizardengineer wants to merge 2 commits into
wizardengineer wants to merge 2 commits into
Conversation
frabert
force-pushed
the
codex/p13-aarch64-cleanup-experiment
branch
from
November 24, 2026 10:14
9fe3f5f to
7153ad5
Compare
frabert
force-pushed
the
codex/p13-aarch64-cleanup-experiment
branch
from
November 30, 2026 14:47
c3ba77b to
2bec229
Compare
frabert
marked this pull request as ready for review
December 1, 2026 12:54
frabert
force-pushed
the
codex/p13-aarch64-cleanup-experiment
branch
from
December 1, 2026 13:44
2bec229 to
abbbb87
Compare
Base automatically changed from
codex/p13-ffr-runtime-ci
to
enforced_secrecy_main
December 2, 2026 00:32
Retain the erased original frame while a separate local thunk carries restored caller context. Share one constant continuation per function and emit transient unwind rows per fixed frame extent. Experimental local branch: validated with 240 generated C++ executions, 96 nested-depth cases, 4096 repeated calls, 12 failing mutations, and 65 focused RUN pipelines. Independent review remains required; general ARM32 EHABI and asynchronous runtime support are outside this patch.
kumarak
force-pushed
the
codex/p13-aarch64-cleanup-experiment
branch
from
December 2, 2026 00:38
abbbb87 to
cb4b202
Compare
Reject the carrier where its unwind protocol does not hold. Under a Guarded Control Stack the reported continuation was never pushed by a call. Under ILP32 the continuation's unwind rules read half of each saved 64-bit slot. Basic-block sections and function splitting are requested before frame lowering but assigned after it, so test the request, not MachineFunction::hasBBSections. Have the printer follow the decision frame lowering recorded on the exit instead of recomputing eligibility. It used to fall back to an ordinary call after the frame was erased and leave the continuation undefined. Use a temporary symbol for the continuation, so a symbol of the module cannot claim its name. Cover the continuation in the call-site table. The table ended at the last invoke when the resume block was laid out in front of it, and the personality routine calls std::terminate for an address without an entry. Add AsmPrinter::hasReturnAddressAfterFunctionBody and emit the trailing entry up to the function end when it is set. Emit one thunk per function, behind the function in its section. The branch to it is resolved by the assembler, so it needs no linker veneer, which would write X16 after the register clears, and the thunk shares the section's group and flags. Document that the linker may set X16 and X17 on the helper's call to _Unwind_Resume.
kumarak
force-pushed
the
codex/p13-aarch64-cleanup-experiment
branch
from
December 2, 2026 12:52
632e69b to
7afa4e4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Support escaping C++ cleanup for ordinary fixed-frame AArch64 ELF functions using the GNU C++ personality. Restore incoming caller state, erase the original allocation, then transfer through a compiler-local helper whose separate storage preserves the information needed by the unwinder. A function-wide constant continuation and helpers grouped by frame extent preserve the original frame's unwind identity without a new runtime ABI or attribute.
The permitted context is explicit: the exception interface, restored incoming LR/X21, a fixed continuation address, and a carrier address derived from the original stack pointer. The helper allocation stays below the original erased frame. Unsupported ARM32 EHABI, dynamic/realigned layouts, SVE/SME, explicitly reserved X1/X21 and other excluded protocols retain their diagnostics; the existing Android shadow-call-stack path is unchanged.
Validation, independently reproduced:
The evidence uses an assertion-enabled compiler with isolated rebuilt AArch64 objects and a replacement LLVM library. Stacking on #63 preserved the tested compiler files; the later reservation guard has a separate rebuilt-library check. A fresh combined-source CI result remains required. Exact signal-boundary failures in the pinned LLVM unwinder also reproduce with ordinary unprotected functions and are documented separately, not claimed as new asynchronous support.
Stacked on #63. Refs trailofbits/vspells-ct-internal-notes#48, trailofbits/vspells-ct-internal-notes#58, trailofbits/vspells-ct-internal-notes#59 and trailofbits/vspells-ct-internal-notes#82. This is a narrow implementation, not a declaration of full milestone completion. Assisted by Codex.