Skip to content

Commit b5c340d

Browse files
committed
fix(linkmodel): key the PE early-out on the target, not the host
The Windows-host if-constexpr broke the linkmodel contract tests on Windows CI (they resolve synthetic Linux-shaped toolchains anywhere). Target-keyed is also the semantics a future cross build needs.
1 parent ab96534 commit b5c340d

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/toolchain/linkmodel.cppm

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,12 @@ ToolchainLinkModel resolve_link_model(const Toolchain& tc) {
228228
lm.clangDriver = is_clang(tc);
229229
lm.clangWithCfg = resolve_clang_driver(tc).hasCfg;
230230

231-
// Windows / PE: no ELF loader, no rpath, no glibc payload/sysroot model.
231+
// PE targets: no ELF loader, no rpath, no glibc payload/sysroot model.
232232
// MSVC-ABI Clang gets STL+SDK via the driver, MinGW is self-contained —
233-
// both want CLibMode::None. Explicit early-out rather than relying on
234-
// "no payloads found" falling through to the same answer.
235-
if constexpr (mcpp::platform::is_windows) return lm;
233+
// both want CLibMode::None. Keyed on the TARGET (not the host) so the
234+
// ELF resolution below stays testable anywhere and a future
235+
// cross-compile resolves by what it builds FOR.
236+
if (is_msvc_target(tc) || is_mingw_target(tc)) return lm;
236237

237238
auto payload_first = [&] {
238239
auto& pp = *tc.payloadPaths;

0 commit comments

Comments
 (0)