about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--library/compiler-builtins/.github/workflows/main.yml7
-rw-r--r--library/compiler-builtins/build.rs5
-rwxr-xr-xlibrary/compiler-builtins/ci/download-compiler-rt.sh10
3 files changed, 16 insertions, 6 deletions
diff --git a/library/compiler-builtins/.github/workflows/main.yml b/library/compiler-builtins/.github/workflows/main.yml
index 1c367a2d0da..34742e34954 100644
--- a/library/compiler-builtins/.github/workflows/main.yml
+++ b/library/compiler-builtins/.github/workflows/main.yml
@@ -4,7 +4,6 @@ on: [push, pull_request]
 env:
   RUSTDOCFLAGS: -Dwarnings
   RUSTFLAGS: -Dwarnings
-  RUST_LLVM_VERSION: 20.1-2025-02-13
   RUST_COMPILER_RT_ROOT: ./compiler-rt
 
 jobs:
@@ -129,12 +128,10 @@ jobs:
       uses: actions/cache@v4
       with:
         path: compiler-rt
-        key: ${{ runner.os }}-compiler-rt-${{ env.RUST_LLVM_VERSION }}
+        key: ${{ runner.os }}-compiler-rt-${{ hashFiles('ci/download-compiler-rt.sh') }}
     - name: Download compiler-rt reference sources
       if: steps.cache-compiler-rt.outputs.cache-hit != 'true'
-      run: |
-        curl -L -o code.tar.gz "https://github.com/rust-lang/llvm-project/archive/rustc/${RUST_LLVM_VERSION}.tar.gz"
-        tar xzf code.tar.gz --strip-components 1 llvm-project-rustc-${RUST_LLVM_VERSION}/compiler-rt
+      run: ./ci/download-compiler-rt.sh
       shell: bash
 
     # Non-linux tests just use our raw script
diff --git a/library/compiler-builtins/build.rs b/library/compiler-builtins/build.rs
index 369354a1d52..3003d51aff8 100644
--- a/library/compiler-builtins/build.rs
+++ b/library/compiler-builtins/build.rs
@@ -619,7 +619,10 @@ mod c {
         let root = match env::var_os("RUST_COMPILER_RT_ROOT") {
             Some(s) => PathBuf::from(s),
             None => {
-                panic!("RUST_COMPILER_RT_ROOT is not set. You may need to download compiler-rt.")
+                panic!(
+                    "RUST_COMPILER_RT_ROOT is not set. You may need to run \
+                    `ci/download-compiler-rt.sh`."
+                );
             }
         };
         if !root.exists() {
diff --git a/library/compiler-builtins/ci/download-compiler-rt.sh b/library/compiler-builtins/ci/download-compiler-rt.sh
new file mode 100755
index 00000000000..bf7f8c24896
--- /dev/null
+++ b/library/compiler-builtins/ci/download-compiler-rt.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+# Download sources to build C versions of intrinsics. Once being run,
+# `RUST_COMPILER_RT_ROOT` must be set.
+
+set -eux
+
+rust_llvm_version=20.1-2025-02-13
+
+curl -L -o code.tar.gz "https://github.com/rust-lang/llvm-project/archive/rustc/${rust_llvm_version}.tar.gz"
+tar xzf code.tar.gz --strip-components 1 llvm-project-rustc-${rust_llvm_version}/compiler-rt