Repository navigation
Description
Repository: mcpp-community/mcpp
Duplicate check (2026-12-06): No exact duplicate found in the documented search scope; scoped new-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
When a local LLVM tree is supplied through an allowed Windows sandbox spelling, mcpp invokes the supplied Clang driver through that spelling but does not supply the equivalent linker-program search prefix. Clang's MSVC linker route can then rediscover lld-link beside the driver's physical installation path. In an LPAC that grants the supplied view but not the backing directory, the compiler starts but its linker launch fails with permission denied.
This is an mcpp/local-toolchain integration issue demonstrated with Clang's existing driver behavior, not a claim that Clang's normal program search is itself a Clang bug. Adding the allowed directory to PATH alone did not prevent the earlier physical sibling from being selected.
Pinned environment
- mcpp runtime version:
2026.12.4.1; private source baseline:332fea767afbb04207bb3f2a1806b64be5da0ca4. - The actual driver under test reports Clang 22.1.8, targeting
x86_64-pc-windows-msvc. The compiler executable SHA-256 was986af49c2d1eefeac324f724ff54597753d1053927fa5d58a37a457f578e1cf8. - Windows x86-64, real LPAC execution. The source/object and both executable leaves were staged explicitly. The allowed view was
Z:/bin/probe; the different backing path was not granted to the child. - The minimized object has no CRT dependency, deliberately separating this failure from the subsequent default-library issue.
The Z: paths below are the sandbox's supplied view, not personal host paths. A normal unrestricted shell may not reproduce the denial because it can access both spellings.
Expected / actual
Expected: for an automatically selected linker in a supplied local Clang/MSVC tree, use the corresponding supplied directory spelling when invoking its lld-link, without adding a backing-directory grant.
Actual: the driver starts through the supplied view, but the selected linker path uses the ungranted backing directory:
<physical-backing-directory>/bin/probe/lld-link: permission denied
clang++: error: linker command failed with exit code 1
The path in this excerpt is redacted; the failure and exit code are observed.
Minimal recipe and isolated A/B
Prepare a freestanding object outside the restricted child, then stage it with clang++.exe and lld-link.exe:
extern "C" int mainCRTStartup() { return 0; }For example, compile it with the same pinned compiler without adding a CRT-selection flag:
clang++ -c main.cpp -o main.objRun the link in an LPAC that can execute the two staged leaves through Z:/bin/probe, can write its workspace, and cannot execute them through the physical backing path. PATH contains the supplied view. The recorded link commands were:
# A: fails, exit 1; physical lld-link path is selected.
Z:/bin/probe/clang++.exe main.obj -nostdlib -fuse-ld=lld `
-Wl,/entry:mainCRTStartup -Wl,/subsystem:console -o hello.exe
# B: same object, compiler, linker and policy; only the -B word is added.
# Succeeds, exit 0.
Z:/bin/probe/clang++.exe main.obj -nostdlib -fuse-ld=lld `
-BZ:/bin/probe -Wl,/entry:mainCRTStartup `
-Wl,/subsystem:console -o hello.exeThese are separate fresh restricted runs, not an unrestricted-host comparison. The receipts verify unchanged staged inputs and executables. No DACL, token, directory grant or handle inheritance change was made. This establishes the link-search differential; it does not independently exercise all of mcpp's planning or package bootstrap code.
In the original mcpp scenario, MCPP_TOOLCHAIN=path:<supplied-local-LLVM-tree> selected the same tree. A freestanding project was built by mcpp pack --profile release --pkg-format dir; the generated link reached this same failure after earlier, separately diagnosed blockers had been corrected.
Source / driver boundary
At the pinned mcpp baseline, the relevant generation sites are:
src/build/flags.cppm: project C and C++ link flags.src/toolchain/hostflags.cppm: build-program/host link tokens.
The audited LLVM source is pinned to llvmorg-22.1.8:
ToolChains/MSVC.cpp: the MSVC link job translates-fuse-ld=lldtolld-linkand usesGetProgramPath.Driver.cpp,Driver::GetProgramPath: explicit-Bprefixes are searched before toolchain program directories and PATH.
Importantly, this MSVC route does not consume --ld-path through the generic ToolChain::GetLinkerPath route. The local fix below does not repair the separate explicit tools.ld/--ld-path limitation, and must not silently replace an explicit linker choice.
Local patch strategy and verification boundary
A focused mcpp.toolchain.clang_program_search leaf returns a prefix only when all of these hold:
- Compiler is Clang, target ABI is MSVC, and the tree is local.
- No explicit
tools.ldoverride is present. lld-linkexists under the suppliedlocalRoot/bin, or the supplied driver's sibling directory.
Keep that spelling rather than canonicalizing it. Add -B<supplied-directory> to project C/C++ link flags and build-program link tokens, not compile flags. Managed compilers, other compiler families/ABIs, missing LLD and explicit linker overrides remain unchanged. No sandbox permission expansion is part of the patch.
Local tests passed for the five helper cases and two flag/caller-parity cases; the actual leaf runtime probe also checked seven individual conditions. The final Windows regression selection across this and the CRT issue reported 43 passed, 0 failed, and 10 explicitly skipped; this is not the full upstream suite.
The original frozen-Agent Debug/Release executable × default/custom-home four-cell integration gate passed with the combined local repair stack. The Debug/Release dimension selects the Agent executable; the fixture itself invokes mcpp pack --profile release, so this is not validation of both mcpp output profiles. It is not an isolated four-cell A/B for this issue, nor evidence that --ld-path, all LLVM versions, Unicode/UNC paths, every sandbox race, or native macOS/Linux were validated. The provider/bootstrap warnings retained in that gate are separate issues.
Activity
speak-agent commentedon Dec 6, 2026
Fixed in 2026.12.7.1 (#1054). The linker of a clang tree named by path is one fact (
tools.ld, else the tree's lld of the link's flavour) and reaches the driver by its address; on the MSVC ABI that is-B<dir> -fuse-ld=<name>, measured with-###on LLVM 23.1.3 (SPEC-006 §3.12). Every clang driver mcpp starts is also given-no-canonical-prefixes, so it does not rediscover its tools through a physical path (SPEC-020 §9). The e2e cases for the tree's linker run on Linux and Windows.