Rollup merge of #117118 - bzEq:aix-linker, r=wesleywiser

[AIX] Remove AixLinker's debuginfo() implementation

AIX ld's `-s` option doesn't perfectly fit` debuginfo()`'s semantics and may unexpectedly remove metadata in shared libraries. Remove the implementation of `AixLinker` and suggest user to use `strip` utility instead.
This commit is contained in:
Matthias Krüger 2024-03-14 20:00:17 +01:00 committed by GitHub
commit 68ca795286
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 10 deletions

View File

@ -1081,6 +1081,21 @@ fn is_illegal_instruction(_status: &ExitStatus) -> bool {
}
}
if sess.target.is_like_aix {
let stripcmd = "/usr/bin/strip";
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 => {
// 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::None => {}
}
}
Ok(())
}

View File

@ -1640,16 +1640,7 @@ fn control_flow_guard(&mut self) {}
fn ehcont_guard(&mut self) {}
fn debuginfo(&mut self, strip: Strip, _: &[PathBuf]) {
match strip {
Strip::None => {}
// FIXME: -s strips the symbol table, line number information
// and relocation information.
Strip::Debuginfo | Strip::Symbols => {
self.cmd.arg("-s");
}
}
}
fn debuginfo(&mut self, _: Strip, _: &[PathBuf]) {}
fn no_crt_objects(&mut self) {}