about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-10-10 12:49:20 +0200
committerGitHub <noreply@github.com>2024-10-10 12:49:20 +0200
commit68313623fcb1f8434233f03ee574f495934b17c0 (patch)
treeeb200311c1adaa714df9997487d671c477c2653f /compiler
parent173c50fb0e0ee3eb767b2687a6439a75a58f8978 (diff)
parent09b634a4ba72336f1de2e3f5dccadd6e5bc3a011 (diff)
downloadrust-68313623fcb1f8434233f03ee574f495934b17c0.tar.gz
rust-68313623fcb1f8434233f03ee574f495934b17c0.zip
Rollup merge of #131480 - madsmtm:macos-fix-strip-binary, r=nnethercote
Fix hardcoded strip path when cross-compiling from Linux to Darwin

Fixes https://github.com/rust-lang/rust/issues/131206.

I fear that https://github.com/rust-lang/rust/pull/131405 might end up taking some time, so opening this PR to resolve the regression.

`@rustbot` label O-apple
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_codegen_ssa/src/back/link.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
index e7b1c63a822..34dc599e4fd 100644
--- a/compiler/rustc_codegen_ssa/src/back/link.rs
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs
@@ -1087,7 +1087,9 @@ fn link_natively(
     let strip = sess.opts.cg.strip;
 
     if sess.target.is_like_osx {
-        let stripcmd = "/usr/bin/strip";
+        // Use system `strip` when running on host macOS.
+        // <https://github.com/rust-lang/rust/pull/130781>
+        let stripcmd = if cfg!(target_os = "macos") { "/usr/bin/strip" } else { "strip" };
         match (strip, crate_type) {
             (Strip::Debuginfo, _) => {
                 strip_symbols_with_external_utility(sess, stripcmd, out_filename, Some("-S"))