From d9f97c172f2846c9a322c13c249ac39f5df4dcd7 Mon Sep 17 00:00:00 2001 From: Leonard Grey Date: Wed, 1 Oct 2025 12:45:09 -0400 Subject: [PATCH 1/7] Add option to build compilers with LLVM --- .github/workflows/build-toolchain.yml | 5 +++-- .github/workflows/swift-toolchain.yml | 10 ++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-toolchain.yml b/.github/workflows/build-toolchain.yml index 83f9facee..0f5c5ef61 100644 --- a/.github/workflows/build-toolchain.yml +++ b/.github/workflows/build-toolchain.yml @@ -54,8 +54,8 @@ on: default: false type: boolean - stable_point: - description: 'Use Repo Smart Sync' + build_compilers_with_llvm: + description: 'Build Windows compilers with clang-cl/lld-link' type: boolean default: false required: false @@ -628,6 +628,7 @@ jobs: compilers_build_runner: ${{ needs.context.outputs[format('windows_{0}_compilers_runner', needs.context.outputs.windows_build_cpu)] }} build_android: ${{ inputs.build_android }} python_version: ${{ needs.context.outputs.python_version }} + build_compilers_with_llvm: ${{ inputs.build_compilers_with_llvm }} secrets: SYMBOL_SERVER_PAT: ${{ secrets.SYMBOL_SERVER_PAT }} CERTIFICATE: ${{ secrets.CERTIFICATE }} diff --git a/.github/workflows/swift-toolchain.yml b/.github/workflows/swift-toolchain.yml index f4d777dab..b48cb2d2c 100644 --- a/.github/workflows/swift-toolchain.yml +++ b/.github/workflows/swift-toolchain.yml @@ -248,6 +248,11 @@ on: required: true type: string + build_compilers_with_llvm: + required: false + type: boolean + default: true + secrets: SYMBOL_SERVER_PAT: required: true @@ -1087,8 +1092,8 @@ jobs: bin-dir: ${{ github.workspace }}/BinaryCache/1 install-dir: ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+${{ matrix.variant }}/usr swift-sdk-path: ${{ steps.setup-context.outputs.sdkroot }} - msvc-compilers: '@("C", "CXX")' - pinned-compilers: '@("Swift")' + msvc-compilers: ${{ inputs.build_compilers_with_llvm && '@()' || '@("C", "CXX")' }} + pinned-compilers: ${{ inputs.build_compilers_with_llvm && '@("C", "CXX", "Swift")' || '@("Swift")' }} cache-script: ${{ github.workspace }}/SourceCache/swift/cmake/caches/${{ matrix.os }}-${{ matrix.cpu }}.cmake cmake-defines: | @{ @@ -1140,6 +1145,7 @@ jobs: 'LLVM_VERSION_SUFFIX' = ""; 'LLVM_PARALLEL_LINK_JOBS' = "${{ steps.setup-context.outputs.link-jobs }}"; 'SWIFT_PARALLEL_LINK_JOBS' = "${{ steps.setup-context.outputs.link-jobs }}"; + 'CMAKE_Swift_FLAGS' = "${{ inputs.build_compilers_with_llvm && '-use-ld=lld-link' || '' }}"; } - name: Build Compiler Distribution From e11a1f8f9b06ad1e40f9a1d5d622784619e13c82 Mon Sep 17 00:00:00 2001 From: Leonard Grey Date: Thu, 2 Oct 2025 14:48:10 -0400 Subject: [PATCH 2/7] More LLD --- .github/workflows/swift-toolchain.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/swift-toolchain.yml b/.github/workflows/swift-toolchain.yml index b48cb2d2c..094183ae9 100644 --- a/.github/workflows/swift-toolchain.yml +++ b/.github/workflows/swift-toolchain.yml @@ -1111,6 +1111,7 @@ jobs: 'LLDB_TABLEGEN' = "${{ github.workspace }}/BinaryCache/0/bin/lldb-tblgen${ExeSuffix}"; 'LLVM_CONFIG_PATH' = "${{ github.workspace }}/BinaryCache/0/bin/llvm-config${ExeSuffix}"; 'LLVM_ENABLE_ASSERTIONS' = ${{ matrix.variant == 'Asserts' && '"YES"' || '"NO"' }}; + 'LLVM_ENABLE_LLD' = "${{ inputs.build_compilers_with_llvm && 'YES' || 'NO' }}"; 'LLVM_EXTERNAL_SWIFT_SOURCE_DIR' = "${{ github.workspace }}/SourceCache/swift"; 'LLVM_HOST_TRIPLE' = "${{ matrix.triple }}"; 'LLVM_NATIVE_TOOL_DIR' = "${{ github.workspace }}/BinaryCache/0/bin"; @@ -1145,7 +1146,7 @@ jobs: 'LLVM_VERSION_SUFFIX' = ""; 'LLVM_PARALLEL_LINK_JOBS' = "${{ steps.setup-context.outputs.link-jobs }}"; 'SWIFT_PARALLEL_LINK_JOBS' = "${{ steps.setup-context.outputs.link-jobs }}"; - 'CMAKE_Swift_FLAGS' = "${{ inputs.build_compilers_with_llvm && '-use-ld=lld-link' || '' }}"; + 'CMAKE_Swift_FLAGS' = "${{ inputs.build_compilers_with_llvm && '-use-ld=lld' || '' }}"; } - name: Build Compiler Distribution From 76e2557ba6671c555bc12c16f2f671b9601bb95d Mon Sep 17 00:00:00 2001 From: Leonard Grey Date: Tue, 7 Oct 2025 18:01:51 -0400 Subject: [PATCH 3/7] default: false --- .github/workflows/swift-toolchain.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/swift-toolchain.yml b/.github/workflows/swift-toolchain.yml index 094183ae9..e434d3270 100644 --- a/.github/workflows/swift-toolchain.yml +++ b/.github/workflows/swift-toolchain.yml @@ -251,7 +251,7 @@ on: build_compilers_with_llvm: required: false type: boolean - default: true + default: false secrets: SYMBOL_SERVER_PAT: From 41984b87a7ccb5a777683c482b42c78b57eaf983 Mon Sep 17 00:00:00 2001 From: Leonard Grey Date: Tue, 7 Oct 2025 19:14:45 -0400 Subject: [PATCH 4/7] Rename, use LLVM for everything if used --- .github/workflows/build-toolchain.yml | 4 +-- .github/workflows/swift-toolchain.yml | 40 +++++++++++++++++---------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build-toolchain.yml b/.github/workflows/build-toolchain.yml index 0f5c5ef61..83219be9c 100644 --- a/.github/workflows/build-toolchain.yml +++ b/.github/workflows/build-toolchain.yml @@ -54,8 +54,8 @@ on: default: false type: boolean - build_compilers_with_llvm: - description: 'Build Windows compilers with clang-cl/lld-link' + llvm_clang: + description: 'Build with clang-cl/lld-link' type: boolean default: false required: false diff --git a/.github/workflows/swift-toolchain.yml b/.github/workflows/swift-toolchain.yml index e434d3270..b33703ff4 100644 --- a/.github/workflows/swift-toolchain.yml +++ b/.github/workflows/swift-toolchain.yml @@ -248,7 +248,7 @@ on: required: true type: string - build_compilers_with_llvm: + llvm_clang: required: false type: boolean default: false @@ -355,7 +355,8 @@ jobs: install-dir: ${{ github.workspace }}/BuildRoot/Library/sqlite-${{ inputs.swift_toolchain_sqlite_version }}/usr android-api-level: ${{ inputs.ANDROID_API_LEVEL }} android-clang-version: ${{ inputs.ANDROID_CLANG_VERSION }} - msvc-compilers: '@("C")' + msvc-compilers: ${{ inputs.llvm_clang && '@()' || '@("C")' }} + pinned-compilers: ${{ inputs.llvm_clang && '@("C")' || '@()' }} cmake-defines: | @{ 'BUILD_SHARED_LIBS' = "NO"; @@ -439,7 +440,8 @@ jobs: arch: ${{ inputs.build_arch }} src-dir: ${{ github.workspace }}/SourceCache/ds2/Tools/RegsGen2 bin-dir: ${{ github.workspace }}/BinaryCache/RegsGen2 - msvc-compilers: '@("C", "CXX")' + msvc-compilers: ${{ inputs.llvm_clang && '@()' || '@("C", "CXX")' }} + pinned-compilers: ${{ inputs.llvm_clang && '@("C", "CXX")' || '@()' }} cache-script: ${{ github.workspace }}/SourceCache/ds2/cmake/caches/MSVCWarnings.cmake - name: Build RegsGen2 if: inputs.build_android @@ -637,7 +639,8 @@ jobs: src-dir: ${{ github.workspace }}/SourceCache/cmark-gfm bin-dir: ${{ github.workspace }}/BinaryCache/cmark-gfm-${{ inputs.swift_cmark_version }} install-dir: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr - msvc-compilers: '@("C", "CXX")' + msvc-compilers: ${{ inputs.llvm_clang && '@()' || '@("C", "CXX")' }} + pinned-compilers: ${{ inputs.llvm_clang && '@("C", "CXX")' || '@()' }} cmake-defines: | @{ 'BUILD_SHARED_LIBS' = "YES"; @@ -730,7 +733,8 @@ jobs: arch: ${{ matrix.arch }} src-dir: ${{ github.workspace }}/SourceCache/llvm-project/llvm bin-dir: ${{ github.workspace }}/BinaryCache/0 - msvc-compilers: '@("ASM_MASM", "C", "CXX")' + msvc-compilers: ${{ inputs.llvm_clang && '@()' || '@("ASM_MASM", "C", "CXX")' }} + pinned-compilers: ${{ inputs.llvm_clang && '@("ASM_MASM", "C", "CXX")' || '@()' }} cmake-defines: | @{ 'CMAKE_CROSSCOMPILING' = "NO"; @@ -1092,8 +1096,8 @@ jobs: bin-dir: ${{ github.workspace }}/BinaryCache/1 install-dir: ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+${{ matrix.variant }}/usr swift-sdk-path: ${{ steps.setup-context.outputs.sdkroot }} - msvc-compilers: ${{ inputs.build_compilers_with_llvm && '@()' || '@("C", "CXX")' }} - pinned-compilers: ${{ inputs.build_compilers_with_llvm && '@("C", "CXX", "Swift")' || '@("Swift")' }} + msvc-compilers: ${{ inputs.llvm_clang && '@()' || '@("C", "CXX")' }} + pinned-compilers: ${{ inputs.llvm_clang && '@("C", "CXX", "Swift")' || '@("Swift")' }} cache-script: ${{ github.workspace }}/SourceCache/swift/cmake/caches/${{ matrix.os }}-${{ matrix.cpu }}.cmake cmake-defines: | @{ @@ -1111,7 +1115,7 @@ jobs: 'LLDB_TABLEGEN' = "${{ github.workspace }}/BinaryCache/0/bin/lldb-tblgen${ExeSuffix}"; 'LLVM_CONFIG_PATH' = "${{ github.workspace }}/BinaryCache/0/bin/llvm-config${ExeSuffix}"; 'LLVM_ENABLE_ASSERTIONS' = ${{ matrix.variant == 'Asserts' && '"YES"' || '"NO"' }}; - 'LLVM_ENABLE_LLD' = "${{ inputs.build_compilers_with_llvm && 'YES' || 'NO' }}"; + 'LLVM_ENABLE_LLD' = "${{ inputs.llvm_clang && 'YES' || 'NO' }}"; 'LLVM_EXTERNAL_SWIFT_SOURCE_DIR' = "${{ github.workspace }}/SourceCache/swift"; 'LLVM_HOST_TRIPLE' = "${{ matrix.triple }}"; 'LLVM_NATIVE_TOOL_DIR' = "${{ github.workspace }}/BinaryCache/0/bin"; @@ -1146,7 +1150,7 @@ jobs: 'LLVM_VERSION_SUFFIX' = ""; 'LLVM_PARALLEL_LINK_JOBS' = "${{ steps.setup-context.outputs.link-jobs }}"; 'SWIFT_PARALLEL_LINK_JOBS' = "${{ steps.setup-context.outputs.link-jobs }}"; - 'CMAKE_Swift_FLAGS' = "${{ inputs.build_compilers_with_llvm && '-use-ld=lld' || '' }}"; + 'CMAKE_Swift_FLAGS' = "${{ inputs.llvm_clang && '-use-ld=lld' || '' }}"; } - name: Build Compiler Distribution @@ -1315,7 +1319,8 @@ jobs: android-api-level: ${{ inputs.ANDROID_API_LEVEL }} android-clang-version: ${{ inputs.ANDROID_CLANG_VERSION }} ndk-path: ${{ steps.setup-ndk.outputs.ndk-path }} - msvc-compilers: '@("C")' + msvc-compilers: ${{ inputs.llvm_clang && '@()' || '@("C")' }} + pinned-compilers: ${{ inputs.llvm_clang && '@("C")' || '@()' }} cmake-defines: | @{ 'BUILD_SHARED_LIBS' = "NO"; @@ -1497,7 +1502,8 @@ jobs: android-api-level: ${{ inputs.ANDROID_API_LEVEL }} android-clang-version: ${{ inputs.ANDROID_CLANG_VERSION }} ndk-path: ${{ steps.setup-ndk.outputs.ndk-path }} - msvc-compilers: '@("C")' + msvc-compilers: ${{ inputs.llvm_clang && '@()' || '@("C")' }} + pinned-compilers: ${{ inputs.llvm_clang && '@("C")' || '@()' }} cmake-defines: | @{ 'BUILD_SHARED_LIBS' = "NO"; @@ -1670,7 +1676,8 @@ jobs: android-api-level: ${{ inputs.ANDROID_API_LEVEL }} android-clang-version: ${{ inputs.ANDROID_CLANG_VERSION }} ndk-path: ${{ steps.setup-ndk.outputs.ndk-path }} - msvc-compilers: '@("C", "CXX")' + msvc-compilers: ${{ inputs.llvm_clang && '@()' || '@("C", "CXX")' }} + pinned-compilers: ${{ inputs.llvm_clang && '@("C", "CXX")' || '@()' }} cmake-defines: | @{ 'BUILD_SHARED_LIBS' = "NO"; @@ -1802,7 +1809,8 @@ jobs: android-api-level: ${{ inputs.ANDROID_API_LEVEL }} android-clang-version: ${{ inputs.ANDROID_CLANG_VERSION }} ndk-path: ${{ steps.setup-ndk.outputs.ndk-path }} - msvc-compilers: '@("ASM_MASM", "C", "CXX")' + msvc-compilers: ${{ inputs.llvm_clang && '@()' || '@("ASM_MASM", "C", "CXX")' }} + pinned-compilers: ${{ inputs.llvm_clang && '@("ASM_MASM", "C", "CXX")' || '@()' }} cmake-defines: | @{ 'LLVM_ENABLE_ASSERTIONS' = "YES"; @@ -3713,7 +3721,8 @@ jobs: bin-dir: ${{ github.workspace }}/BinaryCache/swift-format install-dir: ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr swift-sdk-path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk - msvc-compilers: '@("C")' + msvc-compilers: ${{ inputs.llvm_clang && '@()' || '@("C")' }} + pinned-compilers: ${{ inputs.llvm_clang && '@("C")' || '@()' }} built-compilers: '@("Swift")' cmake-defines: | @{ @@ -3740,7 +3749,8 @@ jobs: src-dir: ${{ github.workspace }}/SourceCache/swift-lmdb bin-dir: ${{ github.workspace }}/BinaryCache/swift-lmdb swift-sdk-path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk - msvc-compilers: '@("C")' + msvc-compilers: ${{ inputs.llvm_clang && '@()' || '@("C")' }} + pinned-compilers: ${{ inputs.llvm_clang && '@("C")' || '@()' }} - name: Build swift-lmdb run: cmake --build ${{ github.workspace }}/BinaryCache/swift-lmdb From e25bc903e402fd49c0137cc6ce7219139c04f469 Mon Sep 17 00:00:00 2001 From: Leonard Grey Date: Tue, 7 Oct 2025 19:29:21 -0400 Subject: [PATCH 5/7] Fix --- .github/workflows/build-toolchain.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-toolchain.yml b/.github/workflows/build-toolchain.yml index 83219be9c..39c248e86 100644 --- a/.github/workflows/build-toolchain.yml +++ b/.github/workflows/build-toolchain.yml @@ -628,7 +628,7 @@ jobs: compilers_build_runner: ${{ needs.context.outputs[format('windows_{0}_compilers_runner', needs.context.outputs.windows_build_cpu)] }} build_android: ${{ inputs.build_android }} python_version: ${{ needs.context.outputs.python_version }} - build_compilers_with_llvm: ${{ inputs.build_compilers_with_llvm }} + llvm_clang: ${{ inputs.llvm_clang }} secrets: SYMBOL_SERVER_PAT: ${{ secrets.SYMBOL_SERVER_PAT }} CERTIFICATE: ${{ secrets.CERTIFICATE }} From fec01cf90b0971147759907d05a45e5546ed2b4b Mon Sep 17 00:00:00 2001 From: Leonard Grey Date: Thu, 9 Oct 2025 14:11:07 -0400 Subject: [PATCH 6/7] LLD everywhere and invert name --- .github/workflows/build-toolchain.yml | 8 +-- .github/workflows/swift-toolchain.yml | 75 +++++++++++++++++---------- 2 files changed, 53 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build-toolchain.yml b/.github/workflows/build-toolchain.yml index 39c248e86..7d82b805f 100644 --- a/.github/workflows/build-toolchain.yml +++ b/.github/workflows/build-toolchain.yml @@ -54,10 +54,10 @@ on: default: false type: boolean - llvm_clang: - description: 'Build with clang-cl/lld-link' + use_host_toolchain: + description: 'Use host toolchain (MSVC) instead of clang-cl/lld-link' type: boolean - default: false + default: true required: false workflow_call: @@ -628,7 +628,7 @@ jobs: compilers_build_runner: ${{ needs.context.outputs[format('windows_{0}_compilers_runner', needs.context.outputs.windows_build_cpu)] }} build_android: ${{ inputs.build_android }} python_version: ${{ needs.context.outputs.python_version }} - llvm_clang: ${{ inputs.llvm_clang }} + use_host_toolchain: ${{ inputs.use_host_toolchain }} secrets: SYMBOL_SERVER_PAT: ${{ secrets.SYMBOL_SERVER_PAT }} CERTIFICATE: ${{ secrets.CERTIFICATE }} diff --git a/.github/workflows/swift-toolchain.yml b/.github/workflows/swift-toolchain.yml index b33703ff4..f998cdae5 100644 --- a/.github/workflows/swift-toolchain.yml +++ b/.github/workflows/swift-toolchain.yml @@ -248,10 +248,10 @@ on: required: true type: string - llvm_clang: + use_host_toolchain: required: false type: boolean - default: false + default: true secrets: SYMBOL_SERVER_PAT: @@ -355,11 +355,12 @@ jobs: install-dir: ${{ github.workspace }}/BuildRoot/Library/sqlite-${{ inputs.swift_toolchain_sqlite_version }}/usr android-api-level: ${{ inputs.ANDROID_API_LEVEL }} android-clang-version: ${{ inputs.ANDROID_CLANG_VERSION }} - msvc-compilers: ${{ inputs.llvm_clang && '@()' || '@("C")' }} - pinned-compilers: ${{ inputs.llvm_clang && '@("C")' || '@()' }} + msvc-compilers: ${{ inputs.use_host_toolchain && '@("C")' || '@()' }} + pinned-compilers: ${{ inputs.use_host_toolchain && '@()' || '@("C")' }} cmake-defines: | @{ 'BUILD_SHARED_LIBS' = "NO"; + 'CMAKE_C_FLAGS' = "${{ inputs.use_host_toolchain && '' || '-fuse-ld=lld' }}"; } - name: Build SQLite run: cmake --build ${{ github.workspace }}/BinaryCache/sqlite-${{ inputs.swift_toolchain_sqlite_version }} @@ -440,9 +441,14 @@ jobs: arch: ${{ inputs.build_arch }} src-dir: ${{ github.workspace }}/SourceCache/ds2/Tools/RegsGen2 bin-dir: ${{ github.workspace }}/BinaryCache/RegsGen2 - msvc-compilers: ${{ inputs.llvm_clang && '@()' || '@("C", "CXX")' }} - pinned-compilers: ${{ inputs.llvm_clang && '@("C", "CXX")' || '@()' }} + msvc-compilers: ${{ inputs.use_host_toolchain && '@("C", "CXX")' || '@()' }} + pinned-compilers: ${{ inputs.use_host_toolchain && '@()' || '@("C", "CXX")' }} cache-script: ${{ github.workspace }}/SourceCache/ds2/cmake/caches/MSVCWarnings.cmake + cmake-defines: | + @{ + 'CMAKE_C_FLAGS' = "${{ inputs.use_host_toolchain && '' || '-fuse-ld=lld' }}"; + 'CMAKE_CXX_FLAGS' = "${{ inputs.use_host_toolchain && '' || '-fuse-ld=lld' }}"; + } - name: Build RegsGen2 if: inputs.build_android run: cmake --build ${{ github.workspace }}/BinaryCache/RegsGen2 --config Release @@ -639,13 +645,15 @@ jobs: src-dir: ${{ github.workspace }}/SourceCache/cmark-gfm bin-dir: ${{ github.workspace }}/BinaryCache/cmark-gfm-${{ inputs.swift_cmark_version }} install-dir: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr - msvc-compilers: ${{ inputs.llvm_clang && '@()' || '@("C", "CXX")' }} - pinned-compilers: ${{ inputs.llvm_clang && '@("C", "CXX")' || '@()' }} + msvc-compilers: ${{ inputs.use_host_toolchain && '@("C", "CXX")' || '@()' }} + pinned-compilers: ${{ inputs.use_host_toolchain && '@()' || '@("C", "CXX")' }} cmake-defines: | @{ 'BUILD_SHARED_LIBS' = "YES"; 'BUILD_TESTING' = "NO"; 'CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP' = "YES"; + 'CMAKE_C_FLAGS' = "${{ inputs.use_host_toolchain && '' || '-fuse-ld=lld' }}"; + 'CMAKE_CXX_FLAGS' = "${{ inputs.use_host_toolchain && '' || '-fuse-ld=lld' }}"; } - name: Build cmark-gfm run: cmake --build ${{ github.workspace }}/BinaryCache/cmark-gfm-${{ inputs.swift_cmark_version }} @@ -733,8 +741,8 @@ jobs: arch: ${{ matrix.arch }} src-dir: ${{ github.workspace }}/SourceCache/llvm-project/llvm bin-dir: ${{ github.workspace }}/BinaryCache/0 - msvc-compilers: ${{ inputs.llvm_clang && '@()' || '@("ASM_MASM", "C", "CXX")' }} - pinned-compilers: ${{ inputs.llvm_clang && '@("ASM_MASM", "C", "CXX")' || '@()' }} + msvc-compilers: ${{ inputs.use_host_toolchain && '@("ASM_MASM", "C", "CXX")' || '@()' }} + pinned-compilers: ${{ inputs.use_host_toolchain && '@()' || '@("ASM_MASM", "C", "CXX")' }} cmake-defines: | @{ 'CMAKE_CROSSCOMPILING' = "NO"; @@ -764,6 +772,8 @@ jobs: 'SWIFT_INCLUDE_DOCS' = "NO"; 'SWIFT_INCLUDE_TESTS' = "NO"; 'cmark-gfm_DIR' = "${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/lib/cmake"; + 'CMAKE_C_FLAGS' = "${{ inputs.use_host_toolchain && '' || '-fuse-ld=lld' }}"; + 'CMAKE_CXX_FLAGS' = "${{ inputs.use_host_toolchain && '' || '-fuse-ld=lld' }}"; } - name: Build llvm-tblgen run: cmake --build ${{ github.workspace }}/BinaryCache/0 --target llvm-tblgen @@ -1096,8 +1106,8 @@ jobs: bin-dir: ${{ github.workspace }}/BinaryCache/1 install-dir: ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+${{ matrix.variant }}/usr swift-sdk-path: ${{ steps.setup-context.outputs.sdkroot }} - msvc-compilers: ${{ inputs.llvm_clang && '@()' || '@("C", "CXX")' }} - pinned-compilers: ${{ inputs.llvm_clang && '@("C", "CXX", "Swift")' || '@("Swift")' }} + msvc-compilers: ${{ inputs.use_host_toolchain && '@("C", "CXX")' || '@()' }} + pinned-compilers: ${{ inputs.use_host_toolchain && '@("Swift")' || '@("C", "CXX", "Swift")' }} cache-script: ${{ github.workspace }}/SourceCache/swift/cmake/caches/${{ matrix.os }}-${{ matrix.cpu }}.cmake cmake-defines: | @{ @@ -1115,7 +1125,7 @@ jobs: 'LLDB_TABLEGEN' = "${{ github.workspace }}/BinaryCache/0/bin/lldb-tblgen${ExeSuffix}"; 'LLVM_CONFIG_PATH' = "${{ github.workspace }}/BinaryCache/0/bin/llvm-config${ExeSuffix}"; 'LLVM_ENABLE_ASSERTIONS' = ${{ matrix.variant == 'Asserts' && '"YES"' || '"NO"' }}; - 'LLVM_ENABLE_LLD' = "${{ inputs.llvm_clang && 'YES' || 'NO' }}"; + 'LLVM_ENABLE_LLD' = "${{ inputs.use_host_toolchain && 'NO' || 'YES' }}"; 'LLVM_EXTERNAL_SWIFT_SOURCE_DIR' = "${{ github.workspace }}/SourceCache/swift"; 'LLVM_HOST_TRIPLE' = "${{ matrix.triple }}"; 'LLVM_NATIVE_TOOL_DIR' = "${{ github.workspace }}/BinaryCache/0/bin"; @@ -1150,7 +1160,9 @@ jobs: 'LLVM_VERSION_SUFFIX' = ""; 'LLVM_PARALLEL_LINK_JOBS' = "${{ steps.setup-context.outputs.link-jobs }}"; 'SWIFT_PARALLEL_LINK_JOBS' = "${{ steps.setup-context.outputs.link-jobs }}"; - 'CMAKE_Swift_FLAGS' = "${{ inputs.llvm_clang && '-use-ld=lld' || '' }}"; + 'CMAKE_C_FLAGS' = "${{ inputs.use_host_toolchain && '' || '-fuse-ld=lld' }}"; + 'CMAKE_CXX_FLAGS' = "${{ inputs.use_host_toolchain && '' || '-fuse-ld=lld' }}"; + 'CMAKE_Swift_FLAGS' = "${{ inputs.use_host_toolchain && '' || '-use-ld=lld' }}"; } - name: Build Compiler Distribution @@ -1319,12 +1331,13 @@ jobs: android-api-level: ${{ inputs.ANDROID_API_LEVEL }} android-clang-version: ${{ inputs.ANDROID_CLANG_VERSION }} ndk-path: ${{ steps.setup-ndk.outputs.ndk-path }} - msvc-compilers: ${{ inputs.llvm_clang && '@()' || '@("C")' }} - pinned-compilers: ${{ inputs.llvm_clang && '@("C")' || '@()' }} + msvc-compilers: ${{ inputs.use_host_toolchain && '@("C")' || '@()' }} + pinned-compilers: ${{ inputs.use_host_toolchain && '@()' || '@("C")' }} cmake-defines: | @{ 'BUILD_SHARED_LIBS' = "NO"; 'CMAKE_POSITION_INDEPENDENT_CODE' = "YES"; + 'CMAKE_C_FLAGS' = "${{ inputs.use_host_toolchain && '' || '-fuse-ld=lld' }}"; } - name: Build zlib run: cmake --build ${{ github.workspace }}/BinaryCache/zlib-${{ inputs.zlib_version }} @@ -1502,8 +1515,8 @@ jobs: android-api-level: ${{ inputs.ANDROID_API_LEVEL }} android-clang-version: ${{ inputs.ANDROID_CLANG_VERSION }} ndk-path: ${{ steps.setup-ndk.outputs.ndk-path }} - msvc-compilers: ${{ inputs.llvm_clang && '@()' || '@("C")' }} - pinned-compilers: ${{ inputs.llvm_clang && '@("C")' || '@()' }} + msvc-compilers: ${{ inputs.use_host_toolchain && '@("C")' || '@()' }} + pinned-compilers: ${{ inputs.use_host_toolchain && '@()' || '@("C")' }} cmake-defines: | @{ 'BUILD_SHARED_LIBS' = "NO"; @@ -1593,6 +1606,7 @@ jobs: 'USE_WIN32_LDAP' = "NO"; 'ZLIB_ROOT' = "${{ github.workspace }}/BuildRoot/Library/zlib-${{ inputs.zlib_version }}/usr"; 'ZLIB_LIBRARY' = "${{ github.workspace }}/BuildRoot/Library/zlib-${{ inputs.zlib_version }}/usr/lib/zlibstatic.lib"; + 'CMAKE_C_FLAGS' = "${{ inputs.use_host_toolchain && '' || '-fuse-ld=lld' }}"; } - name: Build curl run: cmake --build ${{ github.workspace }}/BinaryCache/curl-${{ inputs.curl_version }} @@ -1676,8 +1690,8 @@ jobs: android-api-level: ${{ inputs.ANDROID_API_LEVEL }} android-clang-version: ${{ inputs.ANDROID_CLANG_VERSION }} ndk-path: ${{ steps.setup-ndk.outputs.ndk-path }} - msvc-compilers: ${{ inputs.llvm_clang && '@()' || '@("C", "CXX")' }} - pinned-compilers: ${{ inputs.llvm_clang && '@("C", "CXX")' || '@()' }} + msvc-compilers: ${{ inputs.use_host_toolchain && '@("C", "CXX")' || '@()' }} + pinned-compilers: ${{ inputs.use_host_toolchain && '@()' || '@("C", "CXX")' }} cmake-defines: | @{ 'BUILD_SHARED_LIBS' = "NO"; @@ -1689,6 +1703,8 @@ jobs: 'LIBXML2_WITH_TESTS' = "NO"; 'LIBXML2_WITH_THREADS' = "YES"; 'LIBXML2_WITH_ZLIB' = "NO"; + 'CMAKE_C_FLAGS' = "${{ inputs.use_host_toolchain && '' || '-fuse-ld=lld' }}"; + 'CMAKE_CXX_FLAGS' = "${{ inputs.use_host_toolchain && '' || '-fuse-ld=lld' }}"; } - name: Build libxml2 run: cmake --build ${{ github.workspace }}/BinaryCache/libxml2-${{ inputs.libxml2_version }} @@ -1809,12 +1825,14 @@ jobs: android-api-level: ${{ inputs.ANDROID_API_LEVEL }} android-clang-version: ${{ inputs.ANDROID_CLANG_VERSION }} ndk-path: ${{ steps.setup-ndk.outputs.ndk-path }} - msvc-compilers: ${{ inputs.llvm_clang && '@()' || '@("ASM_MASM", "C", "CXX")' }} - pinned-compilers: ${{ inputs.llvm_clang && '@("ASM_MASM", "C", "CXX")' || '@()' }} + msvc-compilers: ${{ inputs.use_host_toolchain && '@("ASM_MASM", "C", "CXX")' || '@()' }} + pinned-compilers: ${{ inputs.use_host_toolchain && '@()' || '@("ASM_MASM", "C", "CXX")' }} cmake-defines: | @{ 'LLVM_ENABLE_ASSERTIONS' = "YES"; 'LLVM_HOST_TRIPLE' = "${{ matrix.triple }}"; + 'CMAKE_C_FLAGS' = "${{ inputs.use_host_toolchain && '' || '-fuse-ld=lld' }}"; + 'CMAKE_CXX_FLAGS' = "${{ inputs.use_host_toolchain && '' || '-fuse-ld=lld' }}"; } - name: Configure Swift Standard Library @@ -3721,8 +3739,8 @@ jobs: bin-dir: ${{ github.workspace }}/BinaryCache/swift-format install-dir: ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr swift-sdk-path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk - msvc-compilers: ${{ inputs.llvm_clang && '@()' || '@("C")' }} - pinned-compilers: ${{ inputs.llvm_clang && '@("C")' || '@()' }} + msvc-compilers: ${{ inputs.use_host_toolchain && '@("C")' || '@()' }} + pinned-compilers: ${{ inputs.use_host_toolchain && '@()' || '@("C")' }} built-compilers: '@("Swift")' cmake-defines: | @{ @@ -3731,6 +3749,7 @@ jobs: 'SwiftMarkdown_DIR' = "${{ github.workspace }}/BinaryCache/swift-markdown/cmake/modules"; 'SwiftSyntax_DIR' = "${{ github.workspace }}/BinaryCache/swift-syntax/cmake/modules"; 'cmark-gfm_DIR' = "${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/lib/cmake"; + 'CMAKE_C_FLAGS' = "${{ inputs.use_host_toolchain && '' || '-fuse-ld=lld' }}"; } - name: Build swift-format run: cmake --build ${{ github.workspace }}/BinaryCache/swift-format @@ -3749,8 +3768,12 @@ jobs: src-dir: ${{ github.workspace }}/SourceCache/swift-lmdb bin-dir: ${{ github.workspace }}/BinaryCache/swift-lmdb swift-sdk-path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk - msvc-compilers: ${{ inputs.llvm_clang && '@()' || '@("C")' }} - pinned-compilers: ${{ inputs.llvm_clang && '@("C")' || '@()' }} + msvc-compilers: ${{ inputs.use_host_toolchain && '@("C")' || '@()' }} + pinned-compilers: ${{ inputs.use_host_toolchain && '@()' || '@("C")' }} + cmake-defines: | + @{ + 'CMAKE_C_FLAGS' = "${{ inputs.use_host_toolchain && '' || '-fuse-ld=lld' }}"; + } - name: Build swift-lmdb run: cmake --build ${{ github.workspace }}/BinaryCache/swift-lmdb From 7eb662bc36a316dc5cc3c5ba9aef55858ec8dcca Mon Sep 17 00:00:00 2001 From: Leonard Grey Date: Fri, 10 Oct 2025 10:18:06 -0400 Subject: [PATCH 7/7] Rebase and add Brotli --- .github/workflows/swift-toolchain.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/swift-toolchain.yml b/.github/workflows/swift-toolchain.yml index f998cdae5..c2a15a928 100644 --- a/.github/workflows/swift-toolchain.yml +++ b/.github/workflows/swift-toolchain.yml @@ -1421,11 +1421,13 @@ jobs: android-api-level: ${{ inputs.ANDROID_API_LEVEL }} android-clang-version: ${{ inputs.ANDROID_CLANG_VERSION }} ndk-path: ${{ steps.setup-ndk.outputs.ndk-path }} - msvc-compilers: '@("C")' + msvc-compilers: ${{ inputs.use_host_toolchain && '@("C")' || '@()' }} + pinned-compilers: ${{ inputs.use_host_toolchain && '@()' || '@("C")' }} cmake-defines: | @{ 'BUILD_SHARED_LIBS' = "NO"; 'CMAKE_POSITION_INDEPENDENT_CODE' = "YES"; + 'CMAKE_C_FLAGS' = "${{ inputs.use_host_toolchain && '' || '-fuse-ld=lld' }}"; } - name: Build brotli run: cmake --build ${{ github.workspace }}/BinaryCache/brotli-${{ inputs.brotli_version }}