Skip to content

Commit 88ddf00

Browse files
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 9cccfc1 + 1ae1f8c commit 88ddf00

File tree

1 file changed

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

1 file changed

+9
-0
lines changed

Diff for: compiler/rustc_codegen_ssa/src/back/link.rs

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

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

0 commit comments

Comments
 (0)