Skip to content

Commit

Permalink
Rollup merge of rust-lang#133967 - daltenty:daltenty/bnoipath, r=jiey…
Browse files Browse the repository at this point in the history
…ouxu

[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.
  • Loading branch information
workingjubilee authored Dec 8, 2024
2 parents dfdea90 + 1ae1f8c commit 96752e1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2753,6 +2753,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.
Expand Down

0 comments on commit 96752e1

Please sign in to comment.