Rollup merge of #102293 - ecnelises:aix.initial, r=davidtwco
Add powerpc64-ibm-aix as Tier-3 target
This is part of the effort mentioned in https://github.com/rust-lang/compiler-team/issues/553.
A reference to these options are definitions from [clang](ad6fe32032/clang/lib/Basic/Targets/PPC.h (L414-L448)
) and [llvm](https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp).
AIX has a system `ld` but [its options and behaviors](https://www.ibm.com/docs/en/aix/7.3?topic=l-ld-command) are different from GNU ld. Thanks to ``@bzEq`` for contributing the linking args.
This commit is contained in:
commit
b162bb4270
5 changed files with 65 additions and 1 deletions
32
compiler/rustc_target/src/spec/aix_base.rs
Normal file
32
compiler/rustc_target/src/spec/aix_base.rs
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
use crate::abi::Endian;
|
||||||
|
use crate::spec::{crt_objects, cvs, Cc, CodeModel, LinkOutputKind, LinkerFlavor, TargetOptions};
|
||||||
|
|
||||||
|
pub fn opts() -> TargetOptions {
|
||||||
|
TargetOptions {
|
||||||
|
abi: "vec-extabi".into(),
|
||||||
|
code_model: Some(CodeModel::Small),
|
||||||
|
cpu: "pwr7".into(),
|
||||||
|
os: "aix".into(),
|
||||||
|
vendor: "ibm".into(),
|
||||||
|
dynamic_linking: true,
|
||||||
|
endian: Endian::Big,
|
||||||
|
executables: true,
|
||||||
|
archive_format: "aix_big".into(),
|
||||||
|
families: cvs!["unix"],
|
||||||
|
has_rpath: false,
|
||||||
|
has_thread_local: true,
|
||||||
|
crt_static_respected: true,
|
||||||
|
linker_flavor: LinkerFlavor::Unix(Cc::No),
|
||||||
|
linker: Some("ld".into()),
|
||||||
|
eh_frame_header: false,
|
||||||
|
is_like_aix: true,
|
||||||
|
default_dwarf_version: 3,
|
||||||
|
function_sections: true,
|
||||||
|
pre_link_objects: crt_objects::new(&[
|
||||||
|
(LinkOutputKind::DynamicNoPicExe, &["/usr/lib/crt0_64.o", "/usr/lib/crti_64.o"]),
|
||||||
|
(LinkOutputKind::DynamicPicExe, &["/usr/lib/crt0_64.o", "/usr/lib/crti_64.o"]),
|
||||||
|
]),
|
||||||
|
dll_suffix: ".a".into(),
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
}
|
|
@ -58,6 +58,7 @@ use rustc_macros::HashStable_Generic;
|
||||||
pub mod abi;
|
pub mod abi;
|
||||||
pub mod crt_objects;
|
pub mod crt_objects;
|
||||||
|
|
||||||
|
mod aix_base;
|
||||||
mod android_base;
|
mod android_base;
|
||||||
mod apple_base;
|
mod apple_base;
|
||||||
mod avr_gnu_base;
|
mod avr_gnu_base;
|
||||||
|
@ -1027,6 +1028,7 @@ supported_targets! {
|
||||||
("powerpc-unknown-linux-gnu", powerpc_unknown_linux_gnu),
|
("powerpc-unknown-linux-gnu", powerpc_unknown_linux_gnu),
|
||||||
("powerpc-unknown-linux-gnuspe", powerpc_unknown_linux_gnuspe),
|
("powerpc-unknown-linux-gnuspe", powerpc_unknown_linux_gnuspe),
|
||||||
("powerpc-unknown-linux-musl", powerpc_unknown_linux_musl),
|
("powerpc-unknown-linux-musl", powerpc_unknown_linux_musl),
|
||||||
|
("powerpc64-ibm-aix", powerpc64_ibm_aix),
|
||||||
("powerpc64-unknown-linux-gnu", powerpc64_unknown_linux_gnu),
|
("powerpc64-unknown-linux-gnu", powerpc64_unknown_linux_gnu),
|
||||||
("powerpc64-unknown-linux-musl", powerpc64_unknown_linux_musl),
|
("powerpc64-unknown-linux-musl", powerpc64_unknown_linux_musl),
|
||||||
("powerpc64le-unknown-linux-gnu", powerpc64le_unknown_linux_gnu),
|
("powerpc64le-unknown-linux-gnu", powerpc64le_unknown_linux_gnu),
|
||||||
|
@ -1454,6 +1456,9 @@ pub struct TargetOptions {
|
||||||
pub families: StaticCow<[StaticCow<str>]>,
|
pub families: StaticCow<[StaticCow<str>]>,
|
||||||
/// Whether the target toolchain's ABI supports returning small structs as an integer.
|
/// Whether the target toolchain's ABI supports returning small structs as an integer.
|
||||||
pub abi_return_struct_as_int: bool,
|
pub abi_return_struct_as_int: bool,
|
||||||
|
/// Whether the target toolchain is like AIX's. Linker options on AIX are special and it uses
|
||||||
|
/// XCOFF as binary format. Defaults to false.
|
||||||
|
pub is_like_aix: bool,
|
||||||
/// Whether the target toolchain is like macOS's. Only useful for compiling against iOS/macOS,
|
/// Whether the target toolchain is like macOS's. Only useful for compiling against iOS/macOS,
|
||||||
/// in particular running dsymutil and some other stuff like `-dead_strip`. Defaults to false.
|
/// in particular running dsymutil and some other stuff like `-dead_strip`. Defaults to false.
|
||||||
/// Also indiates whether to use Apple-specific ABI changes, such as extending function
|
/// Also indiates whether to use Apple-specific ABI changes, such as extending function
|
||||||
|
@ -1817,6 +1822,7 @@ impl Default for TargetOptions {
|
||||||
staticlib_suffix: ".a".into(),
|
staticlib_suffix: ".a".into(),
|
||||||
families: cvs![],
|
families: cvs![],
|
||||||
abi_return_struct_as_int: false,
|
abi_return_struct_as_int: false,
|
||||||
|
is_like_aix: false,
|
||||||
is_like_osx: false,
|
is_like_osx: false,
|
||||||
is_like_solaris: false,
|
is_like_solaris: false,
|
||||||
is_like_windows: false,
|
is_like_windows: false,
|
||||||
|
@ -2488,6 +2494,7 @@ impl Target {
|
||||||
key!(staticlib_suffix);
|
key!(staticlib_suffix);
|
||||||
key!(families, TargetFamilies);
|
key!(families, TargetFamilies);
|
||||||
key!(abi_return_struct_as_int, bool);
|
key!(abi_return_struct_as_int, bool);
|
||||||
|
key!(is_like_aix, bool);
|
||||||
key!(is_like_osx, bool);
|
key!(is_like_osx, bool);
|
||||||
key!(is_like_solaris, bool);
|
key!(is_like_solaris, bool);
|
||||||
key!(is_like_windows, bool);
|
key!(is_like_windows, bool);
|
||||||
|
@ -2741,6 +2748,7 @@ impl ToJson for Target {
|
||||||
target_option_val!(staticlib_suffix);
|
target_option_val!(staticlib_suffix);
|
||||||
target_option_val!(families, "target-family");
|
target_option_val!(families, "target-family");
|
||||||
target_option_val!(abi_return_struct_as_int);
|
target_option_val!(abi_return_struct_as_int);
|
||||||
|
target_option_val!(is_like_aix);
|
||||||
target_option_val!(is_like_osx);
|
target_option_val!(is_like_osx);
|
||||||
target_option_val!(is_like_solaris);
|
target_option_val!(is_like_solaris);
|
||||||
target_option_val!(is_like_windows);
|
target_option_val!(is_like_windows);
|
||||||
|
|
23
compiler/rustc_target/src/spec/powerpc64_ibm_aix.rs
Normal file
23
compiler/rustc_target/src/spec/powerpc64_ibm_aix.rs
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
use crate::spec::{Cc, LinkerFlavor, Target};
|
||||||
|
|
||||||
|
pub fn target() -> Target {
|
||||||
|
let mut base = super::aix_base::opts();
|
||||||
|
base.max_atomic_width = Some(64);
|
||||||
|
base.add_pre_link_args(
|
||||||
|
LinkerFlavor::Unix(Cc::No),
|
||||||
|
&[
|
||||||
|
"-b64".into(),
|
||||||
|
"-bpT:0x100000000".into(),
|
||||||
|
"-bpD:0x110000000".into(),
|
||||||
|
"-bcdtors:all:0:s".into(),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
Target {
|
||||||
|
llvm_target: "powerpc64-ibm-aix".into(),
|
||||||
|
pointer_width: 64,
|
||||||
|
data_layout: "E-m:a-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(),
|
||||||
|
arch: "powerpc64".into(),
|
||||||
|
options: base,
|
||||||
|
}
|
||||||
|
}
|
|
@ -283,6 +283,7 @@ target | std | host | notes
|
||||||
`powerpc64-wrs-vxworks` | ? | |
|
`powerpc64-wrs-vxworks` | ? | |
|
||||||
`powerpc64le-unknown-linux-musl` | ? | |
|
`powerpc64le-unknown-linux-musl` | ? | |
|
||||||
[`powerpc64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | OpenBSD/powerpc64
|
[`powerpc64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | OpenBSD/powerpc64
|
||||||
|
`powerpc64-ibm-aix` | ? | | 64-bit AIX (7.2 and newer)
|
||||||
`riscv32gc-unknown-linux-gnu` | | | RISC-V Linux (kernel 5.4, glibc 2.33)
|
`riscv32gc-unknown-linux-gnu` | | | RISC-V Linux (kernel 5.4, glibc 2.33)
|
||||||
`riscv32gc-unknown-linux-musl` | | | RISC-V Linux (kernel 5.4, musl + RISCV32 support patches)
|
`riscv32gc-unknown-linux-musl` | | | RISC-V Linux (kernel 5.4, musl + RISCV32 support patches)
|
||||||
`riscv32im-unknown-none-elf` | * | | Bare RISC-V (RV32IM ISA)
|
`riscv32im-unknown-none-elf` | * | | Bare RISC-V (RV32IM ISA)
|
||||||
|
|
|
@ -6,7 +6,7 @@ LL | #[cfg(target_os = "linuz")]
|
||||||
| |
|
| |
|
||||||
| help: did you mean: `"linux"`
|
| help: did you mean: `"linux"`
|
||||||
|
|
|
|
||||||
= 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
|
= 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
|
||||||
= note: `#[warn(unexpected_cfgs)]` on by default
|
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||||
|
|
||||||
warning: unexpected `cfg` condition value
|
warning: unexpected `cfg` condition value
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue