@@ -977,14 +977,20 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>(
977
977
}
978
978
979
979
if sess. target . is_like_osx {
980
- if let Some ( option) = osx_strip_opt ( sess. opts . debugging_opts . strip ) {
981
- strip_symbols_in_osx ( sess, & out_filename, option) ;
980
+ match sess. opts . debugging_opts . strip {
981
+ Strip :: Debuginfo => strip_symbols_in_osx ( sess, & out_filename, Some ( "-S" ) ) ,
982
+ Strip :: Symbols => strip_symbols_in_osx ( sess, & out_filename, None ) ,
983
+ Strip :: None => { }
982
984
}
983
985
}
984
986
}
985
987
986
- fn strip_symbols_in_osx < ' a > ( sess : & ' a Session , out_filename : & Path , option : & str ) {
987
- let prog = Command :: new ( "strip" ) . arg ( option) . arg ( out_filename) . output ( ) ;
988
+ fn strip_symbols_in_osx < ' a > ( sess : & ' a Session , out_filename : & Path , option : Option < & str > ) {
989
+ let mut cmd = Command :: new ( "strip" ) ;
990
+ if let Some ( option) = option {
991
+ cmd. arg ( option) ;
992
+ }
993
+ let prog = cmd. arg ( out_filename) . output ( ) ;
988
994
match prog {
989
995
Ok ( prog) => {
990
996
if !prog. status . success ( ) {
@@ -1002,14 +1008,6 @@ fn strip_symbols_in_osx<'a>(sess: &'a Session, out_filename: &Path, option: &str
1002
1008
}
1003
1009
}
1004
1010
1005
- fn osx_strip_opt < ' a > ( strip : Strip ) -> Option < & ' a str > {
1006
- match strip {
1007
- Strip :: Debuginfo => Some ( "-S" ) ,
1008
- Strip :: Symbols => Some ( "-x" ) ,
1009
- Strip :: None => None ,
1010
- }
1011
- }
1012
-
1013
1011
fn escape_string ( s : & [ u8 ] ) -> String {
1014
1012
str:: from_utf8 ( s) . map ( |s| s. to_owned ( ) ) . unwrap_or_else ( |_| {
1015
1013
let mut x = "Non-UTF-8 output: " . to_string ( ) ;
0 commit comments