Update targets to use target_abi

All eabi targets have target_abi = "eabi".
All eabihf targets have target_abi = "eabihf".
armv6_unknown_freebsd and armv7_unknown_freebsd have target_abi = "eabihf".
All abi64 targets have target_abi = "abi64".
All ilp32 targets have target_abi = "ilp32".
All softfloat targets have target_abi = "softfloat".
All *-uwp-windows-* targets have target_abi = "uwp".
All spe targets have target_abi = "spe".
All macabi targets have target_abi = "macabi".
aarch64-apple-ios-sim has target_abi = "sim".
x86_64-fortanix-unknown-sgx has target_abi = "fortanix".
x86_64-unknown-linux-gnux32 has target_abi = "x32".

Add FIXME entries for targets for which existing values need to change
once cfg_target_abi becomes stable. (All of them are tier 3 targets.)

Add a test for target_abi in `--print cfg`.
This commit is contained in:
Josh Triplett 2021-07-06 22:00:53 -07:00
parent 84d6e8aed3
commit c3fbafddc0
53 changed files with 94 additions and 7 deletions

View File

@ -10,6 +10,11 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "E-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
options: TargetOptions { mcount: "\u{1}_mcount".to_string(), endian: Endian::Big, ..base },
options: TargetOptions {
abi: "ilp32".to_string(),
mcount: "\u{1}_mcount".to_string(),
endian: Endian::Big,
..base
},
}
}

View File

@ -7,6 +7,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
options: TargetOptions {
abi: "ilp32".to_string(),
max_atomic_width: Some(128),
mcount: "\u{1}_mcount".to_string(),
..super::linux_gnu_base::opts()

View File

@ -10,6 +10,7 @@ use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOp
pub fn target() -> Target {
let opts = TargetOptions {
abi: "softfloat".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
linker: Some("rust-lld".to_owned()),
features: "+strict-align,-neon,-fp-armv8".to_string(),

View File

@ -14,6 +14,15 @@ pub enum Arch {
Arm64_sim,
}
fn target_abi(arch: Arch) -> String {
match arch {
Armv7 | Armv7s | Arm64 | I386 | X86_64 => "",
X86_64_macabi | Arm64_macabi => "macabi",
Arm64_sim => "sim",
}
.to_string()
}
fn target_cpu(arch: Arch) -> String {
match arch {
Armv7 => "cortex-a8", // iOS7 is supported on iPhone 4 and higher
@ -39,6 +48,7 @@ fn link_env_remove(arch: Arch) -> Vec<String> {
pub fn opts(os: &str, arch: Arch) -> TargetOptions {
TargetOptions {
abi: target_abi(arch),
cpu: target_cpu(arch),
dynamic_linking: false,
executables: true,

View File

@ -7,6 +7,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabi".to_string(),
// https://developer.android.com/ndk/guides/abis.html#armeabi
features: "+strict-align,+v5te".to_string(),
max_atomic_width: Some(32),

View File

@ -7,6 +7,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabi".to_string(),
features: "+strict-align,+v6".to_string(),
max_atomic_width: Some(64),
mcount: "\u{1}__gnu_mcount_nc".to_string(),

View File

@ -7,6 +7,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabihf".to_string(),
features: "+strict-align,+v6,+vfp2,-d32".to_string(),
max_atomic_width: Some(64),
mcount: "\u{1}__gnu_mcount_nc".to_string(),

View File

@ -10,6 +10,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabi".to_string(),
// Most of these settings are copied from the arm_unknown_linux_gnueabi
// target.
features: "+strict-align,+v6".to_string(),

View File

@ -10,6 +10,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabihf".to_string(),
// Most of these settings are copied from the arm_unknown_linux_gnueabihf
// target.
features: "+strict-align,+v6,+vfp2,-d32".to_string(),

View File

@ -11,6 +11,7 @@ pub fn target() -> Target {
data_layout: "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabi".to_string(),
endian: Endian::Big,
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
executables: true,

View File

@ -11,6 +11,7 @@ pub fn target() -> Target {
data_layout: "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabihf".to_string(),
endian: Endian::Big,
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
executables: true,

View File

@ -7,6 +7,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabi".to_string(),
features: "+soft-float,+strict-align".to_string(),
// Atomic operations provided by compiler-builtins
max_atomic_width: Some(32),

View File

@ -7,6 +7,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabi".to_string(),
features: "+soft-float,+strict-align".to_string(),
// Atomic operations provided by compiler-builtins
max_atomic_width: Some(32),

View File

@ -11,6 +11,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabi".to_string(),
features: "+soft-float,+strict-align".to_string(),
// Atomic operations provided by compiler-builtins
max_atomic_width: Some(32),

View File

@ -7,6 +7,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabi".to_string(),
features: "+soft-float,+strict-align".to_string(),
// Atomic operations provided by compiler-builtins
max_atomic_width: Some(32),

View File

@ -7,6 +7,8 @@ pub fn target() -> Target {
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabihf".to_string(),
// FIXME: change env to "gnu" when cfg_target_abi becomes stable
env: "gnueabihf".to_string(),
features: "+v6,+vfp2,-d32".to_string(),
max_atomic_width: Some(64),

View File

@ -7,6 +7,8 @@ pub fn target() -> Target {
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabihf".to_string(),
// FIXME: remove env when cfg_target_abi becomes stable
env: "eabihf".to_string(),
features: "+v6,+vfp2,-d32".to_string(),
max_atomic_width: Some(64),

View File

@ -17,6 +17,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabi".to_string(),
features: "+v7,+thumb-mode,+thumb2,+vfp3,-d32,-neon".to_string(),
max_atomic_width: Some(64),
..base

View File

@ -7,6 +7,8 @@ pub fn target() -> Target {
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabihf".to_string(),
// FIXME: change env to "gnu" when cfg_target_abi becomes stable
env: "gnueabihf".to_string(),
features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(),
max_atomic_width: Some(64),

View File

@ -10,6 +10,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabi".to_string(),
features: "+v7,+thumb2,+soft-float,-neon".to_string(),
max_atomic_width: Some(64),
mcount: "\u{1}__gnu_mcount_nc".to_string(),

View File

@ -10,6 +10,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabihf".to_string(),
// Info about features at https://wiki.debian.org/ArmHardFloatPort
features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(),
max_atomic_width: Some(64),

View File

@ -16,6 +16,7 @@ pub fn target() -> Target {
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabi".to_string(),
features: "+v7,+thumb2,+soft-float,-neon".to_string(),
max_atomic_width: Some(64),
mcount: "\u{1}mcount".to_string(),

View File

@ -15,6 +15,7 @@ pub fn target() -> Target {
// Most of these settings are copied from the armv7_unknown_linux_gnueabihf
// target.
options: TargetOptions {
abi: "eabihf".to_string(),
features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(),
max_atomic_width: Some(64),
mcount: "\u{1}mcount".to_string(),

View File

@ -7,6 +7,8 @@ pub fn target() -> Target {
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabihf".to_string(),
// FIXME: remove env when cfg_target_abi becomes stable
env: "eabihf".to_string(),
features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(),
max_atomic_width: Some(64),

View File

@ -7,6 +7,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabihf".to_string(),
// Info about features at https://wiki.debian.org/ArmHardFloatPort
features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(),
max_atomic_width: Some(64),

View File

@ -18,6 +18,7 @@ use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOp
pub fn target() -> Target {
let opts = TargetOptions {
abi: "eabi".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
linker: Some("rust-lld".to_owned()),
features: "+v7,+thumb2,+soft-float,-neon,+strict-align".to_string(),

View File

@ -9,6 +9,7 @@ use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOp
pub fn target() -> Target {
let opts = TargetOptions {
abi: "eabihf".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
linker: Some("rust-lld".to_owned()),
features: "+v7,+vfp3,-d32,+thumb2,-neon,+strict-align".to_string(),

View File

@ -11,6 +11,7 @@ pub fn target() -> Target {
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabi".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
executables: true,
linker: Some("rust-lld".to_owned()),

View File

@ -11,6 +11,7 @@ pub fn target() -> Target {
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabihf".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
executables: true,
linker: Some("rust-lld".to_owned()),

View File

@ -8,6 +8,7 @@ pub fn target() -> Target {
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(),
arch: "mips64".to_string(),
options: TargetOptions {
abi: "abi64".to_string(),
endian: Endian::Big,
// NOTE(mips64r2) matches C toolchain
cpu: "mips64r2".to_string(),

View File

@ -12,6 +12,11 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(),
arch: "mips64".to_string(),
options: TargetOptions { endian: Endian::Big, mcount: "_mcount".to_string(), ..base },
options: TargetOptions {
abi: "abi64".to_string(),
endian: Endian::Big,
mcount: "_mcount".to_string(),
..base
},
}
}

View File

@ -7,6 +7,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(),
arch: "mips64".to_string(),
options: TargetOptions {
abi: "abi64".to_string(),
// NOTE(mips64r2) matches C toolchain
cpu: "mips64r2".to_string(),
features: "+mips64r2".to_string(),

View File

@ -11,6 +11,6 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(),
arch: "mips64".to_string(),
options: TargetOptions { mcount: "_mcount".to_string(), ..base },
options: TargetOptions { abi: "abi64".to_string(), mcount: "_mcount".to_string(), ..base },
}
}

View File

@ -8,6 +8,7 @@ pub fn target() -> Target {
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(),
arch: "mips64".to_string(),
options: TargetOptions {
abi: "abi64".to_string(),
endian: Endian::Big,
// NOTE(mips64r6) matches C toolchain
cpu: "mips64r6".to_string(),

View File

@ -7,6 +7,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(),
arch: "mips64".to_string(),
options: TargetOptions {
abi: "abi64".to_string(),
// NOTE(mips64r6) matches C toolchain
cpu: "mips64r6".to_string(),
features: "+mips64r6".to_string(),

View File

@ -11,6 +11,11 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "E-m:e-p:32:32-i64:64-n32".to_string(),
arch: "powerpc".to_string(),
options: TargetOptions { endian: Endian::Big, mcount: "_mcount".to_string(), ..base },
options: TargetOptions {
abi: "spe".to_string(),
endian: Endian::Big,
mcount: "_mcount".to_string(),
..base
},
}
}

View File

@ -13,6 +13,7 @@ pub fn target() -> Target {
data_layout: "E-m:e-p:32:32-i64:64-n32".to_string(),
arch: "powerpc".to_string(),
options: TargetOptions {
abi: "spe".to_string(),
endian: Endian::Big,
// feature msync would disable instruction 'fsync' which is not supported by fsl_p1p2
features: "+secure-plt,+msync".to_string(),

View File

@ -26,6 +26,7 @@ pub fn target() -> Target {
*/
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
options: TargetOptions {
abi: "eabi".to_string(),
linker_flavor: LinkerFlavor::Ld,
linker: Some("arm-none-eabi-ld".to_string()),

View File

@ -10,6 +10,7 @@ pub fn target() -> Target {
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabi".to_string(),
// The ARMv6-M architecture doesn't support unaligned loads/stores so we disable them
// with +strict-align.
features: "+strict-align".to_string(),

View File

@ -18,6 +18,10 @@ pub fn target() -> Target {
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
options: TargetOptions { max_atomic_width: Some(32), ..super::thumb_base::opts() },
options: TargetOptions {
abi: "eabi".to_string(),
max_atomic_width: Some(32),
..super::thumb_base::opts()
},
}
}

View File

@ -18,6 +18,7 @@ pub fn target() -> Target {
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabihf".to_string(),
// `+vfp4` is the lowest common denominator between the Cortex-M4 (vfp4-16) and the
// Cortex-M7 (vfp5)
// `-d32` both the Cortex-M4 and the Cortex-M7 only have 16 double-precision registers

View File

@ -9,6 +9,10 @@ pub fn target() -> Target {
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
options: TargetOptions { max_atomic_width: Some(32), ..super::thumb_base::opts() },
options: TargetOptions {
abi: "eabi".to_string(),
max_atomic_width: Some(32),
..super::thumb_base::opts()
},
}
}

View File

@ -17,6 +17,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabi".to_string(),
features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".to_string(),
max_atomic_width: Some(64),
..base

View File

@ -13,6 +13,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabihf".to_string(),
// Info about features at https://wiki.debian.org/ArmHardFloatPort
features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".to_string(),
max_atomic_width: Some(64),

View File

@ -19,6 +19,7 @@ pub fn target() -> Target {
// Most of these settings are copied from the thumbv7neon_unknown_linux_gnueabihf
// target.
options: TargetOptions {
abi: "eabihf".to_string(),
features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".to_string(),
max_atomic_width: Some(64),
mcount: "\u{1}mcount".to_string(),

View File

@ -10,6 +10,7 @@ pub fn target() -> Target {
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabi".to_string(),
// ARMv8-M baseline doesn't support unaligned loads/stores so we disable them
// with +strict-align.
features: "+strict-align".to_string(),

View File

@ -10,6 +10,10 @@ pub fn target() -> Target {
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
options: TargetOptions { max_atomic_width: Some(32), ..super::thumb_base::opts() },
options: TargetOptions {
abi: "eabi".to_string(),
max_atomic_width: Some(32),
..super::thumb_base::opts()
},
}
}

View File

@ -11,6 +11,7 @@ pub fn target() -> Target {
arch: "arm".to_string(),
options: TargetOptions {
abi: "eabihf".to_string(),
// If the Floating Point extension is implemented in the Cortex-M33
// processor, the Cortex-M33 Technical Reference Manual states that
// the FPU uses the FPv5 architecture, single-precision instructions

View File

@ -25,6 +25,7 @@ pub fn opts() -> TargetOptions {
late_link_args.insert(LinkerFlavor::Lld(LldFlavor::Ld), mingw_libs);
TargetOptions {
abi: "uwp".to_string(),
vendor: "uwp".to_string(),
executables: false,
limit_rdylib_exports: false,

View File

@ -3,6 +3,7 @@ use crate::spec::{LinkerFlavor, LldFlavor, TargetOptions};
pub fn opts() -> TargetOptions {
let mut opts = super::windows_msvc_base::opts();
opts.abi = "uwp".to_string();
opts.vendor = "uwp".to_string();
let pre_link_args_msvc = vec!["/APPCONTAINER".to_string(), "mincore.lib".to_string()];
opts.pre_link_args.entry(LinkerFlavor::Msvc).or_default().extend(pre_link_args_msvc.clone());

View File

@ -55,6 +55,7 @@ pub fn target() -> Target {
os: "unknown".into(),
env: "sgx".into(),
vendor: "fortanix".into(),
abi: "fortanix".into(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
executables: true,
linker: Some("rust-lld".to_owned()),

View File

@ -3,6 +3,7 @@ use crate::spec::{LinkerFlavor, StackProbeType, Target};
pub fn target() -> Target {
let mut base = super::linux_gnu_base::opts();
base.cpu = "x86-64".to_string();
base.abi = "x32".to_string();
base.max_atomic_width = Some(64);
base.pre_link_args.entry(LinkerFlavor::Gcc).or_default().push("-mx32".to_string());
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved

View File

@ -6,6 +6,8 @@ all: default
$(RUSTC) --target i686-pc-windows-msvc --print cfg | $(CGREP) msvc
$(RUSTC) --target i686-apple-darwin --print cfg | $(CGREP) macos
$(RUSTC) --target i686-unknown-linux-gnu --print cfg | $(CGREP) gnu
$(RUSTC) --target arm-unknown-linux-gnueabihf --print cfg | $(CGREP) target_abi=
$(RUSTC) --target arm-unknown-linux-gnueabihf --print cfg | $(CGREP) eabihf
ifdef IS_WINDOWS
default: