Skip to content

Commit

Permalink
Rollup merge of #131480 - madsmtm:macos-fix-strip-binary, r=nnethercote
Browse files Browse the repository at this point in the history
Fix hardcoded strip path when cross-compiling from Linux to Darwin

Fixes #131206.

I fear that #131405 might end up taking some time, so opening this PR to resolve the regression.

`@rustbot` label O-apple
  • Loading branch information
matthiaskrgr authored Oct 10, 2024
2 parents 173c50f + 09b634a commit 6831362
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down

0 comments on commit 6831362

Please sign in to comment.