about summary refs log tree commit diff
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-11-30 12:56:50 +0800
committerGitHub <noreply@github.com>2024-11-30 12:56:50 +0800
commit51928108680c2316bc2156dcd4e25a7461bcba87 (patch)
treea1670ec857a0a930251b25f60b6ed2143a8ac904
parentdd99f11ef8c294231b9710d49c4b99ffa18514f8 (diff)
parenta9cb2d67092a088944eb46d88fc925071f6c65de (diff)
downloadrust-51928108680c2316bc2156dcd4e25a7461bcba87.tar.gz
rust-51928108680c2316bc2156dcd4e25a7461bcba87.zip
Rollup merge of #132750 - daltenty:daltenty/libs, r=jieyouxu
[AIX] handle libunwind native_libs

AIX should follow a similar path here to other libunwind platforms, with regards to system vs in-tree libunwind and the native lib search directories.

Having the right native lib search directories here is also required to get the correct default library search paths, due to some quirks of the AIX linker.
-rw-r--r--compiler/rustc_metadata/src/native_libs.rs4
-rw-r--r--src/bootstrap/src/core/build_steps/compile.rs2
2 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_metadata/src/native_libs.rs b/compiler/rustc_metadata/src/native_libs.rs
index ace46891f83..8bd2281981b 100644
--- a/compiler/rustc_metadata/src/native_libs.rs
+++ b/compiler/rustc_metadata/src/native_libs.rs
@@ -54,9 +54,13 @@ pub fn walk_native_lib_search_dirs<R>(
     // The targets here should be in sync with `copy_third_party_objects` in bootstrap.
     // FIXME: implement `-Clink-self-contained=+/-unwind,+/-sanitizers`, move the shipped libunwind
     // and sanitizers to self-contained directory, and stop adding this search path.
+    // FIXME: On AIX this also has the side-effect of making the list of library search paths
+    // non-empty, which is needed or the linker may decide to record the LIBPATH env, if
+    // defined, as the search path instead of appending the default search paths.
     if sess.target.vendor == "fortanix"
         || sess.target.os == "linux"
         || sess.target.os == "fuchsia"
+        || sess.target.is_like_aix
         || sess.target.is_like_osx && !sess.opts.unstable_opts.sanitizer.is_empty()
     {
         f(&sess.target_tlib_path.dir, false)?;
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index cc6eb1ec4a9..0cacd6e4f37 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -330,7 +330,7 @@ fn copy_third_party_objects(
 
     if target == "x86_64-fortanix-unknown-sgx"
         || builder.config.llvm_libunwind(target) == LlvmLibunwind::InTree
-            && (target.contains("linux") || target.contains("fuchsia"))
+            && (target.contains("linux") || target.contains("fuchsia") || target.contains("aix"))
     {
         let libunwind_path =
             copy_llvm_libunwind(builder, target, &builder.sysroot_target_libdir(*compiler, target));