about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorJieyou Xu <jieyouxu@outlook.com>2024-11-07 19:39:18 +0800
committerJieyou Xu <jieyouxu@outlook.com>2024-11-07 19:41:25 +0800
commitcf9cec3d843b1b6daae76e99027d180b11530bff (patch)
tree230a336c4ae7b5cf9dd3689608726e26521f5fb0 /src/bootstrap
parent9200cbc71230a86b8a70481b625d93a4fa5ef523 (diff)
downloadrust-cf9cec3d843b1b6daae76e99027d180b11530bff.tar.gz
rust-cf9cec3d843b1b6daae76e99027d180b11530bff.zip
Only copy, rename and link `llvm-objcopy` if llvm tools are enabled
Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/src/core/build_steps/compile.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index 3394f2a84a0..24be705f481 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -1976,9 +1976,13 @@ impl Step for Assemble {
             }
         }
 
-        {
-            // `llvm-strip` is used by rustc, which is actually just a symlink to `llvm-objcopy`,
-            // so copy and rename `llvm-objcopy`.
+        if builder.config.llvm_enabled(target_compiler.host) && builder.config.llvm_tools_enabled {
+            // `llvm-strip` is used by rustc, which is actually just a symlink to `llvm-objcopy`, so
+            // copy and rename `llvm-objcopy`.
+            //
+            // But only do so if llvm-tools are enabled, as bootstrap compiler might not contain any
+            // LLVM tools, e.g. for cg_clif.
+            // See <https://github.com/rust-lang/rust/issues/132719>.
             let src_exe = exe("llvm-objcopy", target_compiler.host);
             let dst_exe = exe("rust-objcopy", target_compiler.host);
             builder.copy_link(&libdir_bin.join(src_exe), &libdir_bin.join(dst_exe));