Repository navigation
Description
Repository: mcpp-community/mcpp
Priority: low; independent documented-contract compatibility bug.
Duplicate check (2026-12-06): No exact duplicate found in the documented search scope; low-priority documented-contract compatibility issue candidate
Live-source check: the owning current-main source still contains the relevant pattern. This is a static check, not a new runtime reproduction of current main. Search results are bounded and do not prove that no duplicate exists.
Summary
mcpp documents tools.ld as an actual linker selection for a local Clang tree, not merely toolchain identity metadata. It implements that selection by adding --ld-path=<override> to project and build-program links. With the observed Clang 22.1.8, targeting x86_64-pc-windows-msvc, the MSVC linker route does not consume that option: a direct native probe reports it as unused, and the pinned driver source selects its linker through another route.
This is an mcpp compatibility bug against its documented tool-selection contract, not a claim that Clang's ordinary MSVC driver behavior is a Clang defect. It is separate from automatic local-tree linker discovery and the local -B repair described in draft 03. That repair deliberately excludes explicit tools.ld choices and does not fix this issue.
Public contract and current source
The cached public main inspected on 2026-12-06 is b30e9bc0218730f7ef3b8a9c163ecc31d97aa88e. Its toolchain documentation, lines 601–614, says:
tools = { ld = … }is read by a clang tree, where the linker reaches the link as--ld-path.
It explicitly refuses the GCC case because a stated tool taking no part in the build is what the mechanism is intended to prevent. The capability table likewise states:
linker (clang):
tools.ldthrough--ld-path; else-fuse-ld=lldwhen the tree has lld; else the driver's default
The next paragraph promises the same words for project links and build-program links. No MSVC-target exception is stated in that contract.
Static inspection of that same public revision finds:
src/build/flags.cppm:2851–2870: a Clangtool_override("ld")appends--ld-path=to the C++ and C link flags, with no MSVC-route selector alternative in that block.src/toolchain/hostflags.cppm:652–669: the build-program link tokens use the same--ld-path=mapping.
This is current-main source/contract inspection, not a current-main CLI runtime reproduction. The runtime/compiler observations below are pinned independently and must not be presented as a freshly executed 2026.12.6.2 mcpp test.
Observed native driver behavior
The investigation originally used mcpp runtime 2026.12.4.1, with private source baseline 332fea767afbb04207bb3f2a1806b64be5da0ca4. The actual native compiler reports Clang 22.1.8, target x86_64-pc-windows-msvc; its executable SHA-256 is 986af49c2d1eefeac324f724ff54597753d1053927fa5d58a37a457f578e1cf8.
A recorded real Windows LPAC probe stages the compiler and lld-link.exe under the permitted sandbox view Z:/bin/probe, sets PATH to that view, and supplies this source:
extern "C" int mainCRTStartup() { return 0; }The exact driver argument sequence was:
Z:/bin/probe/clang++.exe main.cpp -fintegrated-cc1 -nostdlib `
-fuse-ld=lld --ld-path=Z:/bin/probe/lld-link.exe `
-Wl,/entry:mainCRTStartup -Wl,/subsystem:console -o hello.exeObserved diagnostic:
clang++: warning: argument unused during compilation: '--ld-path=Z:/bin/probe/lld-link.exe' [-Wunused-command-line-argument]
The step exited 1 and also reported a permission-denied failure using an ungranted physical backing spelling. The receipt verifies that the input and executable were unchanged. The warning establishes that this invocation did not use the stated --ld-path selection; the permission-denied line alone would not establish why.
This native probe calls Clang directly. It is not an end-to-end mcpp project configured with tools.ld. The connection to mcpp is the documented contract plus the inspected source mapping, which emits the same ineffective selector for this driver route. No nonexistent-linker override experiment is claimed here.
Pinned driver explanation
The audited primary LLVM sources are pinned to llvmorg-22.1.8:
clang/lib/Driver/ToolChains/MSVC.cpp:282–290reads-fuse-ld, mapslldtolld-link, and later callsGetProgramPathat line 421.clang/lib/Driver/ToolChain.cpp:1103–1130consumes--ld-pathin the genericGetLinkerPathimplementation. The observed MSVC link route does not call that implementation.
The issue is therefore not that a valid override was rejected by its selected linker. The selected driver route does not use mcpp's chosen override mechanism in the first place. No assertion about all Clang releases, other target ABIs, or an upstream LLVM regression is intended.
Expected behavior and bounded repair discussion
For a supported Clang/MSVC tree, a stated tools.ld should actually select that executable. If mcpp cannot support explicit selection for a particular route, it should refuse that unsupported combination clearly rather than record the override and run some other linker.
A repair should preserve the explicit choice across project C links, project C++ links and build-program links. A driver-specific selector may be appropriate, but its quoting, executable-name handling and precedence need tests. This draft does not propose silently replacing an arbitrary explicit executable with a -B directory search: a directory containing a linker with the wrong name is not equivalent to selecting the user's stated program.
Suggested acceptance checks, not completed tests:
- A uniquely named tracing linker/wrapper set through
tools.ldis actually invoked on the MSVC ABI, including its exit status. - A nonexistent or non-executable explicit override fails clearly rather than silently selecting a default sibling/PATH linker.
- Explicit selection retains precedence over automatic local-tree discovery, for C, C++ and build-program links.
- Other supported Clang target routes keep their existing explicit override behavior.
Verification boundary
No fix for explicit tools.ld is implemented or validated in this draft. The existing local automatic -B patch intentionally returns no prefix when an explicit override exists.
The prior combined original-chain acceptance passed a frozen Agent Debug/Release executable × default/custom-home four-cell gate after other local repairs. The fixture itself always invoked mcpp pack --profile release. That gate does not exercise this explicit override contract, does not validate both mcpp project profiles, and must not be cited as proof this issue is fixed. A current-main mcpp tools.ld end-to-end reproduction remains a follow-up, distinct from the source/driver evidence above.
Activity
speak-agent commentedon Dec 6, 2026
Fixed in 2026.12.7.1 (#1054). A stated
tools.ldnow reaches the driver on every route:--ld-pathfor ELF, Mach-O and MinGW, an absolute-fuse-ldfor wasm, and-B<dir> -fuse-ld=<name minus .exe>on the MSVC ABI, where--ld-pathwas reported unused (SPEC-006 §3.12, docs/20). A stated linker namedlinkorlldis refused on the MSVC ABI with the remedy named. A Windows e2e case starts a stated linker under another file name and asserts the driver ran it.