Repository navigation
Conversation
added 2 commits
October 3, 2026 09:46
…independent - with-sha256: the driver compiled it in-process and dropped the target's declared environment (Target.with_env reached only actions), so the D50 prefix map never applied and its debug map (N_SO/N_OSO) named the worktree. The driver now sets a target's declared env around an in-process compile (src/main.w build_graph_apply_target_env), the env keys the target (BuildGraphCache signature), and build.w declares WITH_FILE_PREFIX_MAP for with-sha256 from the one owner of the mapping (build/compiler.w compiler_file_prefix_map). - bootstrap-/stage1-llvm-link-metadata: the rsp, llvm_cc and llvm_ld named the SDK and darwin sysroot by absolute path. They are written relative to the root, and every process that reads them (stage compiles, emit-c's C driver) runs in the root. - sdk-clang-main: wrote libclangMain.a into the SDK under .deps. The SDK is read only; a built archive is its declared output under out/gen/sdk-clang-main, keyed on sdk.lock, compiled with -ffile-prefix-map. - sysroot-zig-source (Linux): extracted into .deps/src. Removed; each linux sysroot target fetches the pinned source into its own scratch as darwin-sysroot does, declares its tree, and maps the root out of the glibc objects. - The store's root check and its <root> spelling treat the root as a whole path: a sibling sharing its prefix is not the root (stage1's seed-input.json naming <root>-drivers/with was refused), and <root>=/with-src is spelled portably.
…inks to the same bytes every time link_stage_make_archive (src/compiler/Link.w) wrapped each runtime object in <obj>.<pid>.<nanos>.a for the link and deleted it after; the debug map (N_OSO) records the archive's path, so two links of with-sha256 from one tree differed in that name, LC_UUID and the signature. The archive is now <obj>.ar-<sha256/16>.a, made under a per-link name and renamed into place, and kept. The process-wide registry of temporaries it fed is gone; the sweep of a process's own leftovers stays. The in-process env test also builds the tool a third time with no store and compares bytes.
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.
Fixes #2016. A second fresh worktree's
:devnow re-runs none of the targets the issue lists: all of them come from the build store.Root causes and fixes
src/main.w, the kind 0/1/3/4 branches). Before this change it ignored the target's declared environment there, becauseTarget.with_envonly reached actions. As a result the D50 prefix map never applied, and the binary's debug map (N_SO/N_OSO) named the worktree.build_graph_apply_target_env/build_graph_restore_target_env).build_cache_signature_parts).build.wdeclaresWITH_FILE_PREFIX_MAPfor with-sha256. The value comes from the one owner of that mapping,compiler_file_prefix_mapinbuild/compiler.w.link_stage_make_archive(src/compiler/Link.w) named each runtime archive<obj>.<pid>.<nanos>.a, and N_OSO records that name. So two links of the same program differed. The archive is now named by content (<obj>.ar-<sha16>.a), renamed into place, and kept.run_generate_llvm_link_metadata_actionwrote absolute paths to the SDK archives, the darwin-syslibroot/-isysroot,llvm_ccandllvm_ld.comp_root_relative_text).comp_run_compiler_captureand emit-c'semitc_run_capture_envnow userun_capture_cwd_with_env(root).write_scope(".deps")and wrotelibclangMain.ainto the SDK.out/gen/sdk-clang-main/libclangMain.a, keyed onsdk.lockand compiled with-ffile-prefix-map.comp_host_has_clang_main..deps/src. The target is removed.sdk_materialize_zig_source), the same way darwin-sysroot does.build_cache_store_names_rootusedcontains(root). It refused stage1 becauseseed-input.jsonrecorded a driver at<root>-drivers/with. It now matches the root only as a whole path.build_cache_store_portablenow writes<root>wherever the root is a whole path, including<root>=/with-src. Before, an env value naming the root made a different key in every worktree.Evidence
:dev, darwin, one store, with a driver built from the tree on each side::dev, linux-x86_64 (eric-5090): 0 ran, 63 restored (linux-sysroot included), wall 11.0 s. Nothing was written under.deps/src.test/behavior/behav_2016_build_store_env_key_and_root_boundary.wtest/behavior/behav_2016_build_store_in_process_env.wsrc/main build :gate: green (1143.7 s).out/release/bin/with check build.wandcheck lib/std/build.w: ok.src/main build :fixpoint: stage2 == stage3 over all 16 units.Not covered
:installgroup copies the link records to$INSTALL_LIBDIR. They are now root-relative. They used to point into the worktree that built them.