Skip to content

Commit 1a6d2a3

Browse files
authored
Unrolled build for rust-lang#132657
Rollup merge of rust-lang#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.
2 parents 6503543 + 405017a commit 1a6d2a3

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

src/tools/compiletest/src/directive-list.rs

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
3535
"ignore-64bit",
3636
"ignore-aarch64",
3737
"ignore-aarch64-unknown-linux-gnu",
38+
"ignore-aix",
3839
"ignore-android",
3940
"ignore-apple",
4041
"ignore-arm",

src/tools/run-make-support/src/external_deps/rustc.rs

+12-11
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::command::Command;
55
use crate::env::env_var;
66
use crate::path_helpers::cwd;
77
use crate::util::set_host_rpath;
8-
use crate::{is_darwin, is_msvc, is_windows, uname};
8+
use crate::{is_aix, is_darwin, is_msvc, is_windows, uname};
99

1010
/// Construct a new `rustc` invocation. This will automatically set the library
1111
/// search path as `-L cwd()`. Use [`bare_rustc`] to avoid this.
@@ -346,7 +346,7 @@ impl Rustc {
346346
// endif
347347
// endif
348348
// ```
349-
let flag = if is_windows() {
349+
if is_windows() {
350350
// So this is a bit hacky: we can't use the DLL version of libstdc++ because
351351
// it pulls in the DLL version of libgcc, which means that we end up with 2
352352
// instances of the DW2 unwinding implementation. This is a problem on
@@ -362,18 +362,19 @@ impl Rustc {
362362
// So we end up with the following hack: we link use static:-bundle to only
363363
// link the parts of libstdc++ that we actually use, which doesn't include
364364
// the dependency on the pthreads DLL.
365-
if is_msvc() { None } else { Some("-lstatic:-bundle=stdc++") }
365+
if !is_msvc() {
366+
self.cmd.arg("-lstatic:-bundle=stdc++");
367+
};
366368
} else if is_darwin() {
367-
Some("-lc++")
369+
self.cmd.arg("-lc++");
370+
} else if is_aix() {
371+
self.cmd.arg("-lc++");
372+
self.cmd.arg("-lc++abi");
368373
} else {
369-
match &uname()[..] {
370-
"FreeBSD" | "SunOS" | "OpenBSD" => None,
371-
_ => Some("-lstdc++"),
372-
}
374+
if !matches!(&uname()[..], "FreeBSD" | "SunOS" | "OpenBSD") {
375+
self.cmd.arg("-lstdc++");
376+
};
373377
};
374-
if let Some(flag) = flag {
375-
self.cmd.arg(flag);
376-
}
377378
self
378379
}
379380
}

src/tools/run-make-support/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ pub use env::{env_var, env_var_os, set_current_dir};
7878
pub use run::{cmd, run, run_fail, run_with_args};
7979

8080
/// Helpers for checking target information.
81-
pub use targets::{is_darwin, is_msvc, is_windows, llvm_components_contain, target, uname, apple_os};
81+
pub use targets::{is_aix, is_darwin, is_msvc, is_windows, llvm_components_contain, target, uname, apple_os};
8282

8383
/// Helpers for building names of output artifacts that are potentially target-specific.
8484
pub use artifact_names::{

src/tools/run-make-support/src/targets.rs

+6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ pub fn is_darwin() -> bool {
2828
target().contains("darwin")
2929
}
3030

31+
/// Check if target uses AIX.
32+
#[must_use]
33+
pub fn is_aix() -> bool {
34+
target().contains("aix")
35+
}
36+
3137
/// Get the target OS on Apple operating systems.
3238
#[must_use]
3339
pub fn apple_os() -> &'static str {

0 commit comments

Comments
 (0)