@@ -977,14 +977,20 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>(
977977 }
978978
979979 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 => { }
982984 }
983985 }
984986}
985987
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 ( ) ;
988994 match prog {
989995 Ok ( prog) => {
990996 if !prog. status . success ( ) {
@@ -1002,14 +1008,6 @@ fn strip_symbols_in_osx<'a>(sess: &'a Session, out_filename: &Path, option: &str
10021008 }
10031009}
10041010
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-
10131011fn escape_string ( s : & [ u8 ] ) -> String {
10141012 str:: from_utf8 ( s) . map ( |s| s. to_owned ( ) ) . unwrap_or_else ( |_| {
10151013 let mut x = "Non-UTF-8 output: " . to_string ( ) ;
0 commit comments