about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-11-11 16:07:15 +0000
committerbors <bors@rust-lang.org>2024-11-11 16:07:15 +0000
commitde27914e8e6c5f8a02698a8ed9b318df17f2f621 (patch)
tree9e23fe2056953cda3cbe9290d51723d9c89f6d99
parentd4822c2d84c242cc7403118b50c571464f38ef8f (diff)
parentcf9cec3d843b1b6daae76e99027d180b11530bff (diff)
downloadrust-de27914e8e6c5f8a02698a8ed9b318df17f2f621.tar.gz
rust-de27914e8e6c5f8a02698a8ed9b318df17f2f621.zip
Auto merge of #132720 - jieyouxu:do-not-strip, r=davidtwco
Only copy, rename and link `llvm-objcopy` if llvm tools are enabled

Fixes #132719.

cc `@bjorn3` who reported the bootstrapping problem for cg_clif.
cc `@davidtwco` in case this might be problematic for linux -> macOS cross-compile builds, but seems very unlikely.
cc `@albertlarsan68` (co-reviewed #131405)

r? 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));