Skip to content

Build: an assembled object keys on every file its source .incbin's; embedded-objects objects declare their blobs (#1423, #1435) - #1509

Merged
ehartford merged 1 commit into
mainfrom
fix-1423-embedded-bundle-inputs
Sep 23, 2026
Merged

ehartford merged 1 commit into
mainfrom
fix-1423-embedded-bundle-inputs

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Closes #1423. Closes #1435.

Root cause. An EmbedObjectFiles target's assembly names each blob by .incbin "<path>", so a blob whose bytes change (a .wo bundle rebuilt for a new ABI, a runtime object) leaves the .s identical. Early cutoff (D50) then keeps the CompileAsmObject that assembles it fresh — its only declared input was the .s — and stage2 links out/stage/lib/embedded_objects.o with the previous bundles ("embedded bundle 'tommyds' was built for ABI 787e9ad4… but this compiler is b735dbd0…").

Fix. Two halves, because build.w runs on the pinned seed:

  • build.w: embedded_objects_object() builds every embedded-objects object (bootstrap, stage, release, cross linux x86_64/aarch64, cross windows x86_64/aarch64) from its embed target and declares every blob as an input. Effective with the current seed.
  • runner: a CompileAsmObject records the files its source pulls in by .incbin/.include as discovered dependencies (build_graph_discovered_inputs), so any assembled object keys on them, declared or not.

Evidence.

  • Minimal project (embed target + object), seed as driver: blob BLOB-ONE → BLOB-TWO, [cutoff] 'emb-asm' re-ran to identical outputs, object still contains BLOB-ONE. With the tree's runner: the object is reassembled and contains BLOB-TWO.
  • Under the pinned seed, build --explain bootstrap-embedded-objects-object goes from fresh to stale: input changed: out/bootstrap-lib/empty_rt_linux_x86_64.bin when that blob changes.
  • build --graph for :cross-rt, :cross-rt-windows, :cross-rt-windows-aarch64: each cross object keeps its triple= arg and lists its 22 blobs.

Test. test/behavior/behav_build_asm_incbin_inputs.w: an embed target + object and a hand-written .s with a relative .incbin. Fails with the seed as the p7 compiler (line 50, the object is not reassembled); passes with the tree's stage2; neither object runs when nothing changed.

…he embedded-objects objects declare their blobs (#1423, #1435)

An EmbedObjectFiles target's assembly names each blob by `.incbin "<path>"`,
so a blob whose bytes change (a .wo bundle rebuilt for a new ABI, a runtime
object) leaves the assembly text identical. Early cutoff (D50) then kept the
CompileAsmObject that assembles it fresh: its only declared input was the
.s. stage2 linked out/stage/lib/embedded_objects.o with the previous bundles
("embedded bundle 'tommyds' was built for ABI 787e9ad4... but this compiler
is b735dbd0..."), and every battery since has deleted the object by hand.

Two halves, because build.w runs on the pinned seed:
- build.w: embedded_objects_object() builds each embedded-objects object
  (bootstrap, stage, release, cross linux x86_64/aarch64, cross windows
  x86_64/aarch64) from its embed target and declares every blob as an
  input. Under the current seed, `build --explain
  bootstrap-embedded-objects-object` goes from `fresh` to `stale: input
  changed: out/bootstrap-lib/empty_rt_linux_x86_64.bin` when that blob's
  bytes change.
- runner: a CompileAsmObject records the files its source pulls in by
  `.incbin`/`.include` as discovered dependencies
  (build_graph_discovered_inputs), so any user's assembled object keys on
  them too, declared or not.

test/behavior/behav_build_asm_incbin_inputs.w: an embed target + object and a
hand-written .s with a relative .incbin. With the pinned seed as the driver
the embedded blob's change is cut off and the object keeps the old bytes
(assertion at line 50); with the tree's runner both objects are reassembled,
and neither runs when nothing changed.
@ehartford
ehartford added this pull request to stack #1516 September 23, 2026 15:59
@ehartford

Copy link
Copy Markdown
Contributor Author

Stack #1516 battery (seed-driven, new seed, cold c_import cache, with :drop-audit/:move-audit) on main + #1509 → … → #1515 (head 63e8340): build ok, :fixpoint ok (stage2 == stage3 with DWARF variables), :drop-audit ok, :move-audit ok, :test ok (no reds), :test-green ok, :last-green ok. Merge the stack: gh stack merge 1515 --squash.

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

Labels

None yet

Projects

None yet

1 participant