Rollup merge of #132657 - mustartt:aix-run-make-support, r=jieyouxu

AIX: add run-make support

On AIX, we are required explicit link against `c++` and `c++abi` to support running the run-make test suite.
This commit is contained in:
Matthias Krüger 2024-11-12 18:11:04 +01:00 committed by GitHub
commit 8f67b5b349
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 20 additions and 12 deletions

View File

@ -35,6 +35,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
"ignore-64bit", "ignore-64bit",
"ignore-aarch64", "ignore-aarch64",
"ignore-aarch64-unknown-linux-gnu", "ignore-aarch64-unknown-linux-gnu",
"ignore-aix",
"ignore-android", "ignore-android",
"ignore-apple", "ignore-apple",
"ignore-arm", "ignore-arm",

View File

@ -5,7 +5,7 @@ use crate::command::Command;
use crate::env::env_var; use crate::env::env_var;
use crate::path_helpers::cwd; use crate::path_helpers::cwd;
use crate::util::set_host_rpath; use crate::util::set_host_rpath;
use crate::{is_darwin, is_msvc, is_windows, uname}; use crate::{is_aix, is_darwin, is_msvc, is_windows, uname};
/// Construct a new `rustc` invocation. This will automatically set the library /// Construct a new `rustc` invocation. This will automatically set the library
/// search path as `-L cwd()`. Use [`bare_rustc`] to avoid this. /// search path as `-L cwd()`. Use [`bare_rustc`] to avoid this.
@ -346,7 +346,7 @@ impl Rustc {
// endif // endif
// endif // endif
// ``` // ```
let flag = if is_windows() { if is_windows() {
// So this is a bit hacky: we can't use the DLL version of libstdc++ because // So this is a bit hacky: we can't use the DLL version of libstdc++ because
// it pulls in the DLL version of libgcc, which means that we end up with 2 // it pulls in the DLL version of libgcc, which means that we end up with 2
// instances of the DW2 unwinding implementation. This is a problem on // instances of the DW2 unwinding implementation. This is a problem on
@ -362,18 +362,19 @@ impl Rustc {
// So we end up with the following hack: we link use static:-bundle to only // So we end up with the following hack: we link use static:-bundle to only
// link the parts of libstdc++ that we actually use, which doesn't include // link the parts of libstdc++ that we actually use, which doesn't include
// the dependency on the pthreads DLL. // the dependency on the pthreads DLL.
if is_msvc() { None } else { Some("-lstatic:-bundle=stdc++") } if !is_msvc() {
self.cmd.arg("-lstatic:-bundle=stdc++");
};
} else if is_darwin() { } else if is_darwin() {
Some("-lc++") self.cmd.arg("-lc++");
} else if is_aix() {
self.cmd.arg("-lc++");
self.cmd.arg("-lc++abi");
} else { } else {
match &uname()[..] { if !matches!(&uname()[..], "FreeBSD" | "SunOS" | "OpenBSD") {
"FreeBSD" | "SunOS" | "OpenBSD" => None, self.cmd.arg("-lstdc++");
_ => Some("-lstdc++"), };
}
}; };
if let Some(flag) = flag {
self.cmd.arg(flag);
}
self self
} }
} }

View File

@ -78,7 +78,7 @@ pub use env::{env_var, env_var_os, set_current_dir};
pub use run::{cmd, run, run_fail, run_with_args}; pub use run::{cmd, run, run_fail, run_with_args};
/// Helpers for checking target information. /// Helpers for checking target information.
pub use targets::{is_darwin, is_msvc, is_windows, llvm_components_contain, target, uname, apple_os}; pub use targets::{is_aix, is_darwin, is_msvc, is_windows, llvm_components_contain, target, uname, apple_os};
/// Helpers for building names of output artifacts that are potentially target-specific. /// Helpers for building names of output artifacts that are potentially target-specific.
pub use artifact_names::{ pub use artifact_names::{

View File

@ -28,6 +28,12 @@ pub fn is_darwin() -> bool {
target().contains("darwin") target().contains("darwin")
} }
/// Check if target uses AIX.
#[must_use]
pub fn is_aix() -> bool {
target().contains("aix")
}
/// Get the target OS on Apple operating systems. /// Get the target OS on Apple operating systems.
#[must_use] #[must_use]
pub fn apple_os() -> &'static str { pub fn apple_os() -> &'static str {