Skip to content

Commit 59d50ab

Browse files
committed
Change to pass "strip" options in an array of string slices and add option "-X32_64" for AIX.
1 parent 7d40450 commit 59d50ab

File tree

1 file changed

+12
-10
lines changed
  • compiler/rustc_codegen_ssa/src/back

1 file changed

+12
-10
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

+12-10
Original file line numberDiff line numberDiff line change
@@ -1107,14 +1107,14 @@ 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+
strip_symbols_with_external_utility(sess, stripcmd, out_filename, &["-S"])
11111111
}
11121112
// Per the manpage, `-x` is the maximum safe strip level for dynamic libraries. (#93988)
11131113
(Strip::Symbols, CrateType::Dylib | CrateType::Cdylib | CrateType::ProcMacro) => {
1114-
strip_symbols_with_external_utility(sess, stripcmd, out_filename, Some("-x"))
1114+
strip_symbols_with_external_utility(sess, stripcmd, out_filename, &["-x"])
11151115
}
11161116
(Strip::Symbols, _) => {
1117-
strip_symbols_with_external_utility(sess, stripcmd, out_filename, None)
1117+
strip_symbols_with_external_utility(sess, stripcmd, out_filename, &[""])
11181118
}
11191119
(Strip::None, _) => {}
11201120
}
@@ -1131,7 +1131,7 @@ fn link_natively(
11311131
match strip {
11321132
// Always preserve the symbol table (-x).
11331133
Strip::Debuginfo => {
1134-
strip_symbols_with_external_utility(sess, stripcmd, out_filename, Some("-x"))
1134+
strip_symbols_with_external_utility(sess, stripcmd, out_filename, &["-x"])
11351135
}
11361136
// Strip::Symbols is handled via the --strip-all linker option.
11371137
Strip::Symbols => {}
@@ -1148,11 +1148,15 @@ fn link_natively(
11481148
match strip {
11491149
Strip::Debuginfo => {
11501150
// 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"))
1151+
strip_symbols_with_external_utility(sess, stripcmd, out_filename, &[
1152+
"-X32_64", "-l",
1153+
])
11521154
}
11531155
Strip::Symbols => {
11541156
// 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"))
1157+
strip_symbols_with_external_utility(sess, stripcmd, out_filename, &[
1158+
"-X32_64", "-r",
1159+
])
11561160
}
11571161
Strip::None => {}
11581162
}
@@ -1165,12 +1169,10 @@ fn strip_symbols_with_external_utility(
11651169
sess: &Session,
11661170
util: &str,
11671171
out_filename: &Path,
1168-
option: Option<&str>,
1172+
options: &[&str],
11691173
) {
11701174
let mut cmd = Command::new(util);
1171-
if let Some(option) = option {
1172-
cmd.arg(option);
1173-
}
1175+
cmd.args(options);
11741176

11751177
let mut new_path = sess.get_tools_search_paths(false);
11761178
if let Some(path) = env::var_os("PATH") {

0 commit comments

Comments
 (0)