@@ -891,24 +891,6 @@ CompileFlags compute_flags(const BuildPlan& plan) {
891891 // nothing below re-decides it. The flags land in the PER-UNIT channel
892892 // (`unit_ldflags`) rather than the global one because two roles in the
893893 // same build may hold different contracts.
894- // ⭐⭐ AND NOT AT ALL WHEN THE C++ RUNTIME IS ALREADY IN THE OBJECTS.
895- //
896- // Every answer this block can give names a runtime to LINK — the system's
897- // (`-lc++`), the toolchain's (`-load_hidden …/libc++.a`), or a static form
898- // of one of them. All three are right when the runtime is something the
899- // artifact has to be joined to, and all three are wrong when a package in
900- // the graph already compiled one for this target and its objects are on
901- // the link line.
902- //
903- // ⚠️ Measured 2026-08-23, immediately after the format decision above was
904- // corrected to key on the target. `aarch64-macos` had been falling through
905- // to `Elf`, where this block contributes nothing — so a wrong answer to one
906- // question was masking a second wrong answer to another:
907- //
908- // ld64.lld: error: library not found for -lc++
909- //
910- // ⇒ There is nothing to find, and nothing to look for.
911- if (!plan.toolchain .targetCxxRuntime )
912894 {
913895 namespace dist = mcpp::build::dist;
914896 auto const & bc = plan.manifest .buildConfig ;
@@ -1065,6 +1047,11 @@ CompileFlags compute_flags(const BuildPlan& plan) {
10651047 // "incompatible with elf64lriscv". See MechanismInput::freestanding.
10661048 if (auto ft = mcpp::toolchain::triple::parse (plan.toolchain .targetTriple ))
10671049 mi.freestanding = ft->is_freestanding ();
1050+ // ⭐⭐ AND THE HOSTED FORM OF THE SAME FACT. A package in the graph has
1051+ // compiled a C++ runtime FOR THIS TARGET and its objects are on the
1052+ // link line — so, exactly as on bare metal, every archive the table
1053+ // below would reach for is the HOST's.
1054+ mi.graphCxxRuntime = plan.toolchain .targetCxxRuntime ;
10681055
10691056 const bool wantsArchives =
10701057 (base == dist::Contract::SelfContained
0 commit comments