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

>From 3bddb3c6d25efbfcc901a42a8367be85599d1f7e Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstel...@redhat.com>
Date: Mon, 23 Sep 2024 13:34:46 +0000
Subject: [PATCH 1/8] [CMake] Add a cache file for building a highly-optimized
 LLVM toolchain

The goal of these cache files is to provide a toolchain that:

1. Relies on only LLVM components (as much as possible).
2. Is highly optimized.

These cache files will produce a full toolchain
(clang/compiler-rt/libcxx/lld) where clang is built with LTO, PGO, and
BOLT optimizations, and is statically linked with an LTO optimized
libc++ and compiler-rt.

I would eventually like to use these as the basis for the release
builds.
---
 .../cmake/caches/llvm-toolchain/stage1.cmake  | 13 ++++++++++++
 .../cmake/caches/llvm-toolchain/stage2.cmake  | 20 +++++++++++++++++++
 .../llvm-toolchain/stage3-instrumented.cmake  | 10 ++++++++++
 .../cmake/caches/llvm-toolchain/stage3.cmake  | 16 +++++++++++++++
 clang/cmake/caches/llvm-toolchain/usage.rst   | 20 +++++++++++++++++++
 5 files changed, 79 insertions(+)
 create mode 100644 clang/cmake/caches/llvm-toolchain/stage1.cmake
 create mode 100644 clang/cmake/caches/llvm-toolchain/stage2.cmake
 create mode 100644 clang/cmake/caches/llvm-toolchain/stage3-instrumented.cmake
 create mode 100644 clang/cmake/caches/llvm-toolchain/stage3.cmake
 create mode 100644 clang/cmake/caches/llvm-toolchain/usage.rst

diff --git a/clang/cmake/caches/llvm-toolchain/stage1.cmake 
b/clang/cmake/caches/llvm-toolchain/stage1.cmake
new file mode 100644
index 00000000000000..13a0a7871dcd26
--- /dev/null
+++ b/clang/cmake/caches/llvm-toolchain/stage1.cmake
@@ -0,0 +1,13 @@
+# Stage 1:
+# * Build the prerequisites for stage 2.
+# * We will be building an LTO optimized libcxx in stage 2, so we need to
+#   build clang and lld.
+
+
+set(CMAKE_BUILD_TYPE Release CACHE STRING "")
+set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
+set(LLVM_ENABLE_PROJECTS "clang;lld" CACHE STRING "")
+
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(CLANG_BOOTSTRAP_CMAKE_ARGS -C ${CMAKE_CURRENT_LIST_DIR}/stage2.cmake CACHE 
BOOL "")
+set(CLANG_BOOTSTRAP_TARGETS stage3-check-all stage3-distribution 
stage3-install-distribution stage3-clang stage3-clang-bolt CACHE BOOL "")
diff --git a/clang/cmake/caches/llvm-toolchain/stage2.cmake 
b/clang/cmake/caches/llvm-toolchain/stage2.cmake
new file mode 100644
index 00000000000000..87ac7899b205ef
--- /dev/null
+++ b/clang/cmake/caches/llvm-toolchain/stage2.cmake
@@ -0,0 +1,20 @@
+# Stage 2:
+# * Build an LTO optimized libcxx, so we can staticially link it into stage 3
+#   clang.
+# * Stage 3 will be PGO optimized, so we need to build clang, lld, and
+#   compiler-rt in stage 2.
+
+
+set(CMAKE_BUILD_TYPE Release CACHE STRING "")
+set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
+set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING 
"" FORCE)
+set(LLVM_ENABLE_PROJECTS "clang;lld" CACHE STRING "" FORCE)
+
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(CLANG_BOOTSTRAP_CMAKE_ARGS -C 
${CMAKE_CURRENT_LIST_DIR}/stage3-instrumented.cmake CACHE BOOL "")
+set(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED IR CACHE BOOL "")
+set(CLANG_BOOTSTRAP_TARGETS stage3-check-all stage3-distribution 
stage3-install-distribution stage3-clang stage3-clang-bolt CACHE BOOL "")
+set(LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY ON CACHE STRING "")
+set(RUNTIMES_CMAKE_ARGS "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON" CACHE STRING 
"")
+set(LLVM_ENABLE_LLD ON CACHE STRING "")
+#set(CLANG_DEFAULT_RTLIB compiler-rt CACHE STRING "")
diff --git a/clang/cmake/caches/llvm-toolchain/stage3-instrumented.cmake 
b/clang/cmake/caches/llvm-toolchain/stage3-instrumented.cmake
new file mode 100644
index 00000000000000..4570a6c758ccda
--- /dev/null
+++ b/clang/cmake/caches/llvm-toolchain/stage3-instrumented.cmake
@@ -0,0 +1,10 @@
+# Stage 3 instrumented:
+# * Build an instrumented clang, so we can generate profile data for stage 3.
+
+
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(CLANG_BOOTSTRAP_CMAKE_ARGS -C ${CMAKE_CURRENT_LIST_DIR}/stage3.cmake CACHE 
BOOL "")
+set(CLANG_BOOTSTRAP_TARGETS clang check-all distribution install-distribution 
clang-bolt CACHE BOOL "")
+set(CLANG_BOLT OFF CACHE STRING "")
+
+include(${CMAKE_CURRENT_LIST_DIR}/stage3.cmake)
diff --git a/clang/cmake/caches/llvm-toolchain/stage3.cmake 
b/clang/cmake/caches/llvm-toolchain/stage3.cmake
new file mode 100644
index 00000000000000..a9050a64d8f633
--- /dev/null
+++ b/clang/cmake/caches/llvm-toolchain/stage3.cmake
@@ -0,0 +1,16 @@
+# Stage 3:
+# * This is the final stage.
+# * The goals is to have a clang that is LTO, PGO, and bolt optimized and also
+#   statically linked to libcxx and compiler-rt.
+
+set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
+set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING 
"" FORCE)
+set(LLVM_ENABLE_PROJECTS "clang;lld;bolt;" CACHE STRING "" FORCE)
+set(LLVM_ENABLE_LLD ON CACHE STRING "")
+set(LLVM_ENABLE_LTO THIN CACHE STRING "")
+set(LLVM_ENABLE_LIBCXX ON CACHE STRING "")
+set(LLVM_STATIC_LINK_CXX_STDLIB ON CACHE STRING "")
+set(CLANG_BOLT "INSTRUMENT" CACHE STRING "")
+set(CMAKE_EXE_LINKER_FLAGS "-Wl,--emit-relocs,-znow -rtlib=compiler-rt 
--unwindlib=libunwind -static-libgcc" CACHE STRING "")
+set(CMAKE_SHARED_LINKER_FLAGS "-rtlib=compiler-rt --unwindlib=libunwind 
-static-libgcc" CACHE STRING "")
+set(LLVM_DISTRIBUTION_COMPONENTS "clang;lld;runtimes;clang-resource-headers" 
CACHE STRING "")
diff --git a/clang/cmake/caches/llvm-toolchain/usage.rst 
b/clang/cmake/caches/llvm-toolchain/usage.rst
new file mode 100644
index 00000000000000..82b6d678669643
--- /dev/null
+++ b/clang/cmake/caches/llvm-toolchain/usage.rst
@@ -0,0 +1,20 @@
+# LLVM Toolchain Build
+
+This directory contains cache files for building a complete LLVM-based 
toolchain.
+The resulting clang build will be LTO, PGO, and BOLT optimized and statically
+linked against libc++ and compiler-rt.
+
+The build is done in 4 stages:
+
+* Stage 1: Build clang/lld.
+* Stage 2: Build an LTO optimized libc++ with Stage 1 clang/lld.
+* Stage 3 Instrumented: Build clang with instrumentation in order to generate
+  profile data for PGO.
+* Stage 3: Build clang with LTO, PGO, and BOLT optimizations and statically 
link
+           with stage2 libc++ and compiler-rt.
+
+## Usage
+
+..
+  cmake -S llvm -B build -C clang/cmake/caches/llvm-toolchain/stage1.cmake
+  ninja stage3-install-distribution

>From d188a03dee75b3e9964785e11d7edecbbad7ad0e Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstel...@redhat.com>
Date: Tue, 26 Nov 2024 14:26:09 -0800
Subject: [PATCH 2/8] Fix documentation

---
 clang/cmake/caches/llvm-toolchain/usage.rst | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/clang/cmake/caches/llvm-toolchain/usage.rst 
b/clang/cmake/caches/llvm-toolchain/usage.rst
index 82b6d678669643..739e2326273906 100644
--- a/clang/cmake/caches/llvm-toolchain/usage.rst
+++ b/clang/cmake/caches/llvm-toolchain/usage.rst
@@ -15,6 +15,7 @@ The build is done in 4 stages:
 
 ## Usage
 
-..
-  cmake -S llvm -B build -C clang/cmake/caches/llvm-toolchain/stage1.cmake
-  ninja stage3-install-distribution
+::
+
+  $ cmake -S llvm -B build -C clang/cmake/caches/llvm-toolchain/stage1.cmake
+  $ ninja stage3-install-distribution

>From 7d1bf4d7bdbb2231fd948184dd2d0daea09e8eb1 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstel...@redhat.com>
Date: Wed, 27 Nov 2024 05:59:45 +0000
Subject: [PATCH 3/8] Use 3stages

---
 .../cmake/caches/llvm-toolchain/stage1.cmake  | 18 ++++++++-----
 ...mented.cmake => stage2-instrumented.cmake} |  8 +++---
 .../cmake/caches/llvm-toolchain/stage2.cmake  | 26 ++++++++-----------
 .../cmake/caches/llvm-toolchain/stage3.cmake  | 16 ------------
 clang/cmake/caches/llvm-toolchain/usage.rst   | 12 ++++-----
 5 files changed, 31 insertions(+), 49 deletions(-)
 rename clang/cmake/caches/llvm-toolchain/{stage3-instrumented.cmake => 
stage2-instrumented.cmake} (74%)
 delete mode 100644 clang/cmake/caches/llvm-toolchain/stage3.cmake

diff --git a/clang/cmake/caches/llvm-toolchain/stage1.cmake 
b/clang/cmake/caches/llvm-toolchain/stage1.cmake
index 13a0a7871dcd26..f3fbe5476aa651 100644
--- a/clang/cmake/caches/llvm-toolchain/stage1.cmake
+++ b/clang/cmake/caches/llvm-toolchain/stage1.cmake
@@ -1,13 +1,17 @@
-# Stage 1:
-# * Build the prerequisites for stage 2.
-# * We will be building an LTO optimized libcxx in stage 2, so we need to
-#   build clang and lld.
+# Stage 1
+# * Build an LTO optimized libcxx, so we can staticially link it into stage 2
+#   clang.
 
 
 set(CMAKE_BUILD_TYPE Release CACHE STRING "")
 set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
-set(LLVM_ENABLE_PROJECTS "clang;lld" CACHE STRING "")
+set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING 
"" FORCE)
+set(LLVM_ENABLE_PROJECTS "clang;lld" CACHE STRING "" FORCE)
 
 set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
-set(CLANG_BOOTSTRAP_CMAKE_ARGS -C ${CMAKE_CURRENT_LIST_DIR}/stage2.cmake CACHE 
BOOL "")
-set(CLANG_BOOTSTRAP_TARGETS stage3-check-all stage3-distribution 
stage3-install-distribution stage3-clang stage3-clang-bolt CACHE BOOL "")
+set(CLANG_BOOTSTRAP_CMAKE_ARGS -C 
${CMAKE_CURRENT_LIST_DIR}/stage2-instrumented.cmake CACHE BOOL "")
+set(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED IR CACHE BOOL "")
+set(CLANG_BOOTSTRAP_TARGETS stage2-check-all stage2-distribution 
stage2-install-distribution stage2-clang stage2-clang-bolt CACHE BOOL "")
+set(LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY ON CACHE STRING "")
+set(RUNTIMES_CMAKE_ARGS "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON" CACHE STRING 
"")
+set(LLVM_ENABLE_LLD ON CACHE STRING "")
diff --git a/clang/cmake/caches/llvm-toolchain/stage3-instrumented.cmake 
b/clang/cmake/caches/llvm-toolchain/stage2-instrumented.cmake
similarity index 74%
rename from clang/cmake/caches/llvm-toolchain/stage3-instrumented.cmake
rename to clang/cmake/caches/llvm-toolchain/stage2-instrumented.cmake
index 4570a6c758ccda..c8e1883c10dfc7 100644
--- a/clang/cmake/caches/llvm-toolchain/stage3-instrumented.cmake
+++ b/clang/cmake/caches/llvm-toolchain/stage2-instrumented.cmake
@@ -1,10 +1,10 @@
-# Stage 3 instrumented:
-# * Build an instrumented clang, so we can generate profile data for stage 3.
+# Stage 2 instrumented:
+# * Build an instrumented clang, so we can generate profile data for stage 2.
 
 
 set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
-set(CLANG_BOOTSTRAP_CMAKE_ARGS -C ${CMAKE_CURRENT_LIST_DIR}/stage3.cmake CACHE 
BOOL "")
+set(CLANG_BOOTSTRAP_CMAKE_ARGS -C ${CMAKE_CURRENT_LIST_DIR}/stage2.cmake CACHE 
BOOL "")
 set(CLANG_BOOTSTRAP_TARGETS clang check-all distribution install-distribution 
clang-bolt CACHE BOOL "")
 set(CLANG_BOLT OFF CACHE STRING "")
 
-include(${CMAKE_CURRENT_LIST_DIR}/stage3.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/stage2.cmake)
diff --git a/clang/cmake/caches/llvm-toolchain/stage2.cmake 
b/clang/cmake/caches/llvm-toolchain/stage2.cmake
index 87ac7899b205ef..740378e0901e92 100644
--- a/clang/cmake/caches/llvm-toolchain/stage2.cmake
+++ b/clang/cmake/caches/llvm-toolchain/stage2.cmake
@@ -1,20 +1,16 @@
 # Stage 2:
-# * Build an LTO optimized libcxx, so we can staticially link it into stage 3
-#   clang.
-# * Stage 3 will be PGO optimized, so we need to build clang, lld, and
-#   compiler-rt in stage 2.
+# * This is the final stage.
+# * The goal is to have a clang that is LTO, PGO, and bolt optimized and also
+#   statically linked to libcxx and compiler-rt.
 
-
-set(CMAKE_BUILD_TYPE Release CACHE STRING "")
 set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
 set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING 
"" FORCE)
-set(LLVM_ENABLE_PROJECTS "clang;lld" CACHE STRING "" FORCE)
-
-set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
-set(CLANG_BOOTSTRAP_CMAKE_ARGS -C 
${CMAKE_CURRENT_LIST_DIR}/stage3-instrumented.cmake CACHE BOOL "")
-set(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED IR CACHE BOOL "")
-set(CLANG_BOOTSTRAP_TARGETS stage3-check-all stage3-distribution 
stage3-install-distribution stage3-clang stage3-clang-bolt CACHE BOOL "")
-set(LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY ON CACHE STRING "")
-set(RUNTIMES_CMAKE_ARGS "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON" CACHE STRING 
"")
+set(LLVM_ENABLE_PROJECTS "clang;lld;bolt;" CACHE STRING "" FORCE)
 set(LLVM_ENABLE_LLD ON CACHE STRING "")
-#set(CLANG_DEFAULT_RTLIB compiler-rt CACHE STRING "")
+set(LLVM_ENABLE_LTO THIN CACHE STRING "")
+set(LLVM_ENABLE_LIBCXX ON CACHE STRING "")
+set(LLVM_STATIC_LINK_CXX_STDLIB ON CACHE STRING "")
+set(CLANG_BOLT "INSTRUMENT" CACHE STRING "")
+set(CMAKE_EXE_LINKER_FLAGS "-Wl,--emit-relocs,-znow -rtlib=compiler-rt 
--unwindlib=libunwind -static-libgcc" CACHE STRING "")
+set(CMAKE_SHARED_LINKER_FLAGS "-rtlib=compiler-rt --unwindlib=libunwind 
-static-libgcc" CACHE STRING "")
+set(LLVM_DISTRIBUTION_COMPONENTS "clang;lld;runtimes;clang-resource-headers" 
CACHE STRING "")
diff --git a/clang/cmake/caches/llvm-toolchain/stage3.cmake 
b/clang/cmake/caches/llvm-toolchain/stage3.cmake
deleted file mode 100644
index a9050a64d8f633..00000000000000
--- a/clang/cmake/caches/llvm-toolchain/stage3.cmake
+++ /dev/null
@@ -1,16 +0,0 @@
-# Stage 3:
-# * This is the final stage.
-# * The goals is to have a clang that is LTO, PGO, and bolt optimized and also
-#   statically linked to libcxx and compiler-rt.
-
-set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
-set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING 
"" FORCE)
-set(LLVM_ENABLE_PROJECTS "clang;lld;bolt;" CACHE STRING "" FORCE)
-set(LLVM_ENABLE_LLD ON CACHE STRING "")
-set(LLVM_ENABLE_LTO THIN CACHE STRING "")
-set(LLVM_ENABLE_LIBCXX ON CACHE STRING "")
-set(LLVM_STATIC_LINK_CXX_STDLIB ON CACHE STRING "")
-set(CLANG_BOLT "INSTRUMENT" CACHE STRING "")
-set(CMAKE_EXE_LINKER_FLAGS "-Wl,--emit-relocs,-znow -rtlib=compiler-rt 
--unwindlib=libunwind -static-libgcc" CACHE STRING "")
-set(CMAKE_SHARED_LINKER_FLAGS "-rtlib=compiler-rt --unwindlib=libunwind 
-static-libgcc" CACHE STRING "")
-set(LLVM_DISTRIBUTION_COMPONENTS "clang;lld;runtimes;clang-resource-headers" 
CACHE STRING "")
diff --git a/clang/cmake/caches/llvm-toolchain/usage.rst 
b/clang/cmake/caches/llvm-toolchain/usage.rst
index 739e2326273906..fff580899d934b 100644
--- a/clang/cmake/caches/llvm-toolchain/usage.rst
+++ b/clang/cmake/caches/llvm-toolchain/usage.rst
@@ -4,18 +4,16 @@ This directory contains cache files for building a complete 
LLVM-based toolchain
 The resulting clang build will be LTO, PGO, and BOLT optimized and statically
 linked against libc++ and compiler-rt.
 
-The build is done in 4 stages:
+The build is done in 3 stages:
 
-* Stage 1: Build clang/lld.
-* Stage 2: Build an LTO optimized libc++ with Stage 1 clang/lld.
-* Stage 3 Instrumented: Build clang with instrumentation in order to generate
+* Stage 1: Build an LTO optimized libc++ with Stage 1 clang/lld.
+* Stage 2 Instrumented: Build clang with instrumentation in order to generate
   profile data for PGO.
-* Stage 3: Build clang with LTO, PGO, and BOLT optimizations and statically 
link
+* Stage 2: Build clang with LTO, PGO, and BOLT optimizations and statically 
link
            with stage2 libc++ and compiler-rt.
 
 ## Usage
 
 ::
-
   $ cmake -S llvm -B build -C clang/cmake/caches/llvm-toolchain/stage1.cmake
-  $ ninja stage3-install-distribution
+  $ ninja stage2-install-distribution

>From ed2ba87ecb41b6a327b1f5293a68b34645eb856f Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstel...@redhat.com>
Date: Thu, 9 Jan 2025 12:50:59 -0800
Subject: [PATCH 4/8] Update clang/cmake/caches/llvm-toolchain/stage1.cmake

Co-authored-by: Shoaib Meenai <shoaib.mee...@gmail.com>
---
 clang/cmake/caches/llvm-toolchain/stage1.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/cmake/caches/llvm-toolchain/stage1.cmake 
b/clang/cmake/caches/llvm-toolchain/stage1.cmake
index f3fbe5476aa651..eae98b568b22a5 100644
--- a/clang/cmake/caches/llvm-toolchain/stage1.cmake
+++ b/clang/cmake/caches/llvm-toolchain/stage1.cmake
@@ -5,7 +5,7 @@
 
 set(CMAKE_BUILD_TYPE Release CACHE STRING "")
 set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
-set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING 
"" FORCE)
+set(LLVM_ENABLE_RUNTIMES compiler-rt libcxx libcxxabi libunwind CACHE STRING 
"" FORCE)
 set(LLVM_ENABLE_PROJECTS "clang;lld" CACHE STRING "" FORCE)
 
 set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")

>From 3c26cba0a65a2deb679eabdfc52633474f23e8e7 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstel...@redhat.com>
Date: Fri, 10 Jan 2025 21:19:41 +0000
Subject: [PATCH 5/8] Stage 1

---
 clang/cmake/caches/llvm-toolchain/stage1.cmake | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/cmake/caches/llvm-toolchain/stage1.cmake 
b/clang/cmake/caches/llvm-toolchain/stage1.cmake
index eae98b568b22a5..b3e76eee43c25d 100644
--- a/clang/cmake/caches/llvm-toolchain/stage1.cmake
+++ b/clang/cmake/caches/llvm-toolchain/stage1.cmake
@@ -5,8 +5,8 @@
 
 set(CMAKE_BUILD_TYPE Release CACHE STRING "")
 set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
-set(LLVM_ENABLE_RUNTIMES compiler-rt libcxx libcxxabi libunwind CACHE STRING 
"" FORCE)
-set(LLVM_ENABLE_PROJECTS "clang;lld" CACHE STRING "" FORCE)
+set(LLVM_ENABLE_RUNTIMES compiler-rt libcxx libcxxabi libunwind CACHE STRING 
"")
+set(LLVM_ENABLE_PROJECTS clang lld CACHE STRING "")
 
 set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
 set(CLANG_BOOTSTRAP_CMAKE_ARGS -C 
${CMAKE_CURRENT_LIST_DIR}/stage2-instrumented.cmake CACHE BOOL "")

>From 3425cc624f1728342f19ea46c0ce34c79b4d5a9a Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstel...@redhat.com>
Date: Fri, 10 Jan 2025 21:56:49 +0000
Subject: [PATCH 6/8] stage2

---
 clang/cmake/caches/llvm-toolchain/stage2.cmake | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/clang/cmake/caches/llvm-toolchain/stage2.cmake 
b/clang/cmake/caches/llvm-toolchain/stage2.cmake
index 740378e0901e92..b1736705d99201 100644
--- a/clang/cmake/caches/llvm-toolchain/stage2.cmake
+++ b/clang/cmake/caches/llvm-toolchain/stage2.cmake
@@ -4,13 +4,13 @@
 #   statically linked to libcxx and compiler-rt.
 
 set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
-set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING 
"" FORCE)
-set(LLVM_ENABLE_PROJECTS "clang;lld;bolt;" CACHE STRING "" FORCE)
-set(LLVM_ENABLE_LLD ON CACHE STRING "")
+set(LLVM_ENABLE_RUNTIMES compiler-rt libcxx libcxxabi libunwind CACHE STRING 
"" FORCE)
+set(LLVM_ENABLE_PROJECTS clang lld bolt CACHE STRING "" FORCE)
+set(LLVM_ENABLE_LLD ON CACHE BOOL "")
 set(LLVM_ENABLE_LTO THIN CACHE STRING "")
-set(LLVM_ENABLE_LIBCXX ON CACHE STRING "")
-set(LLVM_STATIC_LINK_CXX_STDLIB ON CACHE STRING "")
+set(LLVM_ENABLE_LIBCXX ON CACHE BOOL "")
+set(LLVM_STATIC_LINK_CXX_STDLIB ON CACHE BOOL "")
 set(CLANG_BOLT "INSTRUMENT" CACHE STRING "")
 set(CMAKE_EXE_LINKER_FLAGS "-Wl,--emit-relocs,-znow -rtlib=compiler-rt 
--unwindlib=libunwind -static-libgcc" CACHE STRING "")
 set(CMAKE_SHARED_LINKER_FLAGS "-rtlib=compiler-rt --unwindlib=libunwind 
-static-libgcc" CACHE STRING "")
-set(LLVM_DISTRIBUTION_COMPONENTS "clang;lld;runtimes;clang-resource-headers" 
CACHE STRING "")
+set(LLVM_DISTRIBUTION_COMPONENTS clang lld runtimes clang-resource-headers 
CACHE STRING "")

>From bf3e9617c3f9baa59cef47f9db212e6a5d595cb5 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstel...@redhat.com>
Date: Fri, 10 Jan 2025 22:19:34 +0000
Subject: [PATCH 7/8] Stage2-instrumented

---
 clang/cmake/caches/llvm-toolchain/stage2-instrumented.cmake | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/clang/cmake/caches/llvm-toolchain/stage2-instrumented.cmake 
b/clang/cmake/caches/llvm-toolchain/stage2-instrumented.cmake
index c8e1883c10dfc7..783b8e0b2067e6 100644
--- a/clang/cmake/caches/llvm-toolchain/stage2-instrumented.cmake
+++ b/clang/cmake/caches/llvm-toolchain/stage2-instrumented.cmake
@@ -3,8 +3,9 @@
 
 
 set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
-set(CLANG_BOOTSTRAP_CMAKE_ARGS -C ${CMAKE_CURRENT_LIST_DIR}/stage2.cmake CACHE 
BOOL "")
-set(CLANG_BOOTSTRAP_TARGETS clang check-all distribution install-distribution 
clang-bolt CACHE BOOL "")
+set(LLVM_BUILD_INSTRUMENTED IR CACHE STRING "")
+set(CLANG_BOOTSTRAP_CMAKE_ARGS -C ${CMAKE_CURRENT_LIST_DIR}/stage2.cmake CACHE 
STRING "")
+set(CLANG_BOOTSTRAP_TARGETS clang check-all distribution install-distribution 
clang-bolt CACHE STRING "")
 set(CLANG_BOLT OFF CACHE STRING "")
 
 include(${CMAKE_CURRENT_LIST_DIR}/stage2.cmake)

>From 5845f0965d7ca117aa514b338347dd222b207279 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstel...@redhat.com>
Date: Fri, 10 Jan 2025 23:40:12 +0000
Subject: [PATCH 8/8] Add Module Linker flags

---
 clang/cmake/caches/llvm-toolchain/stage2.cmake | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/cmake/caches/llvm-toolchain/stage2.cmake 
b/clang/cmake/caches/llvm-toolchain/stage2.cmake
index b1736705d99201..40c200c3f715fa 100644
--- a/clang/cmake/caches/llvm-toolchain/stage2.cmake
+++ b/clang/cmake/caches/llvm-toolchain/stage2.cmake
@@ -13,4 +13,5 @@ set(LLVM_STATIC_LINK_CXX_STDLIB ON CACHE BOOL "")
 set(CLANG_BOLT "INSTRUMENT" CACHE STRING "")
 set(CMAKE_EXE_LINKER_FLAGS "-Wl,--emit-relocs,-znow -rtlib=compiler-rt 
--unwindlib=libunwind -static-libgcc" CACHE STRING "")
 set(CMAKE_SHARED_LINKER_FLAGS "-rtlib=compiler-rt --unwindlib=libunwind 
-static-libgcc" CACHE STRING "")
+set(CMAKE_MODULE_LINKER_FLAGS "-rtlib=compiler-rt --unwindlib=libunwind 
-static-libgcc" CACHE STRING "")
 set(LLVM_DISTRIBUTION_COMPONENTS clang lld runtimes clang-resource-headers 
CACHE STRING "")

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to