Skip to content

Commit aef3d93

Browse files
committed
Add powerpc64-ibm-aix as Tier-3 target
1 parent 251831e commit aef3d93

File tree

5 files changed

+65
-1
lines changed

5 files changed

+65
-1
lines changed
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
use crate::abi::Endian;
2+
use crate::spec::{crt_objects, cvs, Cc, CodeModel, LinkOutputKind, LinkerFlavor, TargetOptions};
3+
4+
pub fn opts() -> TargetOptions {
5+
TargetOptions {
6+
abi: "vec-extabi".into(),
7+
code_model: Some(CodeModel::Small),
8+
cpu: "pwr7".into(),
9+
os: "aix".into(),
10+
vendor: "ibm".into(),
11+
dynamic_linking: true,
12+
endian: Endian::Big,
13+
executables: true,
14+
archive_format: "aix_big".into(),
15+
families: cvs!["unix"],
16+
has_rpath: false,
17+
has_thread_local: true,
18+
crt_static_respected: true,
19+
linker_flavor: LinkerFlavor::Unix(Cc::No),
20+
linker: Some("ld".into()),
21+
eh_frame_header: false,
22+
is_like_aix: true,
23+
default_dwarf_version: 3,
24+
function_sections: true,
25+
pre_link_objects: crt_objects::new(&[
26+
(LinkOutputKind::DynamicNoPicExe, &["/usr/lib/crt0_64.o", "/usr/lib/crti_64.o"]),
27+
(LinkOutputKind::DynamicPicExe, &["/usr/lib/crt0_64.o", "/usr/lib/crti_64.o"]),
28+
]),
29+
dll_suffix: ".a".into(),
30+
..Default::default()
31+
}
32+
}

compiler/rustc_target/src/spec/mod.rs

+8
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ use rustc_macros::HashStable_Generic;
5757
pub mod abi;
5858
pub mod crt_objects;
5959

60+
mod aix_base;
6061
mod android_base;
6162
mod apple_base;
6263
mod avr_gnu_base;
@@ -1026,6 +1027,7 @@ supported_targets! {
10261027
("powerpc-unknown-linux-gnu", powerpc_unknown_linux_gnu),
10271028
("powerpc-unknown-linux-gnuspe", powerpc_unknown_linux_gnuspe),
10281029
("powerpc-unknown-linux-musl", powerpc_unknown_linux_musl),
1030+
("powerpc64-ibm-aix", powerpc64_ibm_aix),
10291031
("powerpc64-unknown-linux-gnu", powerpc64_unknown_linux_gnu),
10301032
("powerpc64-unknown-linux-musl", powerpc64_unknown_linux_musl),
10311033
("powerpc64le-unknown-linux-gnu", powerpc64le_unknown_linux_gnu),
@@ -1453,6 +1455,9 @@ pub struct TargetOptions {
14531455
pub families: StaticCow<[StaticCow<str>]>,
14541456
/// Whether the target toolchain's ABI supports returning small structs as an integer.
14551457
pub abi_return_struct_as_int: bool,
1458+
/// Whether the target toolchain is like AIX's. Linker options on AIX are special and it uses
1459+
/// XCOFF as binary format. Defaults to false.
1460+
pub is_like_aix: bool,
14561461
/// Whether the target toolchain is like macOS's. Only useful for compiling against iOS/macOS,
14571462
/// in particular running dsymutil and some other stuff like `-dead_strip`. Defaults to false.
14581463
/// Also indiates whether to use Apple-specific ABI changes, such as extending function
@@ -1808,6 +1813,7 @@ impl Default for TargetOptions {
18081813
staticlib_suffix: ".a".into(),
18091814
families: cvs![],
18101815
abi_return_struct_as_int: false,
1816+
is_like_aix: false,
18111817
is_like_osx: false,
18121818
is_like_solaris: false,
18131819
is_like_windows: false,
@@ -2465,6 +2471,7 @@ impl Target {
24652471
key!(staticlib_suffix);
24662472
key!(families, TargetFamilies);
24672473
key!(abi_return_struct_as_int, bool);
2474+
key!(is_like_aix, bool);
24682475
key!(is_like_osx, bool);
24692476
key!(is_like_solaris, bool);
24702477
key!(is_like_windows, bool);
@@ -2716,6 +2723,7 @@ impl ToJson for Target {
27162723
target_option_val!(staticlib_suffix);
27172724
target_option_val!(families, "target-family");
27182725
target_option_val!(abi_return_struct_as_int);
2726+
target_option_val!(is_like_aix);
27192727
target_option_val!(is_like_osx);
27202728
target_option_val!(is_like_solaris);
27212729
target_option_val!(is_like_windows);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
use crate::spec::{Cc, LinkerFlavor, Target};
2+
3+
pub fn target() -> Target {
4+
let mut base = super::aix_base::opts();
5+
base.max_atomic_width = Some(64);
6+
base.add_pre_link_args(
7+
LinkerFlavor::Unix(Cc::No),
8+
&[
9+
"-b64".into(),
10+
"-bpT:0x100000000".into(),
11+
"-bpD:0x110000000".into(),
12+
"-bcdtors:all:0:s".into(),
13+
],
14+
);
15+
16+
Target {
17+
llvm_target: "powerpc64-ibm-aix".into(),
18+
pointer_width: 64,
19+
data_layout: "E-m:a-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(),
20+
arch: "powerpc64".into(),
21+
options: base,
22+
}
23+
}

src/doc/rustc/src/platform-support.md

+1
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ target | std | host | notes
283283
`powerpc64-wrs-vxworks` | ? | |
284284
`powerpc64le-unknown-linux-musl` | ? | |
285285
[`powerpc64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | OpenBSD/powerpc64
286+
`powerpc64-ibm-aix` | ? | | 64-bit AIX (7.2 and newer)
286287
`riscv32gc-unknown-linux-gnu` | | | RISC-V Linux (kernel 5.4, glibc 2.33)
287288
`riscv32gc-unknown-linux-musl` | | | RISC-V Linux (kernel 5.4, musl + RISCV32 support patches)
288289
`riscv32im-unknown-none-elf` | * | | Bare RISC-V (RV32IM ISA)

src/test/ui/check-cfg/well-known-values.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | #[cfg(target_os = "linuz")]
66
| |
77
| help: did you mean: `"linux"`
88
|
9-
= note: expected values for `target_os` are: android, cuda, dragonfly, emscripten, espidf, freebsd, fuchsia, haiku, hermit, horizon, illumos, ios, l4re, linux, macos, netbsd, none, nto, openbsd, psp, redox, solaris, solid_asp3, tvos, uefi, unknown, vxworks, wasi, watchos, windows, xous
9+
= note: expected values for `target_os` are: aix, android, cuda, dragonfly, emscripten, espidf, freebsd, fuchsia, haiku, hermit, horizon, illumos, ios, l4re, linux, macos, netbsd, none, nto, openbsd, psp, redox, solaris, solid_asp3, tvos, uefi, unknown, vxworks, wasi, watchos, windows, xous
1010
= note: `#[warn(unexpected_cfgs)]` on by default
1111

1212
warning: unexpected `cfg` condition value

0 commit comments

Comments
 (0)