1
Fork 0

Rollup merge of #133967 - daltenty:daltenty/bnoipath, r=jieyouxu

[AIX] Pass -bnoipath when adding rust upstream dynamic crates

Unlike ELF linkers, AIX doesn't feature `DT_SONAME` to override
the dependency name when outputing a shared library, which is something
we rely on for dylib crates.

See for reference:
bc145cec45/compiler/rustc_codegen_ssa/src/back/linker.rs (L464))

Thus, `ld` on AIX will use the full path to shared libraries as the dependency if passed it
by default unless `noipath` is passed, so pass it here so we don't end up with full path dependencies
for dylib crates.
This commit is contained in:
León Orell Valerian Liehr 2024-12-10 13:51:08 +01:00 committed by GitHub
commit 7459a4fdf1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2745,6 +2745,15 @@ fn add_upstream_rust_crates(
.find(|(ty, _)| *ty == crate_type)
.expect("failed to find crate type in dependency format list");
if sess.target.is_like_aix {
// Unlike ELF linkers, AIX doesn't feature `DT_SONAME` to override
// the dependency name when outputing a shared library. Thus, `ld` will
// use the full path to shared libraries as the dependency if passed it
// by default unless `noipath` is passed.
// https://www.ibm.com/docs/en/aix/7.3?topic=l-ld-command.
cmd.link_or_cc_arg("-bnoipath");
}
for &cnum in &codegen_results.crate_info.used_crates {
// We may not pass all crates through to the linker. Some crates may appear statically in
// an existing dylib, meaning we'll pick up all the symbols from the dylib.