Skip to content

cargo: drop shared musl rustflags; each repo owns its rustflags#1

Merged
HarryR merged 2 commits into
mainfrom
rustflags-per-repo
Jul 9, 2026
Merged

cargo: drop shared musl rustflags; each repo owns its rustflags#1
HarryR merged 2 commits into
mainfrom
rustflags-per-repo

Conversation

@HarryR

@HarryR HarryR commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What

Remove the musl [target.*] rustflags from the workspace-shared /src/.cargo/config.toml, leaving only the workspace-wide [env] SOURCE_DATE_EPOCH. Rustflags now live in each repo's own .cargo/config.toml.

Why

The sibling repos (stage0 #8, stage1 #17) are dropping the global ENV RUSTFLAGS from their Dockerfile.build in favor of per-target .cargo/config.toml. That global env var was load-bearing: it overrode all config rustflags uniformly, masking two problems that surface once it's gone:

  • CI reproducibility: CI checks out each repo alone, with no workspace parent and CARGO_HOME redirected to an empty dir, so this shared file is never present in CI. A repo relying on it would build differently in CI than locally.
  • Cargo concatenates rustflags across config files (a sub-repo's does not override the workspace's, contrary to the old comment here). A musl repo that also declares its own rustflags (stage1, os402) got them doubled, changing every binary's -Cmetadata and thus its bytes.

Keeping only [env] here, with each repo self-sufficient, makes dev and CI load an identical single flag set.

Impact

  • stage0, stage1, os402 — self-sufficient (own configs). stage0 gains one in its PR.
  • vaportpm, vaportpm-zk — gnu-host by default; unaffected unless they manually --target musl, in which case they now add their own rustflags.

Verification

With the repo Dockerfiles dropping their RUSTFLAGS and this change in place, the measured binaries hash identically to before: stage0.efi, ena.efi, payload.efi, stage1, stage2, and the linux.efi UKI. stage0 smoke-boot 5/5 and the stage1 chain (SIGN=1 / MANIFEST=1 / SIGN_ARGS=1) pass.

Merge alongside lockboot/stage0#8 and lockboot/stage1#17.

🤖 Generated with Claude Code

The shared config defined the musl static-link rustflags for the whole
workspace. That interacts badly with two things:

- Reproducibility: CI checks out each sub-repo alone, with no workspace parent
  and CARGO_HOME redirected, so it never sees this file. A repo relying on the
  shared rustflags would build differently in CI than locally.
- Cargo concatenates rustflags arrays across config files (a sub-repo's does NOT
  override the workspace's, despite the old comment here). So a musl repo that
  also defines its own rustflags (stage1, os402) got them doubled once the
  masking global ENV RUSTFLAGS in the repo Dockerfiles is removed, which changes
  every compiled binary's -Cmetadata and thus its bytes.

Keep only the workspace-wide [env] (SOURCE_DATE_EPOCH). Rustflags now live in
each repo's own .cargo/config.toml: stage0, stage1 and os402 are self-sufficient;
the gnu-host repos (vaportpm, vaportpm-zk) build gnu by default and opt into musl
per build if they ever need it. Verified: with the repo Dockerfiles dropping
their global RUSTFLAGS and this change in place, stage0.efi / ena.efi /
payload.efi / stage1 / stage2 / linux.efi all hash identically to before.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@HarryR HarryR marked this pull request as ready for review July 9, 2026 13:18
Halve the header block, keeping the two non-obvious facts (CI checks each repo
out alone, so each must be self-sufficient; cargo concatenates rustflags across
config files, so do not duplicate) and the no-[build]-target reason. No config
change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@HarryR HarryR merged commit 7ebd396 into main Jul 9, 2026
@HarryR HarryR deleted the rustflags-per-repo branch July 9, 2026 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant