Skip to content

Commit

Permalink
Rollup merge of #73138 - eggyal:macos-linker-strip, r=petrochenkov
Browse files Browse the repository at this point in the history
Use shorthand linker strip arguments in order to support MacOS

Per discussion from #72110 (comment) onward, the current `-Z strip` options aren't supported by the MacOS linker, but I think only because it doesn't support the longhand arguments `--strip-debug` and `--strip-all`.

This PR switches to using the shorthand arguments `-s` and `-S` instead, which (I believe) are supported by all GCC linkers.
  • Loading branch information
Dylan-DPC authored Jun 8, 2020
2 parents 31a1858 + 8cf85bc commit fdaeb0f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/librustc_codegen_ssa/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,10 +481,12 @@ impl<'a> Linker for GccLinker<'a> {
match strip {
Strip::None => {}
Strip::Debuginfo => {
self.linker_arg("--strip-debug");
// MacOS linker does not support longhand argument --strip-debug
self.linker_arg("-S");
}
Strip::Symbols => {
self.linker_arg("--strip-all");
// MacOS linker does not support longhand argument --strip-all
self.linker_arg("-s");
}
}
}
Expand Down

0 comments on commit fdaeb0f

Please sign in to comment.