feat(emit): dual-emit runtime + harden artifacts - #333
Merged
Merged
Conversation
From one `in compile` / `in build` invocation, emit a runtime artifact (default or lean — no harden IR/codegen) plus a separate harden sample. `--dual-emit` compiles the existing path twice; `--harden-out` with `--out` implies dual-emit. Harden path defaults to inserting `-harden` before the `--out` extension. Dual-emit with `--harden` / `--profile harden` is rejected so the runtime artifact cannot receive CFG `_pc` dispatch or alien shapes.
|
Capy couldn't review this pull request because Max's workspace is out of credits, add credits or enable auto-reload to resume automatic reviews. |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_8ae6e03f-8e01-4a58-8802-baa5836235b1) |
|
Tick the box to add this pull request to the merge queue (same as
|
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.
Summary
--dual-emitand--harden-outtoin compile/in buildso one invocation writes two artifacts: a runtime object (defaultorlean, no harden transforms) and a separate harden anti-decomp sample.--harden-outwith--outimplies dual-emit; otherwise--dual-emitderivesfoo-harden.ofrom--out. Dual-emit rejects--harden/--profile hardenso the hot-path runtime emit never gets CFG_pc/ alien MBA shapes.docs/emit-profiles.md) andscripts/ghidra-antidecomp-smoke.shupdated to prefer one-shot dual-emit for size/objdump metrics.Test plan
cargo test --lib dual_emit(resolve helpers + owned_compile dual artifacts)cargo test --lib runtime_profile_has_no_cfg_pc_dispatchcargo test --lib harden_profile_keeps_cfg_pc_dispatchcargo test --bin in dual_emit(CLI parse + dual write)cargo clippy --all-targets -- -D warningscargo fmt --checkscripts/ghidra-antidecomp-smoke.shlocally when native backend availableNotes
1c9a902(feat(harden): alien-emit rethink — CFG dispatch lite + native MBA pads #332 alien-emit).glm-5.3unavailable: ZAI 429 insufficient balance + OpenCode insufficient balance). Mac worktree created but host flapped; work done on box worktree/workspace/inauguration-dual-emit.Note
Medium Risk
Changes default compile/build behavior when new flags are used (double pipeline runs) and encodes profile orthogonality in CLI validation; core emit paths are unchanged unless dual-emit is requested.
Overview
Adds dual-emit so
in compileandin buildcan write two outputs in one invocation: a runtime artifact (defaultorlean, no harden IR/codegen) to--out, and a separate harden anti-decomp sample to--harden-out(or a derived*-hardenpath when only--dual-emitis set).New CLI flags
--dual-emitand--harden-outare wired throughEmitProfile::resolve_dual_emit, which rejects combining dual-emit with--harden/--profile hardenand requires distinct paths.cmd_compileandcmd_buildrun the pipeline twice when dual mode is active (runtime profile first, thenEmitProfile::Harden).Documentation and
scripts/ghidra-antidecomp-smoke.shnow prefer one-shot dual-emit instead of two separate profile compiles. Tests cover path derivation, flag parsing, artifact differences (_Hsymbols only in harden), and IR invariants thatdefault/leanmust not insert CFG_pcdispatch while harden keeps it.Reviewed by Cursor Bugbot for commit d57ea0d. Configure here.