Rollup merge of #82037 - calavera:strip_debuginfo_osx, r=petrochenkov
Make symbols stripping work on MacOS X As reported in the [stabilization issue](https://github.com/rust-lang/rust/issues/72110), MacOS' linker doesn't support the `-s` and `-S` flags to strip symbols anymore. However, the os ships a separated tool to perform these operations. This change allows the compiler to use that tool after a target has been compiled to strip symbols. For rationale, see: https://github.com/rust-lang/rust/issues/72110#issuecomment-641169818 For option selection, see: https://www.unix.com/man-page/osx/1/strip/ Signed-off-by: David Calavera <david.calavera@gmail.com>
This commit is contained in:
@@ -526,15 +526,18 @@ impl<'a> Linker for GccLinker<'a> {
|
||||
fn control_flow_guard(&mut self) {}
|
||||
|
||||
fn debuginfo(&mut self, strip: Strip) {
|
||||
// MacOS linker doesn't support stripping symbols directly anymore.
|
||||
if self.sess.target.is_like_osx {
|
||||
return;
|
||||
}
|
||||
|
||||
match strip {
|
||||
Strip::None => {}
|
||||
Strip::Debuginfo => {
|
||||
// MacOS linker does not support longhand argument --strip-debug
|
||||
self.linker_arg("-S");
|
||||
self.linker_arg("--strip-debug");
|
||||
}
|
||||
Strip::Symbols => {
|
||||
// MacOS linker does not support longhand argument --strip-all
|
||||
self.linker_arg("-s");
|
||||
self.linker_arg("--strip-all");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user