Repository navigation
Cross-compilation: Windows x86_64 target (COFF link, :cross-rt-windows) - #708
Merged
Merged
Conversation
The post-link version-stamp action (run_patch_version_action) produced the release binary but never created its declared out/command/build extra-output marker, so the action verifier failed every default `with build` and no build state was blessed (forcing full rebuilds). Create the capture dir the same way the sibling run_with_compiler_build_action does.
…t-windows) Extend the Linux-only cross pipeline to Windows x86_64 (kind 5): - TargetSpec: target_spec_cross_supported accepts kind 5. - Link.w: route kind 5 to the existing Windows link recipe using the SDK's lld-link COFF driver (link_stage_coff_lld_for) — links natively on any host, no wine needed for the link; kind 5 -> rt_windows_x86_64.o platform object; make link_stage_make_archive return raw objects for a Windows target (lld-link does not pull members from GNU .a archives on a cross link); make the recipe's MSVC/UCRT/UM libpaths overridable via WITH_WINDOWS_*_LIBDIR so a cross host can point at an xwin-splatted lib tree (C:/... fallbacks kept for on-Windows). - BuildGraphOps: embed generator emits COFF .section .rdata for a windows entry. - build.w: :cross-rt-windows builds the full windows_x86_64 runtime + bridges + COFF-form llvm_ld.rsp into out/lib/cross/windows_x86_64/, mirroring :cross-rt. The llvm_ld.rsp excludes LLVM-C.lib (the import stub for the dynamic LLVM-C.dll) so the statically-linked compiler does not acquire a runtime dependency on a DLL that does not exist — matching the native metadata action. Also fix the platform runtime object name (rt_<platform>.o) for both cross-rt sets. Verified under wine (Linux host): hello-world and args/stdlib programs run; and the cross-compiled compiler itself runs (version) and compiles (emit-obj -> COFF) under wine.
ropoctl
force-pushed
the
cross-windows-x86_64
branch
from
July 24, 2026 06:24
38be8f7 to
feb6ca2
Compare
Collaborator
Author
|
Rebased onto current Update — the compiler now runs AND compiles under wine. Root cause of the earlier bootstrap failure was a bug in this PR's own
|
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.
Windows x86_64 cross-compilation (Linux → Windows, verified under wine)
Adds an
x86_64-pc-windows-msvccross target (kind 5) sowithcan cross-compile Windows PE executables from a Linux host. Builds on the linux_x86_64 cross pipeline.Verified working
A hello-world and a non-trivial program using
std.process.args()cross-compile on Linux and run correctly under wine (exit 0; argv, stdlib,printall fine):Linking is native on Linux (the LLVM SDK's
lld-linkin COFF mode) against an xwin-splatted MSVC CRT + Windows SDK import libs; wine is only used to run the produced exe.Changes (Windows cross enablement)
TargetSpec—target_spec_cross_supportedaccepts kind 5.Link.w— route kind 5 to the Windows link recipe via the COFFlld-linkdriver (link_stage_coff_lld_for); kind 5 →rt_windows_x86_64.o;link_stage_make_archivereturns raw objects for a Windows target (lld-link won't pull members from GNU.aarchives on a cross link); MSVC/UCRT/UM libpaths overridable viaWITH_WINDOWS_{MSVC,UCRT,UM}_LIBDIR(C:/…fallbacks kept for on-Windows).BuildGraphOps— embed generator emits COFF.section .rdatafor awindowsentry.build.w—:cross-rt-windowsbuilds the full Windows runtime + LLVM/clang bridges + a COFF-formllvm_ld.rsp, mirroring:cross-rt. Also fixes the platform runtime object name (rt_<platform>.o) in both cross-rt sets.Incidental fix (separate commit)
buildstamp action never created its declaredout/command/buildmarker, so the action verifier failed every defaultwith buildand no state was blessed.Known follow-up
The compiler itself cross-links to a
with-windows-x86_64.exethat loads under wine but exits immediately (~0.5s) without doing work — a full stage1–3 self-bootstrap under wine is not yet green. Ordinary With programs run fine under wine; the only difference for the compiler is the statically-linked LLVM/libclang, so this points at LLVM/clang static-init under wine, not the cross plumbing. Under investigation.