Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit a90513e

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 c673da0 + 1ae1f8c commit a90513e

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2749,6 +2749,15 @@ fn add_upstream_rust_crates(
27492749
.find(|(ty, _)| *ty == crate_type)
27502750
.expect("failed to find crate type in dependency format list");
27512751

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

0 commit comments

Comments
 (0)