Skip to content

R9: support independent Windows MSVC and MinGW profiles - #202

Closed
cpunion wants to merge 57 commits into
codex/windows-r9-main-base-20260829from
codex/windows-r9-native-toolchain-20260827
Closed

cpunion wants to merge 57 commits into
codex/windows-r9-main-base-20260829from
codex/windows-r9-native-toolchain-20260827

Conversation

@cpunion

@cpunion cpunion commented Aug 27, 2026 •

Copy link
Copy Markdown
Owner

Part of xgo-dev/llgo#2325.

R8 (xgo-dev/llgo#2425) and native Windows calling-convention support (xgo-dev/llgo#2433) are merged. This branch is rebased onto the current xgo-dev/llgo main. All remaining LLGo modules use the released github.com/goplus/lib v0.5.0; no temporary fork replacement remains. The compiler fixtures retain the consolidated module layout from main.

Summary

  • add independent native windows/amd64 MSVC and GNU/MinGW profiles without changing GOOS, GOARCH, Go flags, or the existing -target meaning;
  • when CC is unset, probe the effective target of the default Clang: official standalone LLVM selects x86_64-pc-windows-msvc, while MSYS2 CLANG64 selects x86_64-w64-windows-gnu;
  • keep optional CC, CXX, and -ldflags=-extld=... overrides Go-compatible, including quoted compiler commands and empty external-linker flag values;
  • propagate the resolved physical triple and ABI through SSA code generation, C ABI lowering, libffi selection, linker/archive/import-library handling, dependency discovery, and package-cache fingerprints;
  • reject non-Clang drivers, unsupported clang-cl syntax, architecture/ABI mismatches, and MSYS/Cygwin output targets rather than inferring the ABI from executable paths or the invoking shell;
  • make the MSVC profile use official full-target LLVM 19, the Visual Studio SDK/UCRT, and native vcpkg dependencies without resolving compiler libraries from MSYS2;
  • make the MinGW profile use CLANG64 LLVM 19, its GNU/UCRT C++ runtime, and isolated dependencies without inheriting Visual Studio SDK/toolset identity;
  • provide profile-local pkg-config discovery for PowerShell/cmd and POSIX-style shells, so normal installed use requires no profile-selection environment variables;
  • run both profiles through the existing Windows Go, LLGo, hello, demo, GOROOT, docs-local, build-cache, benchmark, runtime, and relevant coverage matrices;
  • keep native exe, c-archive, and c-shared artifacts interoperable within each profile, including explicit MinGW COFF import-library generation;
  • audit artifacts and environment identity so the MSVC lane cannot acquire msys-2.0.dll, cygwin1.dll, or libwinpthread, and the MinGW lane cannot silently reuse MSVC SDK/vcpkg state.

User-facing selection

No LLGo-specific profile variable is required:

GOOS=windows GOARCH=amd64 llgo build ./...

LLGo probes the default Clang target and appends the matching canonical target internally. Explicit CC, CXX, and external-linker settings remain optional Go-compatible overrides. CI verifies installed llgo.exe again with CC, CXX, PKG_CONFIG, and PKG_CONFIG_PATH unset from the normal profile shell.

Dependency boundary

The root compiler module and all demo/tool modules resolve the released github.com/goplus/lib v0.5.0. The old github.com/cpunion/lib replacements and the obsolete per-fixture modules are removed. The old standalone runtime/internal/clite/libuv/_demo module is also removed because it is neither runtime implementation nor test coverage.

Validation

After rebasing onto current main:

  • range-diff preserves all 55 effective R9 commits and drops only four obsolete fork/fixture-isolation commits;
  • go test ./cl -run ^TestRunAndTestFromTest(go|py|libc)$ passes on macOS ARM64 with Go 1.27;
  • focused dependency-fingerprint and Darwin non-LTO/full-LTO/external-full-LTO integration tests pass;
  • the full local run passes goroot, standard-library, C ABI, cross-compilation, SSA, and related packages;
  • the remaining macOS TestMainGoexitLifecycleReleasedOnce rerun passed twice and hit the existing thread_get_state failed timing fault once; this file is unchanged by R9 and the fresh CI matrix is authoritative.

The pre-rebase R9 revision passed all 57 CI checks. The newly pushed revision reruns the complete MSVC/MinGW and non-Windows matrices.

Deliberate boundaries

  • R9 qualifies both amd64 profiles. Native Windows ARM64 and WoW64 386 MSVC execution remain R10; their remaining GNU/MinGW qualification remains R11.
  • MSYS2 and Cygwin are invocation shells, not target ABIs. Full Cygwin shell smoke and clean release packaging remain R12.
  • clang-cl syntax and non-Clang drivers fail clearly until a complete driver-dialect implementation exists.
  • Remote installation remains outside the Windows matrix; Windows docs coverage continues to use the local installation paths established by R8.

@cpunion cpunion added the windows Windows platform support label Aug 27, 2026
@cpunion
cpunion force-pushed the codex/windows-r8-on-r7-integration-20260826 branch from 63831cd to 798ad5c Compare August 27, 2026 12:17
@cpunion
cpunion force-pushed the codex/windows-r9-native-toolchain-20260827 branch 2 times, most recently from a163341 to a43170a Compare August 27, 2026 20:58
@cpunion cpunion changed the title windows: remove MSYS2 from the native host toolchain (R9, depends on #2425) windows: support independent MSVC and MinGW profiles (R9, depends on #2425) Aug 27, 2026
@cpunion
cpunion force-pushed the codex/windows-r9-native-toolchain-20260827 branch from bb8478e to 8d3336a Compare August 28, 2026 05:05
@cpunion cpunion changed the title windows: support independent MSVC and MinGW profiles (R9, depends on #2425) windows: support independent MSVC and MinGW profiles (R9, depends on xgo-dev/llgo#2433) Aug 28, 2026
@cpunion
cpunion changed the base branch from codex/windows-r8-on-r7-integration-20260826 to codex/windows-stdcall-2431-20260828 August 28, 2026 05:05
@cpunion
cpunion force-pushed the codex/windows-r9-native-toolchain-20260827 branch 3 times, most recently from 031d00c to 1ed1104 Compare August 28, 2026 08:48
@cpunion
cpunion marked this pull request as ready for review August 28, 2026 10:40
@github-actions

github-actions Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

LLGo baseline benchmarks

5c5f4a58b901 | workflow run | long-term charts

Program measurements

Platform Workload File size vs base Text size vs base Build vs base Run vs base
Linux cprintf 19432 B 0 B / +0.0% 387 B 0 B / +0.0% 354.573 ms +18.83 ms / +5.6% (worse) 1.421 ms +71.86 us / +5.3% (worse)
Linux cprintf-lto 19264 B 0 B / +0.0% 368 B 0 B / +0.0% 369.381 ms +31.95 ms / +9.5% (worse) 1.480 ms +117.4 us / +8.6% (worse)
Linux fmtprintf 1652216 B 0 B / +0.0% 501874 B 0 B / +0.0% 2.733 s +246.9 ms / +9.9% (worse) 4.028 ms +315.1 us / +8.5% (worse)
Linux fmtprintf-lto 1524168 B 0 B / +0.0% 460334 B 0 B / +0.0% 8.797 s +226.8 ms / +2.6% (worse) 3.530 ms -13.22 us / -0.4% (better)
Linux println 62264 B 0 B / +0.0% 15286 B 0 B / +0.0% 354.217 ms +6.601 ms / +1.9% (worse) 1.748 ms +17.27 us / +1.0% (worse)
Linux println-lto 54096 B 0 B / +0.0% 12914 B 0 B / +0.0% 539.191 ms +24.42 ms / +4.7% (worse) 1.718 ms +21.79 us / +1.3% (worse)
macOS cprintf 84480 B 0 B / +0.0% 16669 B 0 B / +0.0% 501.429 ms +56.24 ms / +12.6% (worse) 3.316 ms +331.4 us / +11.1% (worse)
macOS cprintf-lto 100704 B 0 B / +0.0% 16649 B 0 B / +0.0% 420.030 ms -128.7 ms / -23.5% (better) 2.713 ms -260.1 us / -8.7% (better)
macOS fmtprintf 1512800 B 0 B / +0.0% 882816 B 0 B / +0.0% 2.703 s +399.9 ms / +17.4% (worse) 12.844 ms +7.747 ms / +152.0% (worse)
macOS fmtprintf-lto 1208464 B 0 B / +0.0% 875856 B 0 B / +0.0% 7.969 s +1.424 s / +21.7% (worse) 6.841 ms +551.3 us / +8.8% (worse)
macOS println 114784 B 0 B / +0.0% 35101 B 0 B / +0.0% 380.113 ms -16.31 ms / -4.1% (better) 3.120 ms -859.9 us / -21.6% (better)
macOS println-lto 118656 B 0 B / +0.0% 32753 B 0 B / +0.0% 521.649 ms -48.9 ms / -8.6% (better) 3.387 ms -596.8 us / -15.0% (better)
Windows MinGW cprintf 19456 B new 4566 B new 879.106 ms new 3.530 ms new
Windows MinGW cprintf-lto 17920 B new 4486 B new 904.435 ms new 3.495 ms new
Windows MinGW fmtprintf 1918464 B new 591718 B new 3.788 s new 9.151 ms new
Windows MinGW fmtprintf-lto 1967616 B new 583190 B new 10.075 s new 8.656 ms new
Windows MinGW println 74240 B new 25062 B new 871.376 ms new 7.337 ms new
Windows MinGW println-lto 67584 B new 21734 B new 1.146 s new 6.963 ms new
Windows MSVC cprintf 12288 B new 4326 B new 594.597 ms new 3.563 ms new
Windows MSVC cprintf-lto 11776 B new 4166 B new 625.774 ms new 3.494 ms new
Windows MSVC fmtprintf 1459712 B new 591286 B new 3.160 s new 8.035 ms new
Windows MSVC fmtprintf-lto 1502720 B new 589734 B new 8.110 s new 7.767 ms new
Windows MSVC println 47104 B new 25062 B new 610.013 ms new 6.458 ms new
Windows MSVC println-lto 44032 B new 22102 B new 858.581 ms new 6.091 ms new
Core language and compiler benchmarks
Platform Benchmark ns/op vs base
Linux BenchmarkLookupPCRandom 12.300 ns/op +0.05 ns/op / +0.4% (worse)
Linux BenchmarkMergeCompilerFlags 144.400 ns/op +0.4 ns/op / +0.3% (worse)
Linux BenchmarkMergeLinkerFlags 94.850 ns/op +0.61 ns/op / +0.6% (worse)
Linux BenchmarkChannelBuffered 38.340 ns/op -0.09 ns/op / -0.2% (better)
Linux BenchmarkChannelHandoff 25101 ns/op +1671 ns/op / +7.1% (worse)
Linux BenchmarkDefer 47.270 ns/op -0.91 ns/op / -1.9% (better)
Linux BenchmarkDirectCall 1.758 ns/op -0.351 ns/op / -16.6% (better)
Linux BenchmarkGlobalRead 2.110 ns/op +0.001 ns/op / +0.04742% (worse)
Linux BenchmarkGlobalWrite 2.805 ns/op 0 ns/op / +0.0%
Linux BenchmarkGoroutine 30530 ns/op +477 ns/op / +1.6% (worse)
Linux BenchmarkInterfaceCall 8.441 ns/op +0.001 ns/op / +0.01185% (worse)
Linux BenchmarkRuntimeGetG 1.759 ns/op -0.001 ns/op / -0.1% (better)
macOS BenchmarkLookupPCRandom 15.630 ns/op +2.24 ns/op / +16.7% (worse)
macOS BenchmarkMergeCompilerFlags 165.500 ns/op +45.6 ns/op / +38.0% (worse)
macOS BenchmarkMergeLinkerFlags 102.700 ns/op +17.43 ns/op / +20.4% (worse)
macOS BenchmarkChannelBuffered 28.620 ns/op +1.28 ns/op / +4.7% (worse)
macOS BenchmarkChannelHandoff 8762 ns/op -844 ns/op / -8.8% (better)
macOS BenchmarkDefer 42.710 ns/op +6.94 ns/op / +19.4% (worse)
macOS BenchmarkDirectCall 1.237 ns/op +0.143 ns/op / +13.1% (worse)
macOS BenchmarkGlobalRead 1.217 ns/op -0.386 ns/op / -24.1% (better)
macOS BenchmarkGlobalWrite 1.309 ns/op +0.008 ns/op / +0.6% (worse)
macOS BenchmarkGoroutine 38416 ns/op +11819 ns/op / +44.4% (worse)
macOS BenchmarkInterfaceCall 5.230 ns/op +0.328 ns/op / +6.7% (worse)
macOS BenchmarkRuntimeGetG 2.641 ns/op -0.472 ns/op / -15.2% (better)
Windows MinGW BenchmarkLookupPCRandom 14.460 ns/op new
Windows MinGW BenchmarkMergeCompilerFlags 557.100 ns/op new
Windows MinGW BenchmarkMergeLinkerFlags 465 ns/op new
Windows MinGW BenchmarkChannelBuffered 39.020 ns/op new
Windows MinGW BenchmarkChannelHandoff 1543 ns/op new
Windows MinGW BenchmarkDefer 54.130 ns/op new
Windows MinGW BenchmarkDirectCall 1.747 ns/op new
Windows MinGW BenchmarkGlobalRead 1.752 ns/op new
Windows MinGW BenchmarkGlobalWrite 2.792 ns/op new
Windows MinGW BenchmarkGoroutine 75986 ns/op new
Windows MinGW BenchmarkInterfaceCall 10.140 ns/op new
Windows MinGW BenchmarkRuntimeGetG 2.101 ns/op new
Windows MSVC BenchmarkLookupPCRandom 9.451 ns/op new
Windows MSVC BenchmarkMergeCompilerFlags 421.500 ns/op new
Windows MSVC BenchmarkMergeLinkerFlags 372.900 ns/op new
Windows MSVC BenchmarkChannelBuffered 39.910 ns/op new
Windows MSVC BenchmarkChannelHandoff 2124 ns/op new
Windows MSVC BenchmarkDefer 57.570 ns/op new
Windows MSVC BenchmarkDirectCall 0.275 ns/op new
Windows MSVC BenchmarkGlobalRead 0.350 ns/op new
Windows MSVC BenchmarkGlobalWrite 6.969 ns/op new
Windows MSVC BenchmarkGoroutine 65059 ns/op new
Windows MSVC BenchmarkInterfaceCall 4.489 ns/op new
Windows MSVC BenchmarkRuntimeGetG 0.907 ns/op new

Compared with c0efa083f36f measured in the same runner job. Platforms without a paired baseline are marked new.

@cpunion cpunion changed the title windows: support independent MSVC and MinGW profiles (R9, depends on xgo-dev/llgo#2433) windows: support independent MSVC and MinGW profiles (R9, depends on goplus/lib#26) Aug 28, 2026
@cpunion
cpunion force-pushed the codex/windows-r9-native-toolchain-20260827 branch from d813a25 to 0b66e0c Compare August 29, 2026 12:42
@cpunion cpunion changed the title windows: support independent MSVC and MinGW profiles (R9, depends on goplus/lib#26) R9: support independent Windows MSVC and MinGW profiles Aug 29, 2026
@cpunion
cpunion changed the base branch from codex/windows-stdcall-2431-20260828 to main August 29, 2026 12:43
@cpunion
cpunion changed the base branch from main to codex/windows-r9-main-base-20260829 August 29, 2026 12:43
@cpunion cpunion closed this Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

windows Windows platform support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant