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
This commit is contained in:
Matthias Krüger 2024-10-10 12:49:20 +02:00 committed by GitHub
commit 68313623fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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"))