@@ -1107,11 +1107,13 @@ fn link_natively(
11071107 let stripcmd = "rust-objcopy" ;
11081108 match ( strip, crate_type) {
11091109 ( Strip :: Debuginfo , _) => {
1110- strip_symbols_with_external_utility ( sess, stripcmd, out_filename, Some ( "-S" ) )
1110+ let strip_options = vec ! [ "-S" . to_string( ) ] ;
1111+ strip_symbols_with_external_utility ( sess, stripcmd, out_filename, Some ( & strip_options) )
11111112 }
11121113 // Per the manpage, `-x` is the maximum safe strip level for dynamic libraries. (#93988)
11131114 ( Strip :: Symbols , CrateType :: Dylib | CrateType :: Cdylib | CrateType :: ProcMacro ) => {
1114- strip_symbols_with_external_utility ( sess, stripcmd, out_filename, Some ( "-x" ) )
1115+ let strip_options = vec ! [ "-x" . to_string( ) ] ;
1116+ strip_symbols_with_external_utility ( sess, stripcmd, out_filename, Some ( & strip_options) )
11151117 }
11161118 ( Strip :: Symbols , _) => {
11171119 strip_symbols_with_external_utility ( sess, stripcmd, out_filename, None )
@@ -1131,7 +1133,8 @@ fn link_natively(
11311133 match strip {
11321134 // Always preserve the symbol table (-x).
11331135 Strip :: Debuginfo => {
1134- strip_symbols_with_external_utility ( sess, stripcmd, out_filename, Some ( "-x" ) )
1136+ let strip_options = vec ! [ "-x" . to_string( ) ] ;
1137+ strip_symbols_with_external_utility ( sess, stripcmd, out_filename, Some ( & strip_options) )
11351138 }
11361139 // Strip::Symbols is handled via the --strip-all linker option.
11371140 Strip :: Symbols => { }
@@ -1145,14 +1148,17 @@ fn link_natively(
11451148 sess. dcx ( ) . emit_warn ( errors:: AixStripNotUsed ) ;
11461149 }
11471150 let stripcmd = "/usr/bin/strip" ;
1151+ let mut strip_options = vec ! [ "-X32_64" . to_string( ) ] ;
11481152 match strip {
11491153 Strip :: Debuginfo => {
11501154 // FIXME: AIX's strip utility only offers option to strip line number information.
1151- strip_symbols_with_external_utility ( sess, stripcmd, out_filename, Some ( "-l" ) )
1155+ strip_options. push ( "-l" . to_string ( ) ) ;
1156+ strip_symbols_with_external_utility ( sess, stripcmd, out_filename, Some ( & strip_options) )
11521157 }
11531158 Strip :: Symbols => {
11541159 // Must be noted this option might remove symbol __aix_rust_metadata and thus removes .info section which contains metadata.
1155- strip_symbols_with_external_utility ( sess, stripcmd, out_filename, Some ( "-r" ) )
1160+ strip_options. push ( "-r" . to_string ( ) ) ;
1161+ strip_symbols_with_external_utility ( sess, stripcmd, out_filename, Some ( & strip_options) )
11561162 }
11571163 Strip :: None => { }
11581164 }
@@ -1165,11 +1171,13 @@ fn strip_symbols_with_external_utility(
11651171 sess : & Session ,
11661172 util : & str ,
11671173 out_filename : & Path ,
1168- option : Option < & str > ,
1174+ options : Option < & [ String ] > ,
11691175) {
11701176 let mut cmd = Command :: new ( util) ;
1171- if let Some ( option) = option {
1172- cmd. arg ( option) ;
1177+ if let Some ( opts) = options {
1178+ for option in opts {
1179+ cmd. arg ( option) ;
1180+ }
11731181 }
11741182
11751183 let mut new_path = sess. get_tools_search_paths ( false ) ;
0 commit comments