[clang] [llvm] Mac release workaround (PR #163607)

Tom Stellard via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 27 12:22:43 PDT 2025


https://github.com/tstellar updated https://github.com/llvm/llvm-project/pull/163607

>From b2f00eb013f5174b1ab5199bb7cc4cab6d5ed059 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Sat, 11 Oct 2025 17:39:12 -0700
Subject: [PATCH 01/29] [Darwin][Driver] Prefer linking with toolchain's libc++
 instead of system

Fixes #77653
---
 clang/lib/Driver/ToolChains/Darwin.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index d2356ebdfa86c..7e2d62a6bfc94 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -667,6 +667,10 @@ void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA,
   Args.addAllArgs(CmdArgs, {options::OPT_d_Flag, options::OPT_s, options::OPT_t,
                             options::OPT_Z_Flag, options::OPT_u_Group});
 
+  // Add local file paths to ensure the toolchain's libc++ is used instead of
+  // the system's.
+  ToolChain.AddFilePathLibArgs(Args, CmdArgs);
+
   // Forward -ObjC when either -ObjC or -ObjC++ is used, to force loading
   // members of static archive libraries which implement Objective-C classes or
   // categories.

>From 91ccb95e699b47ceb93c873454685fe180a2f975 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Sat, 11 Oct 2025 17:40:31 -0700
Subject: [PATCH 02/29] XXX: testrelease builds which also hit this bug

---
 .github/workflows/release-binaries.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml
index 83969b5490685..955a31aff9c14 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -1,5 +1,5 @@
 name: Release Binaries
-
+# TEST
 on:
   workflow_dispatch:
     inputs:

>From a0bb37c324b6dcaff28aff35bf39e2ebbf879bb7 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Sat, 11 Oct 2025 21:17:27 -0700
Subject: [PATCH 03/29] Fix build failure

---
 clang/lib/Driver/ToolChains/Darwin.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index 7e2d62a6bfc94..2c869d260211d 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -669,7 +669,7 @@ void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA,
 
   // Add local file paths to ensure the toolchain's libc++ is used instead of
   // the system's.
-  ToolChain.AddFilePathLibArgs(Args, CmdArgs);
+  getToolChain().AddFilePathLibArgs(Args, CmdArgs);
 
   // Forward -ObjC when either -ObjC or -ObjC++ is used, to force loading
   // members of static archive libraries which implement Objective-C classes or

>From 19b27bb6a76188b58f4b1c8420bd04c7040a06e6 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Mon, 13 Oct 2025 16:57:08 -0700
Subject: [PATCH 04/29] XX: debug

---
 .github/workflows/release-binaries-all.yml | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/.github/workflows/release-binaries-all.yml b/.github/workflows/release-binaries-all.yml
index 0b52a08202f1a..7e408497d1819 100644
--- a/.github/workflows/release-binaries-all.yml
+++ b/.github/workflows/release-binaries-all.yml
@@ -88,9 +88,6 @@ jobs:
         # We use ubuntu-22.04 rather than the latest version to make the built
         # binaries more portable (eg functional aginast older glibc).
         runs-on:
-          - ubuntu-22.04
-          - ubuntu-22.04-arm
-          - macos-13
           - macos-14
 
     uses: ./.github/workflows/release-binaries.yml

>From ff8bd1fe008a0d05dd61147fcb7a5bed2335ba30 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Mon, 13 Oct 2025 17:01:57 -0700
Subject: [PATCH 05/29] Debug

---
 .github/workflows/release-binaries.yml | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml
index 955a31aff9c14..9884027af5dc7 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -239,7 +239,15 @@ jobs:
         ninja -v -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-package
         release_dir=`find ${{ steps.setup-stage.outputs.build-prefix }}/build -iname 'stage2-bins'`
         mv $release_dir/${{ needs.prepare.outputs.release-binary-filename }} .
-    
+
+    - name: Debug
+      shell: bash
+      if: always()
+      run: |
+        echo "int main(int argc, char** argv) { return 0; }" >> test.cpp
+        ${{ steps.setup-stage.outputs.build-prefix }}/build/bin/clang++ -### -fuse-ld=lld -stdlib=libc++ -Wl,--verbose test.cpp
+        ls -ltr  ${{ steps.setup-stage.outputs.build-prefix }}/build/lib/*
+
     - uses: actions/upload-artifact at ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
       with:
         name: ${{ runner.os }}-${{ runner.arch }}-release-binary

>From 6d91fcd5583670d5045985976903854fdd68bb88 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Tue, 14 Oct 2025 11:43:08 -0700
Subject: [PATCH 06/29] Fix/Debug

---
 clang/lib/Driver/ToolChain.cpp | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 3d5cac62afe01..ac5ec0d1bd9e8 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -954,10 +954,12 @@ llvm::Triple ToolChain::getTripleWithoutOSVersion() const {
 
 std::optional<std::string>
 ToolChain::getTargetSubDirPath(StringRef BaseDir) const {
+  dbgs() << "getTargetSubDirPath: " << BaseDir << "\n";
   auto getPathForTriple =
       [&](const llvm::Triple &Triple) -> std::optional<std::string> {
     SmallString<128> P(BaseDir);
     llvm::sys::path::append(P, Triple.str());
+  dbgs() << "getTargetSubDirPath: " << P << "\n";
     if (getVFS().exists(P))
       return std::string(P);
     return {};
@@ -1032,7 +1034,13 @@ std::optional<std::string> ToolChain::getRuntimePath() const {
 
 std::optional<std::string> ToolChain::getStdlibPath() const {
   SmallString<128> P(D.Dir);
+  if (Triple.isOSDarwin())
+  dbgs() << "getStdlibPath(): " << P << "\n";
   llvm::sys::path::append(P, "..", "lib");
+  // Darwin does not use per-target runtime directory.
+  if (Triple.isOSDarwin())
+    return std::string(P);
+  dbgs() << "getStdlibPath(): " << P << "\n";
   return getTargetSubDirPath(P);
 }
 
@@ -1551,9 +1559,11 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
 
 void ToolChain::AddFilePathLibArgs(const ArgList &Args,
                                    ArgStringList &CmdArgs) const {
-  for (const auto &LibPath : getFilePaths())
+  for (const auto &LibPath : getFilePaths()) {
+	  llvm::dbgs() << "LibPath: " << LibPath << "\n";
     if(LibPath.length() > 0)
       CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
+  }
 }
 
 void ToolChain::AddCCKextLibArgs(const ArgList &Args,

>From fcbd4740b011b1ef7402201ea20ae726f8cf71ee Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Tue, 14 Oct 2025 14:59:18 -0700
Subject: [PATCH 07/29] Update debug

---
 .github/workflows/release-binaries.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml
index 9884027af5dc7..25acfc9ebe52d 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -247,6 +247,7 @@ jobs:
         echo "int main(int argc, char** argv) { return 0; }" >> test.cpp
         ${{ steps.setup-stage.outputs.build-prefix }}/build/bin/clang++ -### -fuse-ld=lld -stdlib=libc++ -Wl,--verbose test.cpp
         ls -ltr  ${{ steps.setup-stage.outputs.build-prefix }}/build/lib/*
+        ${{ steps.setup-stage.outputs.build-prefix }}/build/bin/clang++  -fuse-ld=lld -stdlib=libc++ -Wl,--verbose test.cpp
 
     - uses: actions/upload-artifact at ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
       with:

>From 9b5d6cae0a45076034610ab6ac0198a38bcbda7a Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Tue, 14 Oct 2025 17:38:31 -0700
Subject: [PATCH 08/29] Disable IOS

---
 .github/workflows/release-binaries.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml
index 25acfc9ebe52d..df809000dad12 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -135,7 +135,7 @@ jobs:
         # add extra CMake args to disable them.
         # See https://github.com/llvm/llvm-project/issues/99767
         if [ "$RUNNER_OS" = "macOS" ]; then
-          target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_BOOTSTRAP_COMPILER_RT_ENABLE_IOS=OFF"
+          target_cmake_flags="$target_cmake_flags -DCOMPILER_RT_ENABLE_IOS=OFF -DBOOTSTRAP_COMPILER_RT_ENABLE_IOS=OFF -DBOOTSTRAP_BOOTSTRAP_COMPILER_RT_ENABLE_IOS=OFF"
           if [ "$RUNNER_ARCH" = "ARM64" ]; then
             arches=arm64
           else

>From 2cc4f3a7bc47d12722e07c8214def6df4c98e741 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Wed, 15 Oct 2025 11:04:53 -0700
Subject: [PATCH 09/29] Disable local runtimes

---
 clang/cmake/caches/Release.cmake | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/clang/cmake/caches/Release.cmake b/clang/cmake/caches/Release.cmake
index a523cc561b3f9..c0feecfda1cd4 100644
--- a/clang/cmake/caches/Release.cmake
+++ b/clang/cmake/caches/Release.cmake
@@ -44,6 +44,16 @@ set(LLVM_RELEASE_ENABLE_LTO THIN CACHE STRING "")
 set(LLVM_RELEASE_ENABLE_PGO ON CACHE BOOL "")
 set(LLVM_RELEASE_ENABLE_RUNTIMES ${DEFAULT_RUNTIMES} CACHE STRING "")
 set(LLVM_RELEASE_ENABLE_PROJECTS ${DEFAULT_PROJECTS} CACHE STRING "")
+
+if(${CMAKE_HOST_SYSTEM_NAME} MATCHES "Darwin")
+  # Don't link against the just built runtimes due to:
+  # https://github.com/llvm/llvm-project/issues/77653
+  set(DEFAULT_LINK_LOCAL_RUNTIMES OFF)
+else()
+  set(DEFAULT_LINK_LOCAL_RUNTIMES ON)
+endif()
+set(LLVM_RELEASE_LINK_LOCAL_RUNTIMES ${DEFAULT_LINK_LOCAL_RUNTIMES} CACHE BOOL "")
+
 # Note we don't need to add install here, since it is one of the pre-defined
 # steps.
 set(LLVM_RELEASE_FINAL_STAGE_TARGETS "clang;package;check-all;check-llvm;check-clang" CACHE STRING "")
@@ -55,8 +65,12 @@ set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
 
 set(STAGE1_PROJECTS "clang")
 
+# Need to build compiler-rt in order to use PGO for later stages.
+set(STAGE1_RUNTIMES "compiler-rt")
 # Build all runtimes so we can statically link them into the stage2 compiler.
-set(STAGE1_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind")
+if(DEFAULT_LINK_LOCAL_RUNTIMES)
+  list(APPEND STAGE1_RUNTIMES "libcxx;libcxxabi;libunwind")
+endif()
 
 if (LLVM_RELEASE_ENABLE_PGO)
   list(APPEND STAGE1_PROJECTS "lld")
@@ -118,11 +132,13 @@ set_instrument_and_final_stage_var(LLVM_ENABLE_LTO "${LLVM_RELEASE_ENABLE_LTO}"
 if (LLVM_RELEASE_ENABLE_LTO)
   set_instrument_and_final_stage_var(LLVM_ENABLE_LLD "ON" BOOL)
 endif()
-set_instrument_and_final_stage_var(LLVM_ENABLE_LIBCXX "ON" BOOL)
-set_instrument_and_final_stage_var(LLVM_STATIC_LINK_CXX_STDLIB "ON" BOOL)
-set(RELEASE_LINKER_FLAGS "-rtlib=compiler-rt --unwindlib=libunwind")
-if(NOT ${CMAKE_HOST_SYSTEM_NAME} MATCHES "Darwin")
-  set(RELEASE_LINKER_FLAGS "${RELEASE_LINKER_FLAGS} -static-libgcc")
+if(DEFAULT_LINK_LOCAL_RUNTIMES)
+  set_instrument_and_final_stage_var(LLVM_ENABLE_LIBCXX "ON" BOOL)
+  set_instrument_and_final_stage_var(LLVM_STATIC_LINK_CXX_STDLIB "ON" BOOL)
+  set(RELEASE_LINKER_FLAGS "-rtlib=compiler-rt --unwindlib=libunwind")
+  if(NOT ${CMAKE_HOST_SYSTEM_NAME} MATCHES "Darwin")
+    set(RELEASE_LINKER_FLAGS "${RELEASE_LINKER_FLAGS} -static-libgcc")
+  endif()
 endif()
 
 # Set flags for bolt

>From 5ce50f1e65098db2705829304145dcfc6bea10c4 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Wed, 15 Oct 2025 11:14:28 -0700
Subject: [PATCH 10/29] Fix

---
 clang/cmake/caches/Release.cmake | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/clang/cmake/caches/Release.cmake b/clang/cmake/caches/Release.cmake
index c0feecfda1cd4..c891caaacda67 100644
--- a/clang/cmake/caches/Release.cmake
+++ b/clang/cmake/caches/Release.cmake
@@ -146,9 +146,11 @@ if (${CMAKE_HOST_SYSTEM_NAME} MATCHES "Linux")
   set(RELEASE_LINKER_FLAGS "${RELEASE_LINKER_FLAGS} -Wl,--emit-relocs,-znow")
 endif()
 
-set_instrument_and_final_stage_var(CMAKE_EXE_LINKER_FLAGS ${RELEASE_LINKER_FLAGS} STRING)
-set_instrument_and_final_stage_var(CMAKE_SHARED_LINKER_FLAGS ${RELEASE_LINKER_FLAGS} STRING)
-set_instrument_and_final_stage_var(CMAKE_MODULE_LINKER_FLAGS ${RELEASE_LINKER_FLAGS} STRING)
+if (RELEASE_LINKER_FLAGS)
+  set_instrument_and_final_stage_var(CMAKE_EXE_LINKER_FLAGS ${RELEASE_LINKER_FLAGS} STRING)
+  set_instrument_and_final_stage_var(CMAKE_SHARED_LINKER_FLAGS ${RELEASE_LINKER_FLAGS} STRING)
+  set_instrument_and_final_stage_var(CMAKE_MODULE_LINKER_FLAGS ${RELEASE_LINKER_FLAGS} STRING)
+endif()
 
 # Final Stage Config (stage2)
 set_final_stage_var(LLVM_ENABLE_RUNTIMES "${LLVM_RELEASE_ENABLE_RUNTIMES}" STRING)

>From 72aff355892f3e98fd819866288db920993bf5f4 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Wed, 15 Oct 2025 14:36:24 -0700
Subject: [PATCH 11/29] Revert "Fix/Debug"

This reverts commit 6d91fcd5583670d5045985976903854fdd68bb88.
---
 clang/lib/Driver/ToolChain.cpp | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index ac5ec0d1bd9e8..3d5cac62afe01 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -954,12 +954,10 @@ llvm::Triple ToolChain::getTripleWithoutOSVersion() const {
 
 std::optional<std::string>
 ToolChain::getTargetSubDirPath(StringRef BaseDir) const {
-  dbgs() << "getTargetSubDirPath: " << BaseDir << "\n";
   auto getPathForTriple =
       [&](const llvm::Triple &Triple) -> std::optional<std::string> {
     SmallString<128> P(BaseDir);
     llvm::sys::path::append(P, Triple.str());
-  dbgs() << "getTargetSubDirPath: " << P << "\n";
     if (getVFS().exists(P))
       return std::string(P);
     return {};
@@ -1034,13 +1032,7 @@ std::optional<std::string> ToolChain::getRuntimePath() const {
 
 std::optional<std::string> ToolChain::getStdlibPath() const {
   SmallString<128> P(D.Dir);
-  if (Triple.isOSDarwin())
-  dbgs() << "getStdlibPath(): " << P << "\n";
   llvm::sys::path::append(P, "..", "lib");
-  // Darwin does not use per-target runtime directory.
-  if (Triple.isOSDarwin())
-    return std::string(P);
-  dbgs() << "getStdlibPath(): " << P << "\n";
   return getTargetSubDirPath(P);
 }
 
@@ -1559,11 +1551,9 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
 
 void ToolChain::AddFilePathLibArgs(const ArgList &Args,
                                    ArgStringList &CmdArgs) const {
-  for (const auto &LibPath : getFilePaths()) {
-	  llvm::dbgs() << "LibPath: " << LibPath << "\n";
+  for (const auto &LibPath : getFilePaths())
     if(LibPath.length() > 0)
       CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
-  }
 }
 
 void ToolChain::AddCCKextLibArgs(const ArgList &Args,

>From dfc3419d0a267113965335406d42ebb094bbf26e Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Wed, 15 Oct 2025 14:37:09 -0700
Subject: [PATCH 12/29] Revert "Fix build failure"

This reverts commit a0bb37c324b6dcaff28aff35bf39e2ebbf879bb7.
---
 clang/lib/Driver/ToolChains/Darwin.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index 2c869d260211d..7e2d62a6bfc94 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -669,7 +669,7 @@ void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA,
 
   // Add local file paths to ensure the toolchain's libc++ is used instead of
   // the system's.
-  getToolChain().AddFilePathLibArgs(Args, CmdArgs);
+  ToolChain.AddFilePathLibArgs(Args, CmdArgs);
 
   // Forward -ObjC when either -ObjC or -ObjC++ is used, to force loading
   // members of static archive libraries which implement Objective-C classes or

>From 165a856d16be5a5eccdd3042104b9da0b80fd7d3 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Wed, 15 Oct 2025 14:37:41 -0700
Subject: [PATCH 13/29] Revert "[Darwin][Driver] Prefer linking with
 toolchain's libc++ instead of system"

This reverts commit b2f00eb013f5174b1ab5199bb7cc4cab6d5ed059.
---
 clang/lib/Driver/ToolChains/Darwin.cpp | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index 7e2d62a6bfc94..d2356ebdfa86c 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -667,10 +667,6 @@ void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA,
   Args.addAllArgs(CmdArgs, {options::OPT_d_Flag, options::OPT_s, options::OPT_t,
                             options::OPT_Z_Flag, options::OPT_u_Group});
 
-  // Add local file paths to ensure the toolchain's libc++ is used instead of
-  // the system's.
-  ToolChain.AddFilePathLibArgs(Args, CmdArgs);
-
   // Forward -ObjC when either -ObjC or -ObjC++ is used, to force loading
   // members of static archive libraries which implement Objective-C classes or
   // categories.

>From 8f3dc34a3767df75ae8b297bfbce61de9b03a3ce Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Wed, 15 Oct 2025 14:41:55 -0700
Subject: [PATCH 14/29] Fixes

---
 .github/workflows/release-binaries.yml | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml
index df809000dad12..77f250a901aa7 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -240,15 +240,6 @@ jobs:
         release_dir=`find ${{ steps.setup-stage.outputs.build-prefix }}/build -iname 'stage2-bins'`
         mv $release_dir/${{ needs.prepare.outputs.release-binary-filename }} .
 
-    - name: Debug
-      shell: bash
-      if: always()
-      run: |
-        echo "int main(int argc, char** argv) { return 0; }" >> test.cpp
-        ${{ steps.setup-stage.outputs.build-prefix }}/build/bin/clang++ -### -fuse-ld=lld -stdlib=libc++ -Wl,--verbose test.cpp
-        ls -ltr  ${{ steps.setup-stage.outputs.build-prefix }}/build/lib/*
-        ${{ steps.setup-stage.outputs.build-prefix }}/build/bin/clang++  -fuse-ld=lld -stdlib=libc++ -Wl,--verbose test.cpp
-
     - uses: actions/upload-artifact at ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
       with:
         name: ${{ runner.os }}-${{ runner.arch }}-release-binary

>From 34884af5df5a2decc525174ea08e42ff6ba89458 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Thu, 16 Oct 2025 17:24:46 -0700
Subject: [PATCH 15/29] Revert "Disable IOS"

This reverts commit 9b5d6cae0a45076034610ab6ac0198a38bcbda7a.
---
 .github/workflows/release-binaries.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml
index 77f250a901aa7..dda6f8b694803 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -135,7 +135,7 @@ jobs:
         # add extra CMake args to disable them.
         # See https://github.com/llvm/llvm-project/issues/99767
         if [ "$RUNNER_OS" = "macOS" ]; then
-          target_cmake_flags="$target_cmake_flags -DCOMPILER_RT_ENABLE_IOS=OFF -DBOOTSTRAP_COMPILER_RT_ENABLE_IOS=OFF -DBOOTSTRAP_BOOTSTRAP_COMPILER_RT_ENABLE_IOS=OFF"
+          target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_BOOTSTRAP_COMPILER_RT_ENABLE_IOS=OFF"
           if [ "$RUNNER_ARCH" = "ARM64" ]; then
             arches=arm64
           else

>From c57dc7b78a9096f3d2c328c6da981d88ce7a09bb Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Thu, 16 Oct 2025 17:29:37 -0700
Subject: [PATCH 16/29] Disable LTO for pull requests

---
 .github/workflows/release-binaries.yml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml
index dda6f8b694803..3ff5a8719a71e 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -156,8 +156,6 @@ jobs:
           target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF"
         fi
 
-        echo "target-cmake-flags=$target_cmake_flags" >> $GITHUB_OUTPUT
-        echo "build-flang=$build_flang" >> $GITHUB_OUTPUT
         case "${{ inputs.runs-on }}" in
           ubuntu-22.04*)
             build_runs_on="depot-${{ inputs.runs-on }}-16"
@@ -166,6 +164,7 @@ jobs:
           macos-13)
             if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
               build_runs_on="${{ inputs.runs-on }}"
+              target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF"
             else
               build_runs_on="macos-13-large"
             fi
@@ -174,6 +173,7 @@ jobs:
           macos-14)
             if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
               build_runs_on="${{ inputs.runs-on }}"
+              target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF"
             else
               build_runs_on="depot-macos-14"
             fi
@@ -184,6 +184,8 @@ jobs:
             build_runs_on=$test_runs_on
             ;;
         esac
+        echo "target-cmake-flags=$target_cmake_flags" >> $GITHUB_OUTPUT
+        echo "build-flang=$build_flang" >> $GITHUB_OUTPUT
         echo "build-runs-on=$build_runs_on" >> $GITHUB_OUTPUT
         echo "test-runs-on=$test_runs_on" >> $GITHUB_OUTPUT
 

>From 89ed7243eb3eaffe1e898aa5da0c8da4a1a9a9e9 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Fri, 17 Oct 2025 08:13:44 -0700
Subject: [PATCH 17/29] Remove parallel link job limit

---
 .github/workflows/release-binaries.yml | 1 -
 1 file changed, 1 deletion(-)

diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml
index 3ff5a8719a71e..4f900e9bca5a4 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -232,7 +232,6 @@ jobs:
         cmake -G Ninja -S llvm -B ${{ steps.setup-stage.outputs.build-prefix }}/build \
             ${{ needs.prepare.outputs.target-cmake-flags }} \
             -C clang/cmake/caches/Release.cmake \
-            -DBOOTSTRAP_LLVM_PARALLEL_LINK_JOBS=1 \
             -DBOOTSTRAP_BOOTSTRAP_CPACK_PACKAGE_FILE_NAME="${{ needs.prepare.outputs.release-binary-basename }}"
 
     - name: Build

>From 679c693d354fcadd1bc3fea238a0b6a2ed612092 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Fri, 17 Oct 2025 15:59:35 -0700
Subject: [PATCH 18/29] Disable pgo

---
 .github/workflows/release-binaries.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml
index 4f900e9bca5a4..9a7e449d40f0d 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -164,7 +164,7 @@ jobs:
           macos-13)
             if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
               build_runs_on="${{ inputs.runs-on }}"
-              target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF"
+              target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF -DLLVM_RELEASE_ENABLE_PGO=OFF
             else
               build_runs_on="macos-13-large"
             fi
@@ -173,7 +173,7 @@ jobs:
           macos-14)
             if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
               build_runs_on="${{ inputs.runs-on }}"
-              target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF"
+              target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF -DLLVM_RELEASE_ENABLE_PGO=OFF"
             else
               build_runs_on="depot-macos-14"
             fi

>From 5dd5f270421f32eb37f8153a82a5c147e66c4c53 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Fri, 17 Oct 2025 16:07:23 -0700
Subject: [PATCH 19/29] Disable pgo

---
 .github/workflows/release-binaries.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml
index 9a7e449d40f0d..ddca657ff6aff 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -164,7 +164,7 @@ jobs:
           macos-13)
             if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
               build_runs_on="${{ inputs.runs-on }}"
-              target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF -DLLVM_RELEASE_ENABLE_PGO=OFF
+              target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF -DLLVM_RELEASE_ENABLE_PGO=OFF"
             else
               build_runs_on="macos-13-large"
             fi

>From fe3f4cf212474bf7d5fc9dc1b59ee7183cf96d74 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Sat, 18 Oct 2025 06:48:48 -0700
Subject: [PATCH 20/29] fixes

---
 .github/workflows/release-binaries.yml | 76 +++++++++++++++-----------
 1 file changed, 44 insertions(+), 32 deletions(-)

diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml
index ddca657ff6aff..c289825483cef 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -121,6 +121,45 @@ jobs:
         release_binary_basename="LLVM-$release_version-$RUNNER_OS-$RUNNER_ARCH"
         echo "release-binary-basename=$release_binary_basename" >> $GITHUB_OUTPUT
         echo "release-binary-filename=$release_binary_basename.tar.xz" >> $GITHUB_OUTPUT
+        enable_pgo=1
+
+        case "${{ inputs.runs-on }}" in
+          ubuntu-22.04*)
+            build_runs_on="depot-${{ inputs.runs-on }}-16"
+            test_runs_on=$build_runs_on
+            ;;
+          macos-13)
+            if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
+              build_runs_on="${{ inputs.runs-on }}"
+              enable_pgo=0
+              target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF"
+            else
+              build_runs_on="macos-13-large"
+            fi
+            test_runs_on="${{ inputs.runs-on }}"
+            ;;
+          macos-14)
+            if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
+              build_runs_on="${{ inputs.runs-on }}"
+              enable_pgo=0
+              target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF"
+            else
+              build_runs_on="depot-macos-14"
+            fi
+            test_runs_on="${{ inputs.runs-on }}"
+            ;;
+          *)
+            test_runs_on="${{ inputs.runs-on }}"
+            build_runs_on=$test_runs_on
+            ;;
+        esac
+
+        if [ "$enable_pgo" -eq 1 ]; then
+          bootstrap_prefix="BOOTSTRAP_BOOTSTRAP"
+        else
+          bootstrap_prefix="BOOTSTRAP"
+          target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_PGO=OFF"
+        fi
 
         target="$RUNNER_OS-$RUNNER_ARCH"
         # The hendrikmuhs/ccache-action action does not support installing sccache
@@ -135,7 +174,7 @@ jobs:
         # add extra CMake args to disable them.
         # See https://github.com/llvm/llvm-project/issues/99767
         if [ "$RUNNER_OS" = "macOS" ]; then
-          target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_BOOTSTRAP_COMPILER_RT_ENABLE_IOS=OFF"
+          target_cmake_flags="$target_cmake_flags -D${bootstrap_prefix}_COMPILER_RT_ENABLE_IOS=OFF"
           if [ "$RUNNER_ARCH" = "ARM64" ]; then
             arches=arm64
           else
@@ -146,7 +185,7 @@ jobs:
             # so we need to disable flang there.
             target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_PROJECTS='clang;lld;lldb;clang-tools-extra;polly;mlir'"
           fi
-          target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_BOOTSTRAP_DARWIN_osx_ARCHS=$arches -DBOOTSTRAP_BOOTSTRAP_DARWIN_osx_BUILTIN_ARCHS=$arches"
+          target_cmake_flags="$target_cmake_flags -D${bootstrap_prefix}_DARWIN_osx_ARCHS=$arches -D${bootstrap_prefix}_DARWIN_osx_BUILTIN_ARCHS=$arches"
         fi
 
         build_flang="true"
@@ -155,35 +194,9 @@ jobs:
           # The build times out on Windows, so we need to disable LTO.
           target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF"
         fi
+        
+        target_cmake_flags=$target_cmake_flags -D${bootstrap_prefix}_CPACK_PACKAGE_FILE_NAME=$release_binary_basename
 
-        case "${{ inputs.runs-on }}" in
-          ubuntu-22.04*)
-            build_runs_on="depot-${{ inputs.runs-on }}-16"
-            test_runs_on=$build_runs_on
-            ;;
-          macos-13)
-            if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
-              build_runs_on="${{ inputs.runs-on }}"
-              target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF -DLLVM_RELEASE_ENABLE_PGO=OFF"
-            else
-              build_runs_on="macos-13-large"
-            fi
-            test_runs_on="${{ inputs.runs-on }}"
-            ;;
-          macos-14)
-            if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
-              build_runs_on="${{ inputs.runs-on }}"
-              target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF -DLLVM_RELEASE_ENABLE_PGO=OFF"
-            else
-              build_runs_on="depot-macos-14"
-            fi
-            test_runs_on="${{ inputs.runs-on }}"
-            ;;
-          *)
-            test_runs_on="${{ inputs.runs-on }}"
-            build_runs_on=$test_runs_on
-            ;;
-        esac
         echo "target-cmake-flags=$target_cmake_flags" >> $GITHUB_OUTPUT
         echo "build-flang=$build_flang" >> $GITHUB_OUTPUT
         echo "build-runs-on=$build_runs_on" >> $GITHUB_OUTPUT
@@ -231,8 +244,7 @@ jobs:
         # so we need to set some extra cmake flags to disable this.
         cmake -G Ninja -S llvm -B ${{ steps.setup-stage.outputs.build-prefix }}/build \
             ${{ needs.prepare.outputs.target-cmake-flags }} \
-            -C clang/cmake/caches/Release.cmake \
-            -DBOOTSTRAP_BOOTSTRAP_CPACK_PACKAGE_FILE_NAME="${{ needs.prepare.outputs.release-binary-basename }}"
+            -C clang/cmake/caches/Release.cmake
 
     - name: Build
       shell: bash

>From 0772de804b205d5fb14cb7c677be983ed6740669 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Sat, 18 Oct 2025 10:06:53 -0700
Subject: [PATCH 21/29] Fix typo

---
 .github/workflows/release-binaries.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml
index c289825483cef..b326696a87807 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -195,7 +195,7 @@ jobs:
           target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF"
         fi
         
-        target_cmake_flags=$target_cmake_flags -D${bootstrap_prefix}_CPACK_PACKAGE_FILE_NAME=$release_binary_basename
+        target_cmake_flags="$target_cmake_flags -D${bootstrap_prefix}_CPACK_PACKAGE_FILE_NAME=$release_binary_basename"
 
         echo "target-cmake-flags=$target_cmake_flags" >> $GITHUB_OUTPUT
         echo "build-flang=$build_flang" >> $GITHUB_OUTPUT

>From 770dd42a6ba094894832896e8d4b0b277921a353 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Sat, 18 Oct 2025 21:07:51 -0700
Subject: [PATCH 22/29] reduce targets

---
 .github/workflows/release-binaries.yml | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml
index b326696a87807..b7426a6cd0df5 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -131,8 +131,7 @@ jobs:
           macos-13)
             if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
               build_runs_on="${{ inputs.runs-on }}"
-              enable_pgo=0
-              target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF"
+              target_cmake_flags="$target_cmake_flags 
             else
               build_runs_on="macos-13-large"
             fi
@@ -153,6 +152,19 @@ jobs:
             build_runs_on=$test_runs_on
             ;;
         esac
+        
+        case "$build_runs_on" in
+          # These runners cannot build the full release package faster than
+          # the 6 hours timeout limit, so we need to use a configuration
+          # that builds more quickly. 
+          macos-13 | macos-14)
+            bootstrap_prefix="BOOTSTRAP"
+            target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF -DLLVM_RELEASE_ENABLE_PGO=OFF -D${bootstrap_prefix}-LLVM_TARGETS_TO_BUILD=Native"
+            ;;
+          *)
+            bootstrap_prefix="BOOTSTRAP_BOOTSTRAP"
+            ;;
+        esac
 
         if [ "$enable_pgo" -eq 1 ]; then
           bootstrap_prefix="BOOTSTRAP_BOOTSTRAP"

>From 1475a2b9fcac4b4d7cfcede62def21a82f47e79f Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Sat, 18 Oct 2025 21:11:39 -0700
Subject: [PATCH 23/29] Fix typo

---
 .github/workflows/release-binaries.yml | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml
index b7426a6cd0df5..6aae36abba2d2 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -131,7 +131,6 @@ jobs:
           macos-13)
             if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
               build_runs_on="${{ inputs.runs-on }}"
-              target_cmake_flags="$target_cmake_flags 
             else
               build_runs_on="macos-13-large"
             fi
@@ -140,8 +139,6 @@ jobs:
           macos-14)
             if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
               build_runs_on="${{ inputs.runs-on }}"
-              enable_pgo=0
-              target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF"
             else
               build_runs_on="depot-macos-14"
             fi
@@ -166,13 +163,6 @@ jobs:
             ;;
         esac
 
-        if [ "$enable_pgo" -eq 1 ]; then
-          bootstrap_prefix="BOOTSTRAP_BOOTSTRAP"
-        else
-          bootstrap_prefix="BOOTSTRAP"
-          target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_PGO=OFF"
-        fi
-
         target="$RUNNER_OS-$RUNNER_ARCH"
         # The hendrikmuhs/ccache-action action does not support installing sccache
         # on arm64 Linux.

>From 15e5a8a12f2f57c37fc781ddba1a246901f90db6 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Mon, 20 Oct 2025 11:20:14 -0700
Subject: [PATCH 24/29] Improve testing

---
 .github/workflows/release-binaries.yml | 30 +++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml
index 6aae36abba2d2..5bab1c86e7886 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -156,7 +156,7 @@ jobs:
           # that builds more quickly. 
           macos-13 | macos-14)
             bootstrap_prefix="BOOTSTRAP"
-            target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF -DLLVM_RELEASE_ENABLE_PGO=OFF -D${bootstrap_prefix}-LLVM_TARGETS_TO_BUILD=Native"
+            target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF -DLLVM_RELEASE_ENABLE_PGO=OFF -D${bootstrap_prefix}-LLVM_TARGETS_TO_BUILD=Native -DLLVM_RELEASE_ENABLE_PROJECTS="clang;lld;lldb;clang-tools-extra;polly"
             ;;
           *)
             bootstrap_prefix="BOOTSTRAP_BOOTSTRAP"
@@ -269,6 +269,34 @@ jobs:
       run: |
         ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-check-all
 
+  test-release-package-mac-flang:
+    name: "Test Release Package Mac OS (flang)"
+    needs:
+      - prepare
+    if: >-
+      github.event_name == 'pull_request' &&
+      (needs.prepare.outputs.build-runs-on == 'macos-13' ||
+       needs.prepare.outputs.build-runs-on == 'macos-14')
+    runs-on: ${{ needs.prepare.outputs.build-runs-on }}
+    steps:
+    - name: Checkout LLVM
+      uses: actions/checkout at 08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+      with:
+        ref: ${{ needs.prepare.outputs.ref }}
+    - name: Install Ninja
+      uses: llvm/actions/install-ninja at a1ea791b03c8e61f53a0e66f2f73db283aa0f01e # main
+    - name: Configure
+      run: |
+        cmake -G Ninja -S llvm -B build \
+            ${{ needs.prepare.outputs.target-cmake-flags }} \
+            -DLLVM_RELEASE_ENABLE_PROJECTS="clang;mlir;flang" \
+            -DLLVM_RELEASE_FINAL_STAGE_TARGETS="check-flang;check-mlir" \
+            -C clang/cmake/caches/Release.cmake
+    - name: Build and Test
+      run: |
+        ninja -C build stage2-check-flang stage2-check-mlir
+
+
   upload-release-binaries:
     name: "Upload Release Binaries"
     needs:

>From 5733232911dc29fcb2e8c6fcdfb3ea2a4d2d5771 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Mon, 20 Oct 2025 11:41:27 -0700
Subject: [PATCH 25/29] Fix typo

---
 .github/workflows/release-binaries.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml
index 5bab1c86e7886..48f90715f83ed 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -156,7 +156,7 @@ jobs:
           # that builds more quickly. 
           macos-13 | macos-14)
             bootstrap_prefix="BOOTSTRAP"
-            target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF -DLLVM_RELEASE_ENABLE_PGO=OFF -D${bootstrap_prefix}-LLVM_TARGETS_TO_BUILD=Native -DLLVM_RELEASE_ENABLE_PROJECTS="clang;lld;lldb;clang-tools-extra;polly"
+            target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF -DLLVM_RELEASE_ENABLE_PGO=OFF -D${bootstrap_prefix}-LLVM_TARGETS_TO_BUILD=Native -DLLVM_RELEASE_ENABLE_PROJECTS=clang;lld;lldb;clang-tools-extra;polly"
             ;;
           *)
             bootstrap_prefix="BOOTSTRAP_BOOTSTRAP"

>From a2c905a5aaf9107c405918b23d5ba6fdae4d7647 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Mon, 20 Oct 2025 13:40:53 -0700
Subject: [PATCH 26/29] Fix typo

---
 .github/workflows/release-binaries.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml
index 48f90715f83ed..e40971ff73a22 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -156,7 +156,7 @@ jobs:
           # that builds more quickly. 
           macos-13 | macos-14)
             bootstrap_prefix="BOOTSTRAP"
-            target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF -DLLVM_RELEASE_ENABLE_PGO=OFF -D${bootstrap_prefix}-LLVM_TARGETS_TO_BUILD=Native -DLLVM_RELEASE_ENABLE_PROJECTS=clang;lld;lldb;clang-tools-extra;polly"
+            target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF -DLLVM_RELEASE_ENABLE_PGO=OFF -D${bootstrap_prefix}-LLVM_TARGETS_TO_BUILD=Native -DLLVM_RELEASE_ENABLE_PROJECTS='clang;lld;lldb;clang-tools-extra;polly'"
             ;;
           *)
             bootstrap_prefix="BOOTSTRAP_BOOTSTRAP"

>From 1a5751d3ce82f0b7e97ca2e0d43910fa7d080909 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Tue, 21 Oct 2025 19:04:59 -0700
Subject: [PATCH 27/29] Disable flang

---
 clang/cmake/caches/Release.cmake | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/clang/cmake/caches/Release.cmake b/clang/cmake/caches/Release.cmake
index c891caaacda67..9e9e4aa358137 100644
--- a/clang/cmake/caches/Release.cmake
+++ b/clang/cmake/caches/Release.cmake
@@ -30,12 +30,18 @@ endfunction()
 #
 # cmake -D LLVM_RELEASE_ENABLE_PGO=ON -C Release.cmake
 
-set (DEFAULT_PROJECTS "clang;lld;lldb;clang-tools-extra;polly;mlir;flang")
+set (DEFAULT_PROJECTS "clang;lld;lldb;clang-tools-extra;polly;mlir")
 # bolt only supports ELF, so only enable it for Linux.
 if (${CMAKE_HOST_SYSTEM_NAME} MATCHES "Linux")
   list(APPEND DEFAULT_PROJECTS "bolt")
 endif()
 
+# Disable flang on Darwin due to:
+# https://github.com/llvm/llvm-project/issues/160546
+if (NOT ${CMAKE_HOST_SYSTEM_NAME} MATCHES "Darwin")
+  list(APPEND DEFAULT_PROJECT "flang")
+endif()
+
 set (DEFAULT_RUNTIMES "compiler-rt;libcxx")
 if (NOT WIN32)
   list(APPEND DEFAULT_RUNTIMES "libcxxabi" "libunwind")

>From 513edbf41b14cb929b2280b52fdac5f25ae1444f Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Tue, 21 Oct 2025 19:07:17 -0700
Subject: [PATCH 28/29] Fixes

---
 .github/workflows/release-binaries.yml | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml
index e40971ff73a22..4e697ce011c1e 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -156,7 +156,7 @@ jobs:
           # that builds more quickly. 
           macos-13 | macos-14)
             bootstrap_prefix="BOOTSTRAP"
-            target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF -DLLVM_RELEASE_ENABLE_PGO=OFF -D${bootstrap_prefix}-LLVM_TARGETS_TO_BUILD=Native -DLLVM_RELEASE_ENABLE_PROJECTS='clang;lld;lldb;clang-tools-extra;polly'"
+            target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF -DLLVM_RELEASE_ENABLE_PGO=OFF -D${bootstrap_prefix}-LLVM_TARGETS_TO_BUILD=Native"
             ;;
           *)
             bootstrap_prefix="BOOTSTRAP_BOOTSTRAP"
@@ -273,7 +273,11 @@ jobs:
     name: "Test Release Package Mac OS (flang)"
     needs:
       - prepare
+    # Flang is currently disabled on Mac due to
+    # https://github.com/llvm/llvm-project/issues/160546
+    # so we don't need to test it.
     if: >-
+      false && 
       github.event_name == 'pull_request' &&
       (needs.prepare.outputs.build-runs-on == 'macos-13' ||
        needs.prepare.outputs.build-runs-on == 'macos-14')

>From 2355bbc40378bf039bd92bb9005674389fc32b6b Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Mon, 27 Oct 2025 19:20:58 +0000
Subject: [PATCH 29/29] Fixes

---
 .github/workflows/release-binaries-all.yml |  3 ++
 .github/workflows/release-binaries.yml     | 51 +++-------------------
 2 files changed, 10 insertions(+), 44 deletions(-)

diff --git a/.github/workflows/release-binaries-all.yml b/.github/workflows/release-binaries-all.yml
index 7e408497d1819..0b52a08202f1a 100644
--- a/.github/workflows/release-binaries-all.yml
+++ b/.github/workflows/release-binaries-all.yml
@@ -88,6 +88,9 @@ jobs:
         # We use ubuntu-22.04 rather than the latest version to make the built
         # binaries more portable (eg functional aginast older glibc).
         runs-on:
+          - ubuntu-22.04
+          - ubuntu-22.04-arm
+          - macos-13
           - macos-14
 
     uses: ./.github/workflows/release-binaries.yml
diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml
index 8312bfc370aa8..23f9ebe59fbf2 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -1,5 +1,5 @@
 name: Release Binaries
-# TEST
+
 on:
   workflow_dispatch:
     inputs:
@@ -120,7 +120,6 @@ jobs:
         release_binary_basename="LLVM-$release_version-$RUNNER_OS-$RUNNER_ARCH"
         echo "release-binary-basename=$release_binary_basename" >> $GITHUB_OUTPUT
         echo "release-binary-filename=$release_binary_basename.tar.xz" >> $GITHUB_OUTPUT
-        enable_pgo=1
 
         target="$RUNNER_OS-$RUNNER_ARCH"
 
@@ -142,7 +141,6 @@ jobs:
           target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF"
         fi
 
-        echo "target-cmake-flags=$target_cmake_flags" >> $GITHUB_OUTPUT
         case "${{ inputs.runs-on }}" in
           ubuntu-22.04*)
             build_runs_on="depot-${{ inputs.runs-on }}-16"
@@ -169,11 +167,11 @@ jobs:
             build_runs_on=$test_runs_on
             ;;
         esac
-        
+
         case "$build_runs_on" in
           # These runners cannot build the full release package faster than
           # the 6 hours timeout limit, so we need to use a configuration
-          # that builds more quickly. 
+          # that builds more quickly.
           macos-13 | macos-14)
             bootstrap_prefix="BOOTSTRAP"
             target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF -DLLVM_RELEASE_ENABLE_PGO=OFF -D${bootstrap_prefix}-LLVM_TARGETS_TO_BUILD=Native"
@@ -183,44 +181,9 @@ jobs:
             ;;
         esac
 
-        target="$RUNNER_OS-$RUNNER_ARCH"
-        # The hendrikmuhs/ccache-action action does not support installing sccache
-        # on arm64 Linux.
-        if [ "$target" = "Linux-ARM64" ]; then
-          echo ccache=ccache >> $GITHUB_OUTPUT
-        else
-          echo ccache=sccache >> $GITHUB_OUTPUT
-        fi
-
-        # The macOS builds try to cross compile some libraries so we need to
-        # add extra CMake args to disable them.
-        # See https://github.com/llvm/llvm-project/issues/99767
-        if [ "$RUNNER_OS" = "macOS" ]; then
-          target_cmake_flags="$target_cmake_flags -D${bootstrap_prefix}_COMPILER_RT_ENABLE_IOS=OFF"
-          if [ "$RUNNER_ARCH" = "ARM64" ]; then
-            arches=arm64
-          else
-            arches=x86_64
-            # Disable Flang builds on macOS x86_64.  The FortranLower library takes
-            # 2-3 hours to build on macOS, much slower than on Linux.
-            # The long build time causes the release build to time out on x86_64,
-            # so we need to disable flang there.
-            target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_PROJECTS='clang;lld;lldb;clang-tools-extra;polly;mlir'"
-          fi
-          target_cmake_flags="$target_cmake_flags -D${bootstrap_prefix}_DARWIN_osx_ARCHS=$arches -D${bootstrap_prefix}_DARWIN_osx_BUILTIN_ARCHS=$arches"
-        fi
-
-        build_flang="true"
-
-        if [ "$RUNNER_OS" = "Windows" ]; then
-          # The build times out on Windows, so we need to disable LTO.
-          target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF"
-        fi
-        
         target_cmake_flags="$target_cmake_flags -D${bootstrap_prefix}_CPACK_PACKAGE_FILE_NAME=$release_binary_basename"
 
         echo "target-cmake-flags=$target_cmake_flags" >> $GITHUB_OUTPUT
-        echo "build-flang=$build_flang" >> $GITHUB_OUTPUT
         echo "build-runs-on=$build_runs_on" >> $GITHUB_OUTPUT
         echo "test-runs-on=$test_runs_on" >> $GITHUB_OUTPUT
 
@@ -264,8 +227,7 @@ jobs:
         # so we need to set some extra cmake flags to disable this.
         cmake -G Ninja -S llvm -B ${{ steps.setup-stage.outputs.build-prefix }}/build \
             ${{ needs.prepare.outputs.target-cmake-flags }} \
-            -C clang/cmake/caches/Release.cmake \
-            -DBOOTSTRAP_BOOTSTRAP_CPACK_PACKAGE_FILE_NAME="${{ needs.prepare.outputs.release-binary-basename }}"
+            -C clang/cmake/caches/Release.cmake
 
     - name: Build
       shell: bash
@@ -288,8 +250,9 @@ jobs:
       run: |
         ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-check-all
 
-  test-release-package-mac-flang:
-    name: "Test Release Package Mac OS (flang)"
+  # Use a separate job to test some of the projects when running on the smaller runners.
+  test-release-package-mac-flang-mlir:
+    name: "Test Release Package Mac OS (flang + mlir)"
     needs:
       - prepare
     # Flang is currently disabled on Mac due to



More information about the cfe-commits mailing list