about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2024-12-10 13:51:08 +0100
committerGitHub <noreply@github.com>2024-12-10 13:51:08 +0100
commit7459a4fdf1fa4a895206d3f5b13ba3e21ce05b49 (patch)
tree57369f5f4bc0347f0eb309158b18f73429e005bb /compiler/rustc_codegen_ssa
parent54165018afb1301ecc4581cfc8dd1d7ce1e7efcd (diff)
parent1ae1f8ce9cb327eaa22454bbf5a8e25123091ffb (diff)
downloadrust-7459a4fdf1fa4a895206d3f5b13ba3e21ce05b49.tar.gz
rust-7459a4fdf1fa4a895206d3f5b13ba3e21ce05b49.zip
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:
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.
Diffstat (limited to 'compiler/rustc_codegen_ssa')
-rw-r--r--compiler/rustc_codegen_ssa/src/back/link.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
index f8b3ba79c0d..35d18d0206d 100644
--- a/compiler/rustc_codegen_ssa/src/back/link.rs
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs
@@ -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.