mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
Change to pass "strip" options in an array of string slices and add option "-X32_64" for AIX.
This commit is contained in:
parent
7d40450b2d
commit
02f51ec2bd
@ -1107,14 +1107,14 @@ fn link_natively(
|
||||
let stripcmd = "rust-objcopy";
|
||||
match (strip, crate_type) {
|
||||
(Strip::Debuginfo, _) => {
|
||||
strip_symbols_with_external_utility(sess, stripcmd, out_filename, Some("-S"))
|
||||
strip_symbols_with_external_utility(sess, stripcmd, out_filename, &["-S"])
|
||||
}
|
||||
// Per the manpage, `-x` is the maximum safe strip level for dynamic libraries. (#93988)
|
||||
(Strip::Symbols, CrateType::Dylib | CrateType::Cdylib | CrateType::ProcMacro) => {
|
||||
strip_symbols_with_external_utility(sess, stripcmd, out_filename, Some("-x"))
|
||||
strip_symbols_with_external_utility(sess, stripcmd, out_filename, &["-x"])
|
||||
}
|
||||
(Strip::Symbols, _) => {
|
||||
strip_symbols_with_external_utility(sess, stripcmd, out_filename, None)
|
||||
strip_symbols_with_external_utility(sess, stripcmd, out_filename, &[])
|
||||
}
|
||||
(Strip::None, _) => {}
|
||||
}
|
||||
@ -1131,7 +1131,7 @@ fn link_natively(
|
||||
match strip {
|
||||
// Always preserve the symbol table (-x).
|
||||
Strip::Debuginfo => {
|
||||
strip_symbols_with_external_utility(sess, stripcmd, out_filename, Some("-x"))
|
||||
strip_symbols_with_external_utility(sess, stripcmd, out_filename, &["-x"])
|
||||
}
|
||||
// Strip::Symbols is handled via the --strip-all linker option.
|
||||
Strip::Symbols => {}
|
||||
@ -1148,11 +1148,15 @@ fn link_natively(
|
||||
match strip {
|
||||
Strip::Debuginfo => {
|
||||
// FIXME: AIX's strip utility only offers option to strip line number information.
|
||||
strip_symbols_with_external_utility(sess, stripcmd, out_filename, Some("-l"))
|
||||
strip_symbols_with_external_utility(sess, stripcmd, out_filename, &[
|
||||
"-X32_64", "-l",
|
||||
])
|
||||
}
|
||||
Strip::Symbols => {
|
||||
// Must be noted this option might remove symbol __aix_rust_metadata and thus removes .info section which contains metadata.
|
||||
strip_symbols_with_external_utility(sess, stripcmd, out_filename, Some("-r"))
|
||||
strip_symbols_with_external_utility(sess, stripcmd, out_filename, &[
|
||||
"-X32_64", "-r",
|
||||
])
|
||||
}
|
||||
Strip::None => {}
|
||||
}
|
||||
@ -1165,12 +1169,10 @@ fn strip_symbols_with_external_utility(
|
||||
sess: &Session,
|
||||
util: &str,
|
||||
out_filename: &Path,
|
||||
option: Option<&str>,
|
||||
options: &[&str],
|
||||
) {
|
||||
let mut cmd = Command::new(util);
|
||||
if let Some(option) = option {
|
||||
cmd.arg(option);
|
||||
}
|
||||
cmd.args(options);
|
||||
|
||||
let mut new_path = sess.get_tools_search_paths(false);
|
||||
if let Some(path) = env::var_os("PATH") {
|
||||
|
Loading…
Reference in New Issue
Block a user