Skip to content

Commit 48f17d7

Browse files
authored
Rollup merge of rust-lang#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: https://github.com/rust-lang/rust/blob/bc145cec4565a97a1b08df52d26ddf48ce3d7d0a/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.
2 parents 7219398 + 1ae1f8c commit 48f17d7

File tree

1 file changed

+9
-0
lines changed
  • compiler/rustc_codegen_ssa/src/back

1 file changed

+9
-0
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

+9
Original file line numberDiff line numberDiff line change
@@ -2745,6 +2745,15 @@ fn add_upstream_rust_crates(
27452745
.find(|(ty, _)| *ty == crate_type)
27462746
.expect("failed to find crate type in dependency format list");
27472747

2748+
if sess.target.is_like_aix {
2749+
// Unlike ELF linkers, AIX doesn't feature `DT_SONAME` to override
2750+
// the dependency name when outputing a shared library. Thus, `ld` will
2751+
// use the full path to shared libraries as the dependency if passed it
2752+
// by default unless `noipath` is passed.
2753+
// https://www.ibm.com/docs/en/aix/7.3?topic=l-ld-command.
2754+
cmd.link_or_cc_arg("-bnoipath");
2755+
}
2756+
27482757
for &cnum in &codegen_results.crate_info.used_crates {
27492758
// We may not pass all crates through to the linker. Some crates may appear statically in
27502759
// an existing dylib, meaning we'll pick up all the symbols from the dylib.

0 commit comments

Comments
 (0)