fix: keep multi-target executables independent of sibling shared targets - #761
Merged
Sunrisepeak merged 3 commits intoOct 5, 2026
Conversation
Retain a member's own module and implementation objects when it also produces a shared target. Keep declared external shared dependencies and test independent executable linkage with the sibling library removed.
4 of 5 tasks
18 tasks
6 of 7 tasks
Sunrisepeak
added a commit
that referenced
this pull request
Oct 5, 2026
…ow-ups of #766 (#767) mcpp run, mcpp run -q --release and the named runners now give the program the terminal. On POSIX mcpp replaces itself with the program once the build is done; on Windows the program runs in mcpp's console and process group while mcpp ignores Ctrl-C. A death by signal reaches the caller as that signal, and closing notices precede the Running line. The follow-ups of #761, #763 and #765 recorded in #766: members and artifacts link the shared dependencies of the statics placed in their own image and not the objects of statics placed in another image; exports narrows discovered symbols on the MSVC ABI, with a warning beside source declarations and an error for an empty surface a program of the build links; auto_export is renamed windows_auto_export before its first release under SPEC-004 section 5.3; build-program glob inputs share the walk of sources globs, report unwatchable patterns, match absolute patterns and refuse patterns leaving a registry or git dependency; run_all.sh bounds each test where GNU timeout is absent. SPEC-004 v1.11 and SPEC-009 v0.2. Closes #766.
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
A package with both
sharedandbintargets must build each executable from its own implementation. Workspace-member planning instead omitted the owner's objects, while artifact planning could link the owner's sibling DLL through an unrelated consumer. A build-only request for a tool from such a package also left an empty shared-library target in the consuming plan.Keep the owner's module and implementation objects in independently linked executables, and collect artifact shared links from that program's own dependency closure. Mark packages reached only through build-time edges and omit their shared products from the target plan. A provider also reached through a target-side edge retains its shared products.
Closes #760.
Criteria
880_a_members_executable_keeps_its_own_implementation.shexercises a module interface, separate implementation unit, static dependency, external shared dependency,--workspace, and explicit member selection. The original case failed against freshly built, unmodified6e3cb974with undefinedanswer()andinterface_value()symbols. It passes with the patch.cc5234c: the shipped EXE depended on its sibling shared library. It now passes, including feature-gated artifact selection and--workspace. Every runtime placement of the sibling library is removed before running the executable; external consumers still require that shared library.target 'dual_dll' (shared library) has no inputs to link. It now passes. The test also adds a target-side dependency on that same provider, runs the consumer through its shared library, and verifies that the shared product exists.00,01,836, and872pass on Windows. E2E 872 checks that changing workspace selections does not recompile shared compile units. GCC/ELF-specific host-tool and shared-image tests are left to their corresponding CI hosts.unit/test_modgraphfails inGlob.EscapedSpellingIsUtf8WhateverTheNamewith a Windows code-page conversion exception. A clean, freshly built6e3cb974reproduces that same failure. This pre-existing failure is not changed by this PR.llvm-readobj --coff-importsconfirms that the sibling DLL is absent; external FFmpeg and SDL dependencies remain.Intersections
-p shipped, requested feature, then--workspacedep_binbuild.mcppexecutes the toolCompatibility
No manifest keys or defaults change. Executables belonging to a multi-target package link their own code, including when requested as artifacts or tools. Ordinary library consumers retain shared-library linkage. Build-only packages no longer create empty shared link units in the target build; a package also requested as a target dependency remains available. Automatic exports and LTO handling are unchanged.
Checks before merging
PYTHONUTF8=1.python3 .github/tools/check_workflow_assertions.pypasses (22 workflows, 0 problems).git diff --checkpass.git log origin/main..HEAD -i --grep='Co-Authored-By'prints nothing.C:\Users\...inMCPP_HOMEwas not normalized before being written into TOML. The shared fixture helper now normalizes drive-absolute paths, and E2E 00 checks native and mixed Windows spelling plus relative-path preservation. E2E 880 passes locally with native WindowsMCPP_HOME. The new CI run verifies commit19637260; its results are pending.fix: keep multi-target executables independent of sibling shared targets. Suggested body:Retain executable-owned objects and declared shared dependencies in workspace and artifact plans, omit host-only shared products from consumers, and cover artifact/tool and dual-role providers. Closes #760.