Skip to content

build: Windows bootstrapping support#88775

Merged
compnerd merged 25 commits into
swiftlang:mainfrom
compnerd:bootstrapping
May 26, 2026
Merged

build: Windows bootstrapping support#88775
compnerd merged 25 commits into
swiftlang:mainfrom
compnerd:bootstrapping

Conversation

@compnerd

@compnerd compnerd commented May 1, 2026

Copy link
Copy Markdown
Member
  • Explanation: Setup a bootstrapped compiler on Windows
  • Scope: Enable a multi-stage bootstrap for Windows to get a compiler able to be used for bootstrapping
  • Issues:
  • Risk: medium risk; this changes the entire toolchain build on Windows
  • Testing:

@compnerd compnerd requested a review from a team as a code owner May 1, 2026 06:15
@compnerd compnerd marked this pull request as draft May 1, 2026 06:15
@compnerd

compnerd commented May 1, 2026

Copy link
Copy Markdown
Member Author

@swift-ci please test Windows platform

@DougGregor DougGregor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@compnerd

compnerd commented May 1, 2026

Copy link
Copy Markdown
Member Author

@swift-ci please smoke test windows platform

@compnerd

compnerd commented May 3, 2026

Copy link
Copy Markdown
Member Author

@swift-ci please test windows platform

@compnerd compnerd force-pushed the bootstrapping branch 4 times, most recently from ce6e7d1 to 587b830 Compare May 6, 2026 22:58
@compnerd

compnerd commented May 6, 2026

Copy link
Copy Markdown
Member Author

@swift-ci please test Windows platform

@compnerd

compnerd commented May 7, 2026

Copy link
Copy Markdown
Member Author

@swift-ci please test Windows platform

1 similar comment
@compnerd

compnerd commented May 7, 2026

Copy link
Copy Markdown
Member Author

@swift-ci please test Windows platform

@compnerd

compnerd commented May 7, 2026

Copy link
Copy Markdown
Member Author

@swift-ci please test Windows platform

@compnerd compnerd force-pushed the bootstrapping branch 2 times, most recently from 67e6ba6 to c3f6aa1 Compare May 8, 2026 06:50
@compnerd

compnerd commented May 8, 2026

Copy link
Copy Markdown
Member Author

@swift-ci please test Windows platform

@compnerd

compnerd commented May 8, 2026

Copy link
Copy Markdown
Member Author

@swift-ci please test Windows platform

@compnerd

compnerd commented May 9, 2026

Copy link
Copy Markdown
Member Author

@swift-ci please test Windows platform

@compnerd

Copy link
Copy Markdown
Member Author

@swift-ci please smoke test Windows platform

@compnerd compnerd marked this pull request as ready for review May 11, 2026 12:50
Stage each Swift runtime DLL needed by the laid-out toolchain as a private
per-DLL SxS assembly under usr/bin.

Compute each EXE's static import graph and write the full Swift runtime
closure into the EXE's application manifest. Disable linker-generated DLL
manifests for Swift's CMake-built DLLs and for the mimalloc MSBuild project,
then validate existing DLL manifest resources before binding: reject UAC
execution-level metadata and unexpected reserved RT_MANIFEST resource IDs so
implicit linker manifests cannot poison SxS activation.

Keep the checked-in WiX authoring canonical and warn when the live import
graph drifts from bld/cli/dbg/ide package ownership.
@compnerd

Copy link
Copy Markdown
Member Author

@swift-ci please test Windows platform

@compnerd

Copy link
Copy Markdown
Member Author

@swift-ci please test with following PRs:
swiftlang/swift-installer-scripts#524

@swift-ci please build toolchain Windows platform

compnerd and others added 6 commits May 21, 2026 16:07
Build the Stage2 test-time tools needed by check-swift before the final
test build. Bind the runtime-loading EXEs to the platform SDK runtime they
are tested against.

Use the build-host architecture so host-run tools remain runnable when the
final toolchain target differs. Keep this separate from the distribution SxS
pass because these tools execute from the build tree.
Run the dispatch, XCTest, and llbuild test builds with the Stage1
compiler artifacts instead of the legacy Compilers cache.

The swift-format and SourceKit-LSP SwiftPM tests also need SwiftSyntax
from the Stage2 compiler build, matching the CMake build rules for those
projects. Use the Stage2 host library path there and fix the stale
swift-markdown CAtomic include path in the SourceKit-LSP test arguments.
When %host-build-swift builds plugin DLLs on Windows, those DLLs are
loaded by the compiler under test. Pass the configured host SDK and
resource directory so the plugins link against the runtime that compiler
will load instead of the Stage2 stdlib resources.
Allow non-Darwin compiler builds to consume an already-built libdispatch
package instead of always creating a nested ExternalProject.

When dispatch_DIR is set, import the dispatch package and use it for the
host SDK dispatch target. Continue building libdispatch for other
non-Darwin target SDKs so cross-compilation still gets target-specific
dispatch variants.
Disable dispatch in the Windows bootstrap compiler caches. Stage0 and
Stage1 do not build SourceKit or the runtime SDK, so they do not need
Swift's Libdispatch.cmake path to configure nested libdispatch
ExternalProjects.

Keep passing the staged DynamicCDispatch package to the Stage2 compiler
build, where SourceKit and tool components still need host dispatch. Drop
the Stage0CDispatch build and stop feeding dispatch packages to Stage0 and
Stage1.
Runtime clients of swiftCore need the SwiftRT image-registration object on
their link lines. On COFF this object supplies pSwiftImageConstructor and
the .sw5* section range symbols used to register Swift metadata and
conformances for each image.

CMake propagates usage requirements when an OBJECT library appears in an
INTERFACE_LINK_LIBRARIES chain, but it does not add that object's payload
to the final consumer link line. Keep the swiftrt targets in the interface
for their usage requirements, and explicitly propagate their object files
with TARGET_OBJECTS.
@compnerd

Copy link
Copy Markdown
Member Author

@swift-ci please test with following PRs:
swiftlang/swift-installer-scripts#524

@swift-ci please build toolchain Windows platform

@compnerd

Copy link
Copy Markdown
Member Author

@swift-ci please test with following PRs:
swiftlang/swift-installer-scripts#524

@swift-ci please test Windows platform

@compnerd

Copy link
Copy Markdown
Member Author

Please test with following PRs:
swiftlang/llvm-project#13046
swiftlang/swift-installer-scripts#524

@swift-ci please test Windows platform

@compnerd

Copy link
Copy Markdown
Member Author

Please test with following PRs:
swiftlang/llvm-project#13046
swiftlang/swift-installer-scripts#524
swiftlang/sourcekit-lsp#2664

@swift-ci please build toolchain Windows platform

@compnerd

Copy link
Copy Markdown
Member Author

Please test with following PRs:
swiftlang/llvm-project#13046
swiftlang/swift-installer-scripts#524
swiftlang/sourcekit-lsp#2664

@swift-ci please smoke test macOS platform

@compnerd

Copy link
Copy Markdown
Member Author

Please test with following PRs:
swiftlang/llvm-project#13046
swiftlang/swift-installer-scripts#524
swiftlang/sourcekit-lsp#2664

@swift-ci please smoke test Linux platform

@compnerd

Copy link
Copy Markdown
Member Author

Please test with following PRs:
swiftlang/llvm-project#13046
swiftlang/swift-installer-scripts#524

@swift-ci please build toolchain Windows platform

2 similar comments
@compnerd

Copy link
Copy Markdown
Member Author

Please test with following PRs:
swiftlang/llvm-project#13046
swiftlang/swift-installer-scripts#524

@swift-ci please build toolchain Windows platform

@compnerd

Copy link
Copy Markdown
Member Author

Please test with following PRs:
swiftlang/llvm-project#13046
swiftlang/swift-installer-scripts#524

@swift-ci please build toolchain Windows platform

Comment thread test/CMakeLists.txt
Comment thread utils/windows-clang-overrides.cmake
@compnerd

Copy link
Copy Markdown
Member Author

Please test with following PRs:
swiftlang/swift-installer-scripts#524

@swift-ci please build toolchain Windows platform

@compnerd compnerd merged commit 44f0fb0 into swiftlang:main May 26, 2026
3 of 4 checks passed
@compnerd compnerd deleted the bootstrapping branch May 26, 2026 15:40
@tshortli

Copy link
Copy Markdown
Contributor

@compnerd Merging this without swiftlang/llvm-project#13046 or swiftlang/llvm-project#13069 broke PR testing for Windows

@compnerd

Copy link
Copy Markdown
Member Author

@compnerd Merging this without swiftlang/llvm-project#13046 or swiftlang/llvm-project#13069 broke PR testing for Windows

That showed up later - the LLDB tests have been painful and constantly regressing as people keep adding new tests with long names. There was a second patch that @adrian-prantl had committed to shorten the names I believe.

@ktoso

ktoso commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

@finagolfin

finagolfin commented Jun 1, 2026

Copy link
Copy Markdown
Member

We've been discussing the second one, I think it should be fixed by #89599.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants