diff options
| author | Simonas Kazlauskas <git@kazlauskas.me> | 2021-06-11 14:22:13 +0300 |
|---|---|---|
| committer | Simonas Kazlauskas <git@kazlauskas.me> | 2021-07-06 13:12:15 +0300 |
| commit | 8240e7aa101815e2009c7d03b33dd2566d843e73 (patch) | |
| tree | acd63da2f2a9ec826d6d5844cdc8a4d3892dbd6c /compiler/rustc_target/src | |
| parent | 96859dbaf6229f131fbd427a32aaa95d4f9cb132 (diff) | |
| download | rust-8240e7aa101815e2009c7d03b33dd2566d843e73.tar.gz rust-8240e7aa101815e2009c7d03b33dd2566d843e73.zip | |
Replace per-target ABI denylist with an allowlist
It makes very little sense to maintain denylists of ABIs when, as far as non-generic ABIs are concerned, targets usually only support a small subset of the available ABIs. This has historically been a cause of bugs such as us allowing use of the platform-specific ABIs on x86 targets – these in turn would cause LLVM errors or assertions to fire. Fixes #57182 Sponsored by: standard.ai
Diffstat (limited to 'compiler/rustc_target/src')
66 files changed, 202 insertions, 427 deletions
diff --git a/compiler/rustc_target/src/spec/aarch64_apple_ios.rs b/compiler/rustc_target/src/spec/aarch64_apple_ios.rs index 9fa8ef69d81..e5805d9e691 100644 --- a/compiler/rustc_target/src/spec/aarch64_apple_ios.rs +++ b/compiler/rustc_target/src/spec/aarch64_apple_ios.rs @@ -2,7 +2,6 @@ use super::apple_sdk_base::{opts, Arch}; use crate::spec::{FramePointer, Target, TargetOptions}; pub fn target() -> Target { - let base = opts("ios", Arch::Arm64); Target { llvm_target: "arm64-apple-ios".to_string(), pointer_width: 64, @@ -11,7 +10,6 @@ pub fn target() -> Target { options: TargetOptions { features: "+neon,+fp-armv8,+apple-a7".to_string(), max_atomic_width: Some(128), - unsupported_abis: super::arm_base::unsupported_abis(), forces_embed_bitcode: true, frame_pointer: FramePointer::NonLeaf, // Taken from a clang build on Xcode 11.4.1. @@ -25,7 +23,7 @@ pub fn target() -> Target { darwinpcs\0\ -Os\0" .to_string(), - ..base + ..opts("ios", Arch::Arm64) }, } } diff --git a/compiler/rustc_target/src/spec/aarch64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/aarch64_apple_ios_macabi.rs index a43eb99a1d7..d16328f00f9 100644 --- a/compiler/rustc_target/src/spec/aarch64_apple_ios_macabi.rs +++ b/compiler/rustc_target/src/spec/aarch64_apple_ios_macabi.rs @@ -2,7 +2,6 @@ use super::apple_sdk_base::{opts, Arch}; use crate::spec::{FramePointer, Target, TargetOptions}; pub fn target() -> Target { - let base = opts("ios", Arch::Arm64_macabi); Target { llvm_target: "arm64-apple-ios14.0-macabi".to_string(), pointer_width: 64, @@ -11,7 +10,6 @@ pub fn target() -> Target { options: TargetOptions { features: "+neon,+fp-armv8,+apple-a12".to_string(), max_atomic_width: Some(128), - unsupported_abis: super::arm_base::unsupported_abis(), forces_embed_bitcode: true, frame_pointer: FramePointer::NonLeaf, // Taken from a clang build on Xcode 11.4.1. @@ -23,7 +21,7 @@ pub fn target() -> Target { -disable-llvm-passes\0\ -Os\0" .to_string(), - ..base + ..opts("ios", Arch::Arm64_macabi) }, } } diff --git a/compiler/rustc_target/src/spec/aarch64_apple_ios_sim.rs b/compiler/rustc_target/src/spec/aarch64_apple_ios_sim.rs index 586e4043d79..07b3453218f 100644 --- a/compiler/rustc_target/src/spec/aarch64_apple_ios_sim.rs +++ b/compiler/rustc_target/src/spec/aarch64_apple_ios_sim.rs @@ -19,7 +19,6 @@ pub fn target() -> Target { options: TargetOptions { features: "+neon,+fp-armv8,+apple-a7".to_string(), max_atomic_width: Some(128), - unsupported_abis: super::arm_base::unsupported_abis(), forces_embed_bitcode: true, frame_pointer: FramePointer::NonLeaf, // Taken from a clang build on Xcode 11.4.1. diff --git a/compiler/rustc_target/src/spec/aarch64_apple_tvos.rs b/compiler/rustc_target/src/spec/aarch64_apple_tvos.rs index 934f3370369..b4bd72a082b 100644 --- a/compiler/rustc_target/src/spec/aarch64_apple_tvos.rs +++ b/compiler/rustc_target/src/spec/aarch64_apple_tvos.rs @@ -2,7 +2,6 @@ use super::apple_sdk_base::{opts, Arch}; use crate::spec::{FramePointer, Target, TargetOptions}; pub fn target() -> Target { - let base = opts("tvos", Arch::Arm64); Target { llvm_target: "arm64-apple-tvos".to_string(), pointer_width: 64, @@ -11,10 +10,9 @@ pub fn target() -> Target { options: TargetOptions { features: "+neon,+fp-armv8,+apple-a7".to_string(), max_atomic_width: Some(128), - unsupported_abis: super::arm_base::unsupported_abis(), forces_embed_bitcode: true, frame_pointer: FramePointer::NonLeaf, - ..base + ..opts("tvos", Arch::Arm64) }, } } diff --git a/compiler/rustc_target/src/spec/aarch64_be_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/aarch64_be_unknown_linux_gnu.rs index 192c4661c7c..71ee6deb07f 100644 --- a/compiler/rustc_target/src/spec/aarch64_be_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/aarch64_be_unknown_linux_gnu.rs @@ -2,19 +2,16 @@ use crate::abi::Endian; use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { - let mut base = super::linux_gnu_base::opts(); - base.max_atomic_width = Some(128); - Target { llvm_target: "aarch64_be-unknown-linux-gnu".to_string(), pointer_width: 64, data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(), arch: "aarch64".to_string(), options: TargetOptions { - unsupported_abis: super::arm_base::unsupported_abis(), + max_atomic_width: Some(128), mcount: "\u{1}_mcount".to_string(), endian: Endian::Big, - ..base + ..super::linux_gnu_base::opts() }, } } diff --git a/compiler/rustc_target/src/spec/aarch64_be_unknown_linux_gnu_ilp32.rs b/compiler/rustc_target/src/spec/aarch64_be_unknown_linux_gnu_ilp32.rs index 5b9e9c9519c..c1adc963425 100644 --- a/compiler/rustc_target/src/spec/aarch64_be_unknown_linux_gnu_ilp32.rs +++ b/compiler/rustc_target/src/spec/aarch64_be_unknown_linux_gnu_ilp32.rs @@ -10,11 +10,6 @@ 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 { - unsupported_abis: super::arm_base::unsupported_abis(), - mcount: "\u{1}_mcount".to_string(), - endian: Endian::Big, - ..base - }, + options: TargetOptions { mcount: "\u{1}_mcount".to_string(), endian: Endian::Big, ..base }, } } diff --git a/compiler/rustc_target/src/spec/aarch64_fuchsia.rs b/compiler/rustc_target/src/spec/aarch64_fuchsia.rs index c9cb21f1eb1..56d71df6bda 100644 --- a/compiler/rustc_target/src/spec/aarch64_fuchsia.rs +++ b/compiler/rustc_target/src/spec/aarch64_fuchsia.rs @@ -1,15 +1,15 @@ use crate::spec::{SanitizerSet, Target, TargetOptions}; pub fn target() -> Target { - let mut base = super::fuchsia_base::opts(); - base.max_atomic_width = Some(128); - base.supported_sanitizers = SanitizerSet::ADDRESS; - Target { llvm_target: "aarch64-fuchsia".to_string(), pointer_width: 64, data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(), arch: "aarch64".to_string(), - options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, + options: TargetOptions { + max_atomic_width: Some(128), + supported_sanitizers: SanitizerSet::ADDRESS, + ..super::fuchsia_base::opts() + }, } } diff --git a/compiler/rustc_target/src/spec/aarch64_linux_android.rs b/compiler/rustc_target/src/spec/aarch64_linux_android.rs index d00883ae71a..409cab72ec2 100644 --- a/compiler/rustc_target/src/spec/aarch64_linux_android.rs +++ b/compiler/rustc_target/src/spec/aarch64_linux_android.rs @@ -4,17 +4,18 @@ use crate::spec::{SanitizerSet, Target, TargetOptions}; // for target ABI requirements. pub fn target() -> Target { - let mut base = super::android_base::opts(); - base.max_atomic_width = Some(128); - // As documented in https://developer.android.com/ndk/guides/cpu-features.html - // the neon (ASIMD) and FP must exist on all android aarch64 targets. - base.features = "+neon,+fp-armv8".to_string(); - base.supported_sanitizers = SanitizerSet::HWADDRESS; Target { llvm_target: "aarch64-linux-android".to_string(), pointer_width: 64, data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(), arch: "aarch64".to_string(), - options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, + options: TargetOptions { + max_atomic_width: Some(128), + // As documented in https://developer.android.com/ndk/guides/cpu-features.html + // the neon (ASIMD) and FP must exist on all android aarch64 targets. + features: "+neon,+fp-armv8".to_string(), + supported_sanitizers: SanitizerSet::HWADDRESS, + ..super::android_base::opts() + }, } } diff --git a/compiler/rustc_target/src/spec/aarch64_unknown_freebsd.rs b/compiler/rustc_target/src/spec/aarch64_unknown_freebsd.rs index d48389d4a35..09ea7d33cfd 100644 --- a/compiler/rustc_target/src/spec/aarch64_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/aarch64_unknown_freebsd.rs @@ -1,14 +1,11 @@ use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { - let mut base = super::freebsd_base::opts(); - base.max_atomic_width = Some(128); - Target { llvm_target: "aarch64-unknown-freebsd".to_string(), pointer_width: 64, data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(), arch: "aarch64".to_string(), - options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, + options: TargetOptions { max_atomic_width: Some(128), ..super::freebsd_base::opts() }, } } diff --git a/compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu.rs index a07cd7db889..3e92ecbae05 100644 --- a/compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu.rs @@ -1,23 +1,20 @@ use crate::spec::{SanitizerSet, Target, TargetOptions}; pub fn target() -> Target { - let mut base = super::linux_gnu_base::opts(); - base.max_atomic_width = Some(128); - base.supported_sanitizers = SanitizerSet::ADDRESS - | SanitizerSet::LEAK - | SanitizerSet::MEMORY - | SanitizerSet::THREAD - | SanitizerSet::HWADDRESS; - Target { llvm_target: "aarch64-unknown-linux-gnu".to_string(), pointer_width: 64, data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(), arch: "aarch64".to_string(), options: TargetOptions { - unsupported_abis: super::arm_base::unsupported_abis(), mcount: "\u{1}_mcount".to_string(), - ..base + max_atomic_width: Some(128), + supported_sanitizers: SanitizerSet::ADDRESS + | SanitizerSet::LEAK + | SanitizerSet::MEMORY + | SanitizerSet::THREAD + | SanitizerSet::HWADDRESS, + ..super::linux_gnu_base::opts() }, } } diff --git a/compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu_ilp32.rs b/compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu_ilp32.rs index f2d7576280f..e2618447f28 100644 --- a/compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu_ilp32.rs +++ b/compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu_ilp32.rs @@ -1,18 +1,15 @@ use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { - let mut base = super::linux_gnu_base::opts(); - base.max_atomic_width = Some(128); - Target { llvm_target: "aarch64-unknown-linux-gnu_ilp32".to_string(), 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 { - unsupported_abis: super::arm_base::unsupported_abis(), + max_atomic_width: Some(128), mcount: "\u{1}_mcount".to_string(), - ..base + ..super::linux_gnu_base::opts() }, } } diff --git a/compiler/rustc_target/src/spec/aarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/aarch64_unknown_linux_musl.rs index 7bbfc8ec0f7..6a16b4ce419 100644 --- a/compiler/rustc_target/src/spec/aarch64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/aarch64_unknown_linux_musl.rs @@ -9,10 +9,6 @@ pub fn target() -> Target { pointer_width: 64, data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(), arch: "aarch64".to_string(), - options: TargetOptions { - unsupported_abis: super::arm_base::unsupported_abis(), - mcount: "\u{1}_mcount".to_string(), - ..base - }, + options: TargetOptions { mcount: "\u{1}_mcount".to_string(), ..base }, } } diff --git a/compiler/rustc_target/src/spec/aarch64_unknown_netbsd.rs b/compiler/rustc_target/src/spec/aarch64_unknown_netbsd.rs index 09efbdbb293..4042028e2dc 100644 --- a/compiler/rustc_target/src/spec/aarch64_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/aarch64_unknown_netbsd.rs @@ -1,15 +1,15 @@ use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { - let mut base = super::netbsd_base::opts(); - base.max_atomic_width = Some(128); - base.unsupported_abis = super::arm_base::unsupported_abis(); - Target { llvm_target: "aarch64-unknown-netbsd".to_string(), pointer_width: 64, data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(), arch: "aarch64".to_string(), - options: TargetOptions { mcount: "__mcount".to_string(), ..base }, + options: TargetOptions { + mcount: "__mcount".to_string(), + max_atomic_width: Some(128), + ..super::netbsd_base::opts() + }, } } diff --git a/compiler/rustc_target/src/spec/aarch64_unknown_none.rs b/compiler/rustc_target/src/spec/aarch64_unknown_none.rs index de92b167f00..9d365279010 100644 --- a/compiler/rustc_target/src/spec/aarch64_unknown_none.rs +++ b/compiler/rustc_target/src/spec/aarch64_unknown_none.rs @@ -18,7 +18,6 @@ pub fn target() -> Target { disable_redzone: true, max_atomic_width: Some(128), panic_strategy: PanicStrategy::Abort, - unsupported_abis: super::arm_base::unsupported_abis(), ..Default::default() }; Target { diff --git a/compiler/rustc_target/src/spec/aarch64_unknown_none_softfloat.rs b/compiler/rustc_target/src/spec/aarch64_unknown_none_softfloat.rs index 2566eeae14a..482db0c5342 100644 --- a/compiler/rustc_target/src/spec/aarch64_unknown_none_softfloat.rs +++ b/compiler/rustc_target/src/spec/aarch64_unknown_none_softfloat.rs @@ -18,7 +18,6 @@ pub fn target() -> Target { disable_redzone: true, max_atomic_width: Some(128), panic_strategy: PanicStrategy::Abort, - unsupported_abis: super::arm_base::unsupported_abis(), ..Default::default() }; Target { diff --git a/compiler/rustc_target/src/spec/aarch64_unknown_openbsd.rs b/compiler/rustc_target/src/spec/aarch64_unknown_openbsd.rs index 83ba1ecd1d3..193f9814210 100644 --- a/compiler/rustc_target/src/spec/aarch64_unknown_openbsd.rs +++ b/compiler/rustc_target/src/spec/aarch64_unknown_openbsd.rs @@ -1,15 +1,11 @@ -use crate::spec::Target; +use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { - let mut base = super::openbsd_base::opts(); - base.max_atomic_width = Some(128); - base.unsupported_abis = super::arm_base::unsupported_abis(); - Target { llvm_target: "aarch64-unknown-openbsd".to_string(), pointer_width: 64, data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(), arch: "aarch64".to_string(), - options: base, + options: TargetOptions { max_atomic_width: Some(128), ..super::openbsd_base::opts() }, } } diff --git a/compiler/rustc_target/src/spec/aarch64_wrs_vxworks.rs b/compiler/rustc_target/src/spec/aarch64_wrs_vxworks.rs index beb8ce30cc9..66140060f8e 100644 --- a/compiler/rustc_target/src/spec/aarch64_wrs_vxworks.rs +++ b/compiler/rustc_target/src/spec/aarch64_wrs_vxworks.rs @@ -1,14 +1,11 @@ use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { - let mut base = super::vxworks_base::opts(); - base.max_atomic_width = Some(128); - Target { llvm_target: "aarch64-unknown-linux-gnu".to_string(), pointer_width: 64, data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(), arch: "aarch64".to_string(), - options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, + options: TargetOptions { max_atomic_width: Some(128), ..super::vxworks_base::opts() }, } } diff --git a/compiler/rustc_target/src/spec/abi.rs b/compiler/rustc_target/src/spec/abi.rs index a026a623f78..ee36090c549 100644 --- a/compiler/rustc_target/src/spec/abi.rs +++ b/compiler/rustc_target/src/spec/abi.rs @@ -8,16 +8,11 @@ mod tests; #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Debug)] #[derive(HashStable_Generic, Encodable, Decodable)] pub enum Abi { - // Multiplatform / generic ABIs - // - // These ABIs come first because every time we add a new ABI, we - // have to re-bless all the hashing tests. These are used in many - // places, so giving them stable values reduces test churn. The - // specific values are meaningless. + // Some of the ABIs come first because every time we add a new ABI, we have to re-bless all the + // hashing tests. These are used in many places, so giving them stable values reduces test + // churn. The specific values are meaningless. Rust, C { unwind: bool }, - - // Single platform ABIs Cdecl, Stdcall { unwind: bool }, Fastcall, @@ -35,8 +30,6 @@ pub enum Abi { AvrNonBlockingInterrupt, CCmseNonSecureCall, Wasm, - - // Multiplatform / generic ABIs System { unwind: bool }, RustIntrinsic, RustCall, @@ -50,48 +43,38 @@ pub struct AbiData { /// Name of this ABI as we like it called. name: &'static str, - - /// A generic ABI is supported on all platforms. - generic: bool, } #[allow(non_upper_case_globals)] const AbiDatas: &[AbiData] = &[ - // Cross-platform ABIs - AbiData { abi: Abi::Rust, name: "Rust", generic: true }, - AbiData { abi: Abi::C { unwind: false }, name: "C", generic: true }, - AbiData { abi: Abi::C { unwind: true }, name: "C-unwind", generic: true }, - // Platform-specific ABIs - AbiData { abi: Abi::Cdecl, name: "cdecl", generic: false }, - AbiData { abi: Abi::Stdcall { unwind: false }, name: "stdcall", generic: false }, - AbiData { abi: Abi::Stdcall { unwind: true }, name: "stdcall-unwind", generic: false }, - AbiData { abi: Abi::Fastcall, name: "fastcall", generic: false }, - AbiData { abi: Abi::Vectorcall, name: "vectorcall", generic: false }, - AbiData { abi: Abi::Thiscall { unwind: false }, name: "thiscall", generic: false }, - AbiData { abi: Abi::Thiscall { unwind: true }, name: "thiscall-unwind", generic: false }, - AbiData { abi: Abi::Aapcs, name: "aapcs", generic: false }, - AbiData { abi: Abi::Win64, name: "win64", generic: false }, - AbiData { abi: Abi::SysV64, name: "sysv64", generic: false }, - AbiData { abi: Abi::PtxKernel, name: "ptx-kernel", generic: false }, - AbiData { abi: Abi::Msp430Interrupt, name: "msp430-interrupt", generic: false }, - AbiData { abi: Abi::X86Interrupt, name: "x86-interrupt", generic: false }, - AbiData { abi: Abi::AmdGpuKernel, name: "amdgpu-kernel", generic: false }, - AbiData { abi: Abi::EfiApi, name: "efiapi", generic: false }, - AbiData { abi: Abi::AvrInterrupt, name: "avr-interrupt", generic: false }, - AbiData { - abi: Abi::AvrNonBlockingInterrupt, - name: "avr-non-blocking-interrupt", - generic: false, - }, - AbiData { abi: Abi::CCmseNonSecureCall, name: "C-cmse-nonsecure-call", generic: false }, - AbiData { abi: Abi::Wasm, name: "wasm", generic: false }, - // Cross-platform ABIs - AbiData { abi: Abi::System { unwind: false }, name: "system", generic: true }, - AbiData { abi: Abi::System { unwind: true }, name: "system-unwind", generic: true }, - AbiData { abi: Abi::RustIntrinsic, name: "rust-intrinsic", generic: true }, - AbiData { abi: Abi::RustCall, name: "rust-call", generic: true }, - AbiData { abi: Abi::PlatformIntrinsic, name: "platform-intrinsic", generic: true }, - AbiData { abi: Abi::Unadjusted, name: "unadjusted", generic: true }, + AbiData { abi: Abi::Rust, name: "Rust" }, + AbiData { abi: Abi::C { unwind: false }, name: "C" }, + AbiData { abi: Abi::C { unwind: true }, name: "C-unwind" }, + AbiData { abi: Abi::Cdecl, name: "cdecl" }, + AbiData { abi: Abi::Stdcall { unwind: false }, name: "stdcall" }, + AbiData { abi: Abi::Stdcall { unwind: true }, name: "stdcall-unwind" }, + AbiData { abi: Abi::Fastcall, name: "fastcall" }, + AbiData { abi: Abi::Vectorcall, name: "vectorcall" }, + AbiData { abi: Abi::Thiscall { unwind: false }, name: "thiscall" }, + AbiData { abi: Abi::Thiscall { unwind: true }, name: "thiscall-unwind" }, + AbiData { abi: Abi::Aapcs, name: "aapcs" }, + AbiData { abi: Abi::Win64, name: "win64" }, + AbiData { abi: Abi::SysV64, name: "sysv64" }, + AbiData { abi: Abi::PtxKernel, name: "ptx-kernel" }, + AbiData { abi: Abi::Msp430Interrupt, name: "msp430-interrupt" }, + AbiData { abi: Abi::X86Interrupt, name: "x86-interrupt" }, + AbiData { abi: Abi::AmdGpuKernel, name: "amdgpu-kernel" }, + AbiData { abi: Abi::EfiApi, name: "efiapi" }, + AbiData { abi: Abi::AvrInterrupt, name: "avr-interrupt" }, + AbiData { abi: Abi::AvrNonBlockingInterrupt, name: "avr-non-blocking-interrupt" }, + AbiData { abi: Abi::CCmseNonSecureCall, name: "C-cmse-nonsecure-call" }, + AbiData { abi: Abi::Wasm, name: "wasm" }, + AbiData { abi: Abi::System { unwind: false }, name: "system" }, + AbiData { abi: Abi::System { unwind: true }, name: "system-unwind" }, + AbiData { abi: Abi::RustIntrinsic, name: "rust-intrinsic" }, + AbiData { abi: Abi::RustCall, name: "rust-call" }, + AbiData { abi: Abi::PlatformIntrinsic, name: "platform-intrinsic" }, + AbiData { abi: Abi::Unadjusted, name: "unadjusted" }, ]; /// Returns the ABI with the given name (if any). @@ -163,10 +146,6 @@ impl Abi { pub fn name(self) -> &'static str { self.data().name } - - pub fn generic(self) -> bool { - self.data().generic - } } impl fmt::Display for Abi { diff --git a/compiler/rustc_target/src/spec/arm_base.rs b/compiler/rustc_target/src/spec/arm_base.rs deleted file mode 100644 index 01f573313c9..00000000000 --- a/compiler/rustc_target/src/spec/arm_base.rs +++ /dev/null @@ -1,15 +0,0 @@ -use crate::spec::abi::Abi; - -// All the calling conventions trigger an assertion(Unsupported calling convention) in llvm on arm -pub fn unsupported_abis() -> Vec<Abi> { - vec![ - Abi::Stdcall { unwind: false }, - Abi::Stdcall { unwind: true }, - Abi::Fastcall, - Abi::Vectorcall, - Abi::Thiscall { unwind: false }, - Abi::Thiscall { unwind: true }, - Abi::Win64, - Abi::SysV64, - ] -} diff --git a/compiler/rustc_target/src/spec/arm_linux_androideabi.rs b/compiler/rustc_target/src/spec/arm_linux_androideabi.rs index 43537569e7d..f2430830afc 100644 --- a/compiler/rustc_target/src/spec/arm_linux_androideabi.rs +++ b/compiler/rustc_target/src/spec/arm_linux_androideabi.rs @@ -1,16 +1,16 @@ use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { - let mut base = super::android_base::opts(); - // https://developer.android.com/ndk/guides/abis.html#armeabi - base.features = "+strict-align,+v5te".to_string(); - base.max_atomic_width = Some(32); - Target { llvm_target: "arm-linux-androideabi".to_string(), pointer_width: 32, 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 { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, + options: TargetOptions { + // https://developer.android.com/ndk/guides/abis.html#armeabi + features: "+strict-align,+v5te".to_string(), + max_atomic_width: Some(32), + ..super::android_base::opts() + }, } } diff --git a/compiler/rustc_target/src/spec/arm_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/arm_unknown_linux_gnueabi.rs index c41cf6e521a..225db0032a8 100644 --- a/compiler/rustc_target/src/spec/arm_unknown_linux_gnueabi.rs +++ b/compiler/rustc_target/src/spec/arm_unknown_linux_gnueabi.rs @@ -1,19 +1,16 @@ use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { - let mut base = super::linux_gnu_base::opts(); - base.max_atomic_width = Some(64); Target { llvm_target: "arm-unknown-linux-gnueabi".to_string(), pointer_width: 32, 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 { features: "+strict-align,+v6".to_string(), - unsupported_abis: super::arm_base::unsupported_abis(), + max_atomic_width: Some(64), mcount: "\u{1}__gnu_mcount_nc".to_string(), - ..base + ..super::linux_gnu_base::opts() }, } } diff --git a/compiler/rustc_target/src/spec/arm_unknown_linux_gnueabihf.rs b/compiler/rustc_target/src/spec/arm_unknown_linux_gnueabihf.rs index f2143966c1d..33703195ee7 100644 --- a/compiler/rustc_target/src/spec/arm_unknown_linux_gnueabihf.rs +++ b/compiler/rustc_target/src/spec/arm_unknown_linux_gnueabihf.rs @@ -1,19 +1,16 @@ use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { - let mut base = super::linux_gnu_base::opts(); - base.max_atomic_width = Some(64); Target { llvm_target: "arm-unknown-linux-gnueabihf".to_string(), pointer_width: 32, 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 { features: "+strict-align,+v6,+vfp2,-d32".to_string(), - unsupported_abis: super::arm_base::unsupported_abis(), + max_atomic_width: Some(64), mcount: "\u{1}__gnu_mcount_nc".to_string(), - ..base + ..super::linux_gnu_base::opts() }, } } diff --git a/compiler/rustc_target/src/spec/arm_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/arm_unknown_linux_musleabi.rs index 53ff1001c20..850844993f9 100644 --- a/compiler/rustc_target/src/spec/arm_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/arm_unknown_linux_musleabi.rs @@ -1,12 +1,6 @@ use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { - let mut base = super::linux_musl_base::opts(); - - // Most of these settings are copied from the arm_unknown_linux_gnueabi - // target. - base.features = "+strict-align,+v6".to_string(); - base.max_atomic_width = Some(64); Target { // It's important we use "gnueabi" and not "musleabi" here. LLVM uses it // to determine the calling convention and float ABI, and it doesn't @@ -16,9 +10,12 @@ 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 { - unsupported_abis: super::arm_base::unsupported_abis(), + // Most of these settings are copied from the arm_unknown_linux_gnueabi + // target. + features: "+strict-align,+v6".to_string(), + max_atomic_width: Some(64), mcount: "\u{1}mcount".to_string(), - ..base + ..super::linux_musl_base::opts() }, } } diff --git a/compiler/rustc_target/src/spec/arm_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/arm_unknown_linux_musleabihf.rs index 6d8a5f9f88b..ff69c462e8e 100644 --- a/compiler/rustc_target/src/spec/arm_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/arm_unknown_linux_musleabihf.rs @@ -1,12 +1,6 @@ use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { - let mut base = super::linux_musl_base::opts(); - - // Most of these settings are copied from the arm_unknown_linux_gnueabihf - // target. - base.features = "+strict-align,+v6,+vfp2,-d32".to_string(); - base.max_atomic_width = Some(64); Target { // It's important we use "gnueabihf" and not "musleabihf" here. LLVM // uses it to determine the calling convention and float ABI, and it @@ -16,9 +10,12 @@ 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 { - unsupported_abis: super::arm_base::unsupported_abis(), + // Most of these settings are copied from the arm_unknown_linux_gnueabihf + // target. + features: "+strict-align,+v6,+vfp2,-d32".to_string(), + max_atomic_width: Some(64), mcount: "\u{1}mcount".to_string(), - ..base + ..super::linux_musl_base::opts() }, } } diff --git a/compiler/rustc_target/src/spec/armebv7r_none_eabi.rs b/compiler/rustc_target/src/spec/armebv7r_none_eabi.rs index 255740cb9c0..547f48c5d3b 100644 --- a/compiler/rustc_target/src/spec/armebv7r_none_eabi.rs +++ b/compiler/rustc_target/src/spec/armebv7r_none_eabi.rs @@ -10,7 +10,6 @@ pub fn target() -> Target { pointer_width: 32, 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 { endian: Endian::Big, linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), @@ -19,7 +18,6 @@ pub fn target() -> Target { relocation_model: RelocModel::Static, panic_strategy: PanicStrategy::Abort, max_atomic_width: Some(32), - unsupported_abis: super::arm_base::unsupported_abis(), emit_debug_gdb_scripts: false, ..Default::default() }, diff --git a/compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs b/compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs index eb82e4d17b0..f4f61e87ab9 100644 --- a/compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs @@ -10,7 +10,6 @@ pub fn target() -> Target { pointer_width: 32, 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 { endian: Endian::Big, linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), @@ -20,7 +19,6 @@ pub fn target() -> Target { panic_strategy: PanicStrategy::Abort, features: "+vfp3,-d32,-fp16".to_string(), max_atomic_width: Some(32), - unsupported_abis: super::arm_base::unsupported_abis(), emit_debug_gdb_scripts: false, ..Default::default() }, diff --git a/compiler/rustc_target/src/spec/armv4t_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/armv4t_unknown_linux_gnueabi.rs index e1ba72bf83b..8a289fee781 100644 --- a/compiler/rustc_target/src/spec/armv4t_unknown_linux_gnueabi.rs +++ b/compiler/rustc_target/src/spec/armv4t_unknown_linux_gnueabi.rs @@ -1,21 +1,18 @@ use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { - let base = super::linux_gnu_base::opts(); Target { llvm_target: "armv4t-unknown-linux-gnueabi".to_string(), pointer_width: 32, 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 { features: "+soft-float,+strict-align".to_string(), // Atomic operations provided by compiler-builtins max_atomic_width: Some(32), - unsupported_abis: super::arm_base::unsupported_abis(), mcount: "\u{1}__gnu_mcount_nc".to_string(), has_thumb_interworking: true, - ..base + ..super::linux_gnu_base::opts() }, } } diff --git a/compiler/rustc_target/src/spec/armv5te_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/armv5te_unknown_linux_gnueabi.rs index 3ac8d53564d..177ab453b04 100644 --- a/compiler/rustc_target/src/spec/armv5te_unknown_linux_gnueabi.rs +++ b/compiler/rustc_target/src/spec/armv5te_unknown_linux_gnueabi.rs @@ -1,21 +1,18 @@ use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { - let base = super::linux_gnu_base::opts(); Target { llvm_target: "armv5te-unknown-linux-gnueabi".to_string(), pointer_width: 32, 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 { features: "+soft-float,+strict-align".to_string(), // Atomic operations provided by compiler-builtins max_atomic_width: Some(32), - unsupported_abis: super::arm_base::unsupported_abis(), mcount: "\u{1}__gnu_mcount_nc".to_string(), has_thumb_interworking: true, - ..base + ..super::linux_gnu_base::opts() }, } } diff --git a/compiler/rustc_target/src/spec/armv5te_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/armv5te_unknown_linux_musleabi.rs index 40d405c30a2..1f084443bd9 100644 --- a/compiler/rustc_target/src/spec/armv5te_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/armv5te_unknown_linux_musleabi.rs @@ -1,8 +1,8 @@ use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { - let base = super::linux_musl_base::opts(); Target { + // FIXME: this comment below does not seem applicable? // It's important we use "gnueabihf" and not "musleabihf" here. LLVM // uses it to determine the calling convention and float ABI, and LLVM // doesn't support the "musleabihf" value. @@ -10,15 +10,13 @@ pub fn target() -> Target { pointer_width: 32, 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 { features: "+soft-float,+strict-align".to_string(), // Atomic operations provided by compiler-builtins max_atomic_width: Some(32), - unsupported_abis: super::arm_base::unsupported_abis(), mcount: "\u{1}mcount".to_string(), has_thumb_interworking: true, - ..base + ..super::linux_musl_base::opts() }, } } diff --git a/compiler/rustc_target/src/spec/armv5te_unknown_linux_uclibceabi.rs b/compiler/rustc_target/src/spec/armv5te_unknown_linux_uclibceabi.rs index 3eb0f4db833..4e5b714bded 100644 --- a/compiler/rustc_target/src/spec/armv5te_unknown_linux_uclibceabi.rs +++ b/compiler/rustc_target/src/spec/armv5te_unknown_linux_uclibceabi.rs @@ -10,10 +10,8 @@ pub fn target() -> Target { features: "+soft-float,+strict-align".to_string(), // Atomic operations provided by compiler-builtins max_atomic_width: Some(32), - unsupported_abis: super::arm_base::unsupported_abis(), mcount: "\u{1}__gnu_mcount_nc".to_string(), has_thumb_interworking: true, - ..super::linux_uclibc_base::opts() }, } diff --git a/compiler/rustc_target/src/spec/armv6_unknown_freebsd.rs b/compiler/rustc_target/src/spec/armv6_unknown_freebsd.rs index a149bd983b7..08fc51e8a8b 100644 --- a/compiler/rustc_target/src/spec/armv6_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/armv6_unknown_freebsd.rs @@ -1,20 +1,17 @@ use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { - let base = super::freebsd_base::opts(); Target { llvm_target: "armv6-unknown-freebsd-gnueabihf".to_string(), pointer_width: 32, 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 { env: "gnueabihf".to_string(), features: "+v6,+vfp2,-d32".to_string(), max_atomic_width: Some(64), - unsupported_abis: super::arm_base::unsupported_abis(), mcount: "\u{1}__gnu_mcount_nc".to_string(), - ..base + ..super::freebsd_base::opts() }, } } diff --git a/compiler/rustc_target/src/spec/armv6_unknown_netbsd_eabihf.rs b/compiler/rustc_target/src/spec/armv6_unknown_netbsd_eabihf.rs index 6c81a458b9b..b109aa1e1ab 100644 --- a/compiler/rustc_target/src/spec/armv6_unknown_netbsd_eabihf.rs +++ b/compiler/rustc_target/src/spec/armv6_unknown_netbsd_eabihf.rs @@ -1,20 +1,17 @@ use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { - let mut base = super::netbsd_base::opts(); - base.max_atomic_width = Some(64); Target { llvm_target: "armv6-unknown-netbsdelf-eabihf".to_string(), pointer_width: 32, 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 { env: "eabihf".to_string(), features: "+v6,+vfp2,-d32".to_string(), - unsupported_abis: super::arm_base::unsupported_abis(), + max_atomic_width: Some(64), mcount: "__mcount".to_string(), - ..base + ..super::netbsd_base::opts() }, } } diff --git a/compiler/rustc_target/src/spec/armv7_apple_ios.rs b/compiler/rustc_target/src/spec/armv7_apple_ios.rs index 051a394657c..2f228688f43 100644 --- a/compiler/rustc_target/src/spec/armv7_apple_ios.rs +++ b/compiler/rustc_target/src/spec/armv7_apple_ios.rs @@ -2,7 +2,6 @@ use super::apple_sdk_base::{opts, Arch}; use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { - let base = opts("ios", Arch::Armv7); Target { llvm_target: "armv7-apple-ios".to_string(), pointer_width: 32, @@ -11,8 +10,7 @@ pub fn target() -> Target { options: TargetOptions { features: "+v7,+vfp3,+neon".to_string(), max_atomic_width: Some(64), - unsupported_abis: super::arm_base::unsupported_abis(), - ..base + ..opts("ios", Arch::Armv7) }, } } diff --git a/compiler/rustc_target/src/spec/armv7_linux_androideabi.rs b/compiler/rustc_target/src/spec/armv7_linux_androideabi.rs index 02a1191463e..821080ec07d 100644 --- a/compiler/rustc_target/src/spec/armv7_linux_androideabi.rs +++ b/compiler/rustc_target/src/spec/armv7_linux_androideabi.rs @@ -10,15 +10,16 @@ use crate::spec::{LinkerFlavor, Target, TargetOptions}; pub fn target() -> Target { let mut base = super::android_base::opts(); - base.features = "+v7,+thumb-mode,+thumb2,+vfp3,-d32,-neon".to_string(); - base.max_atomic_width = Some(64); base.pre_link_args.entry(LinkerFlavor::Gcc).or_default().push("-march=armv7-a".to_string()); - Target { llvm_target: "armv7-none-linux-android".to_string(), pointer_width: 32, 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 { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, + options: TargetOptions { + features: "+v7,+thumb-mode,+thumb2,+vfp3,-d32,-neon".to_string(), + max_atomic_width: Some(64), + ..base + }, } } diff --git a/compiler/rustc_target/src/spec/armv7_unknown_freebsd.rs b/compiler/rustc_target/src/spec/armv7_unknown_freebsd.rs index 6f24c6818fc..190d3bb691a 100644 --- a/compiler/rustc_target/src/spec/armv7_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/armv7_unknown_freebsd.rs @@ -1,20 +1,17 @@ use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { - let base = super::freebsd_base::opts(); Target { llvm_target: "armv7-unknown-freebsd-gnueabihf".to_string(), pointer_width: 32, 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 { env: "gnueabihf".to_string(), features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(), max_atomic_width: Some(64), - unsupported_abis: super::arm_base::unsupported_abis(), mcount: "\u{1}__gnu_mcount_nc".to_string(), - ..base + ..super::freebsd_base::opts() }, } } diff --git a/compiler/rustc_target/src/spec/armv7_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/armv7_unknown_linux_gnueabi.rs index f6fe88de37c..088a8cf7534 100644 --- a/compiler/rustc_target/src/spec/armv7_unknown_linux_gnueabi.rs +++ b/compiler/rustc_target/src/spec/armv7_unknown_linux_gnueabi.rs @@ -4,19 +4,16 @@ use crate::spec::{Target, TargetOptions}; // hardfloat. pub fn target() -> Target { - let base = super::linux_gnu_base::opts(); Target { llvm_target: "armv7-unknown-linux-gnueabi".to_string(), pointer_width: 32, 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 { features: "+v7,+thumb2,+soft-float,-neon".to_string(), max_atomic_width: Some(64), - unsupported_abis: super::arm_base::unsupported_abis(), mcount: "\u{1}__gnu_mcount_nc".to_string(), - ..base + ..super::linux_gnu_base::opts() }, } } diff --git a/compiler/rustc_target/src/spec/armv7_unknown_linux_gnueabihf.rs b/compiler/rustc_target/src/spec/armv7_unknown_linux_gnueabihf.rs index 5f0f47dd397..521053ec2d3 100644 --- a/compiler/rustc_target/src/spec/armv7_unknown_linux_gnueabihf.rs +++ b/compiler/rustc_target/src/spec/armv7_unknown_linux_gnueabihf.rs @@ -4,20 +4,17 @@ use crate::spec::{Target, TargetOptions}; // thumb-mode. See the thumbv7neon variant for enabling both. pub fn target() -> Target { - let base = super::linux_gnu_base::opts(); Target { llvm_target: "armv7-unknown-linux-gnueabihf".to_string(), pointer_width: 32, 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 { // Info about features at https://wiki.debian.org/ArmHardFloatPort features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(), max_atomic_width: Some(64), - unsupported_abis: super::arm_base::unsupported_abis(), mcount: "\u{1}__gnu_mcount_nc".to_string(), - ..base + ..super::linux_gnu_base::opts() }, } } diff --git a/compiler/rustc_target/src/spec/armv7_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/armv7_unknown_linux_musleabi.rs index c888fc2d4a3..0ee2c3e45e0 100644 --- a/compiler/rustc_target/src/spec/armv7_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/armv7_unknown_linux_musleabi.rs @@ -4,7 +4,6 @@ use crate::spec::{Target, TargetOptions}; // hardfloat. pub fn target() -> Target { - let base = super::linux_musl_base::opts(); // Most of these settings are copied from the armv7_unknown_linux_gnueabi // target. Target { @@ -19,9 +18,8 @@ pub fn target() -> Target { options: TargetOptions { features: "+v7,+thumb2,+soft-float,-neon".to_string(), max_atomic_width: Some(64), - unsupported_abis: super::arm_base::unsupported_abis(), mcount: "\u{1}mcount".to_string(), - ..base + ..super::linux_musl_base::opts() }, } } diff --git a/compiler/rustc_target/src/spec/armv7_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/armv7_unknown_linux_musleabihf.rs index 2432ea519a8..a6ce382c7a6 100644 --- a/compiler/rustc_target/src/spec/armv7_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/armv7_unknown_linux_musleabihf.rs @@ -3,7 +3,6 @@ use crate::spec::{Target, TargetOptions}; // This target is for musl Linux on ARMv7 without thumb-mode or NEON. pub fn target() -> Target { - let base = super::linux_musl_base::opts(); Target { // It's important we use "gnueabihf" and not "musleabihf" here. LLVM // uses it to determine the calling convention and float ABI, and LLVM @@ -18,9 +17,8 @@ pub fn target() -> Target { options: TargetOptions { features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(), max_atomic_width: Some(64), - unsupported_abis: super::arm_base::unsupported_abis(), mcount: "\u{1}mcount".to_string(), - ..base + ..super::linux_musl_base::opts() }, } } diff --git a/compiler/rustc_target/src/spec/armv7_unknown_netbsd_eabihf.rs b/compiler/rustc_target/src/spec/armv7_unknown_netbsd_eabihf.rs index 4fae3a8d0bf..e509dcaddaa 100644 --- a/compiler/rustc_target/src/spec/armv7_unknown_netbsd_eabihf.rs +++ b/compiler/rustc_target/src/spec/armv7_unknown_netbsd_eabihf.rs @@ -1,20 +1,17 @@ use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { - let base = super::netbsd_base::opts(); Target { llvm_target: "armv7-unknown-netbsdelf-eabihf".to_string(), pointer_width: 32, 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 { env: "eabihf".to_string(), features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(), max_atomic_width: Some(64), - unsupported_abis: super::arm_base::unsupported_abis(), mcount: "__mcount".to_string(), - ..base + ..super::netbsd_base::opts() }, } } diff --git a/compiler/rustc_target/src/spec/armv7_wrs_vxworks_eabihf.rs b/compiler/rustc_target/src/spec/armv7_wrs_vxworks_eabihf.rs index 9fe7098a85f..0aabf2fe486 100644 --- a/compiler/rustc_target/src/spec/armv7_wrs_vxworks_eabihf.rs +++ b/compiler/rustc_target/src/spec/armv7_wrs_vxworks_eabihf.rs @@ -1,7 +1,6 @@ use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { - let base = super::vxworks_base::opts(); Target { llvm_target: "armv7-unknown-linux-gnueabihf".to_string(), pointer_width: 32, @@ -11,8 +10,7 @@ pub fn target() -> Target { // Info about features at https://wiki.debian.org/ArmHardFloatPort features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(), max_atomic_width: Some(64), - unsupported_abis: super::arm_base::unsupported_abis(), - ..base + ..super::vxworks_base::opts() }, } } diff --git a/compiler/rustc_target/src/spec/armv7a_none_eabi.rs b/compiler/rustc_target/src/spec/armv7a_none_eabi.rs index 74deab01916..bd703ee3e45 100644 --- a/compiler/rustc_target/src/spec/armv7a_none_eabi.rs +++ b/compiler/rustc_target/src/spec/armv7a_none_eabi.rs @@ -26,7 +26,6 @@ pub fn target() -> Target { disable_redzone: true, max_atomic_width: Some(64), panic_strategy: PanicStrategy::Abort, - unsupported_abis: super::arm_base::unsupported_abis(), emit_debug_gdb_scripts: false, ..Default::default() }; diff --git a/compiler/rustc_target/src/spec/armv7a_none_eabihf.rs b/compiler/rustc_target/src/spec/armv7a_none_eabihf.rs index c5c720f5fbd..ad86ae1cedc 100644 --- a/compiler/rustc_target/src/spec/armv7a_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/armv7a_none_eabihf.rs @@ -17,7 +17,6 @@ pub fn target() -> Target { disable_redzone: true, max_atomic_width: Some(64), panic_strategy: PanicStrategy::Abort, - unsupported_abis: super::arm_base::unsupported_abis(), emit_debug_gdb_scripts: false, ..Default::default() }; diff --git a/compiler/rustc_target/src/spec/armv7r_none_eabi.rs b/compiler/rustc_target/src/spec/armv7r_none_eabi.rs index 3f49bd87869..c07d6adc37e 100644 --- a/compiler/rustc_target/src/spec/armv7r_none_eabi.rs +++ b/compiler/rustc_target/src/spec/armv7r_none_eabi.rs @@ -17,7 +17,6 @@ pub fn target() -> Target { relocation_model: RelocModel::Static, panic_strategy: PanicStrategy::Abort, max_atomic_width: Some(32), - unsupported_abis: super::arm_base::unsupported_abis(), emit_debug_gdb_scripts: false, ..Default::default() }, diff --git a/compiler/rustc_target/src/spec/armv7r_none_eabihf.rs b/compiler/rustc_target/src/spec/armv7r_none_eabihf.rs index 9b2e8a8058f..fbf2f8e9b72 100644 --- a/compiler/rustc_target/src/spec/armv7r_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/armv7r_none_eabihf.rs @@ -18,7 +18,6 @@ pub fn target() -> Target { panic_strategy: PanicStrategy::Abort, features: "+vfp3,-d32,-fp16".to_string(), max_atomic_width: Some(32), - unsupported_abis: super::arm_base::unsupported_abis(), emit_debug_gdb_scripts: false, ..Default::default() }, diff --git a/compiler/rustc_target/src/spec/armv7s_apple_ios.rs b/compiler/rustc_target/src/spec/armv7s_apple_ios.rs index be74136a2d6..2a48e7b6214 100644 --- a/compiler/rustc_target/src/spec/armv7s_apple_ios.rs +++ b/compiler/rustc_target/src/spec/armv7s_apple_ios.rs @@ -2,7 +2,6 @@ use super::apple_sdk_base::{opts, Arch}; use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { - let base = opts("ios", Arch::Armv7s); Target { llvm_target: "armv7s-apple-ios".to_string(), pointer_width: 32, @@ -11,8 +10,7 @@ pub fn target() -> Target { options: TargetOptions { features: "+v7,+vfp4,+neon".to_string(), max_atomic_width: Some(64), - unsupported_abis: super::arm_base::unsupported_abis(), - ..base + ..opts("ios", Arch::Armv7s) }, } } diff --git a/compiler/rustc_target/src/spec/bpf_base.rs b/compiler/rustc_target/src/spec/bpf_base.rs index 764cc735d75..4fa6e12f5ba 100644 --- a/compiler/rustc_target/src/spec/bpf_base.rs +++ b/compiler/rustc_target/src/spec/bpf_base.rs @@ -1,5 +1,5 @@ +use crate::abi::Endian; use crate::spec::{LinkerFlavor, MergeFunctions, PanicStrategy, TargetOptions}; -use crate::{abi::Endian, spec::abi::Abi}; pub fn opts(endian: Endian) -> TargetOptions { TargetOptions { @@ -21,22 +21,6 @@ pub fn opts(endian: Endian) -> TargetOptions { requires_lto: false, singlethread: true, max_atomic_width: Some(64), - unsupported_abis: vec![ - Abi::Cdecl, - Abi::Stdcall { unwind: false }, - Abi::Stdcall { unwind: true }, - Abi::Fastcall, - Abi::Vectorcall, - Abi::Thiscall { unwind: false }, - Abi::Thiscall { unwind: true }, - Abi::Aapcs, - Abi::Win64, - Abi::SysV64, - Abi::PtxKernel, - Abi::Msp430Interrupt, - Abi::X86Interrupt, - Abi::AmdGpuKernel, - ], ..Default::default() } } diff --git a/compiler/rustc_target/src/spec/mipsel_unknown_none.rs b/compiler/rustc_target/src/spec/mipsel_unknown_none.rs index 110c8dd80ea..5955baa31db 100644 --- a/compiler/rustc_target/src/spec/mipsel_unknown_none.rs +++ b/compiler/rustc_target/src/spec/mipsel_unknown_none.rs @@ -2,7 +2,6 @@ //! //! Can be used for MIPS M4K core (e.g. on PIC32MX devices) -use crate::spec::abi::Abi; use crate::spec::{LinkerFlavor, LldFlavor, RelocModel}; use crate::spec::{PanicStrategy, Target, TargetOptions}; @@ -22,16 +21,6 @@ pub fn target() -> Target { linker: Some("rust-lld".to_owned()), panic_strategy: PanicStrategy::Abort, relocation_model: RelocModel::Static, - unsupported_abis: vec![ - Abi::Stdcall { unwind: false }, - Abi::Stdcall { unwind: true }, - Abi::Fastcall, - Abi::Vectorcall, - Abi::Thiscall { unwind: false }, - Abi::Thiscall { unwind: true }, - Abi::Win64, - Abi::SysV64, - ], emit_debug_gdb_scripts: false, ..Default::default() }, diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index cfdae9623f3..0a5f8c17c63 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -55,7 +55,6 @@ pub mod crt_objects; mod android_base; mod apple_base; mod apple_sdk_base; -mod arm_base; mod avr_gnu_base; mod bpf_base; mod dragonfly_base; @@ -75,7 +74,6 @@ mod msvc_base; mod netbsd_base; mod openbsd_base; mod redox_base; -mod riscv_base; mod solaris_base; mod thumb_base; mod uefi_msvc_base; @@ -1226,11 +1224,6 @@ pub struct TargetOptions { /// Panic strategy: "unwind" or "abort" pub panic_strategy: PanicStrategy, - /// A list of ABIs unsupported by the current target. Note that generic ABIs - /// are considered to be supported on all platforms and cannot be marked - /// unsupported. - pub unsupported_abis: Vec<Abi>, - /// Whether or not linking dylibs to a static CRT is allowed. pub crt_static_allows_dylibs: bool, /// Whether or not the CRT is statically linked by default. @@ -1412,7 +1405,6 @@ impl Default for TargetOptions { max_atomic_width: None, atomic_cas: true, panic_strategy: PanicStrategy::Unwind, - unsupported_abis: vec![], crt_static_allows_dylibs: false, crt_static_default: false, crt_static_respected: false, @@ -1465,40 +1457,88 @@ impl Target { /// Given a function ABI, turn it into the correct ABI for this target. pub fn adjust_abi(&self, abi: Abi) -> Abi { match abi { - Abi::System { unwind } => { - if self.is_like_windows && self.arch == "x86" { - Abi::Stdcall { unwind } - } else { - Abi::C { unwind } - } - } - // These ABI kinds are ignored on non-x86 Windows targets. - // See https://docs.microsoft.com/en-us/cpp/cpp/argument-passing-and-naming-conventions - // and the individual pages for __stdcall et al. - Abi::Stdcall { unwind } | Abi::Thiscall { unwind } => { - if self.is_like_windows && self.arch != "x86" { Abi::C { unwind } } else { abi } - } - Abi::Fastcall | Abi::Vectorcall => { - if self.is_like_windows && self.arch != "x86" { - Abi::C { unwind: false } - } else { - abi - } - } - Abi::EfiApi => { - if self.arch == "x86_64" { - Abi::Win64 - } else { - Abi::C { unwind: false } - } + Abi::C { .. } => self.default_adjusted_cabi.unwrap_or(abi), + Abi::System { unwind } if self.is_like_windows && self.arch == "x86" => { + Abi::Stdcall { unwind } } + Abi::System { unwind } => Abi::C { unwind }, + Abi::EfiApi if self.arch == "x86_64" => Abi::Win64, + Abi::EfiApi => Abi::C { unwind: false }, - Abi::C { unwind } => self.default_adjusted_cabi.unwrap_or(Abi::C { unwind }), + // See commentary in `is_abi_supported`. + Abi::Stdcall { .. } | Abi::Thiscall { .. } if self.arch == "x86" => abi, + Abi::Stdcall { unwind } | Abi::Thiscall { unwind } => Abi::C { unwind }, + Abi::Fastcall if self.arch == "x86" => abi, + Abi::Vectorcall if ["x86", "x86_64"].contains(&&self.arch[..]) => abi, + Abi::Fastcall | Abi::Vectorcall => Abi::C { unwind: false }, abi => abi, } } + /// Returns a None if the UNSUPPORTED_CALLING_CONVENTIONS lint should be emitted + pub fn is_abi_supported(&self, abi: Abi) -> Option<bool> { + use Abi::*; + Some(match abi { + Rust + | C { .. } + | System { .. } + | RustIntrinsic + | RustCall + | PlatformIntrinsic + | Unadjusted + | Cdecl + | EfiApi => true, + X86Interrupt => ["x86", "x86_64"].contains(&&self.arch[..]), + Aapcs | CCmseNonSecureCall => ["arm", "aarch64"].contains(&&self.arch[..]), + Win64 | SysV64 => self.arch == "x86_64", + PtxKernel => self.arch == "nvptx64", + Msp430Interrupt => self.arch == "msp430", + AmdGpuKernel => self.arch == "amdgcn", + AvrInterrupt | AvrNonBlockingInterrupt => self.arch == "avr", + Wasm => ["wasm32", "wasm64"].contains(&&self.arch[..]), + // On windows these fall-back to platform native calling convention (C) when the + // architecture is not supported. + // + // This is I believe a historical accident that has occurred as part of Microsoft + // striving to allow most of the code to "just" compile when support for 64-bit x86 + // was added and then later again, when support for ARM architectures was added. + // + // This is well documented across MSDN. Support for this in Rust has been added in + // #54576. This makes much more sense in context of Microsoft's C++ than it does in + // Rust, but there isn't much leeway remaining here to change it back at the time this + // comment has been written. + // + // Following are the relevant excerpts from the MSDN documentation. + // + // > The __vectorcall calling convention is only supported in native code on x86 and + // x64 processors that include Streaming SIMD Extensions 2 (SSE2) and above. + // > ... + // > On ARM machines, __vectorcall is accepted and ignored by the compiler. + // + // -- https://docs.microsoft.com/en-us/cpp/cpp/vectorcall?view=msvc-160 + // + // > On ARM and x64 processors, __stdcall is accepted and ignored by the compiler; + // + // -- https://docs.microsoft.com/en-us/cpp/cpp/stdcall?view=msvc-160 + // + // > In most cases, keywords or compiler switches that specify an unsupported + // > convention on a particular platform are ignored, and the platform default + // > convention is used. + // + // -- https://docs.microsoft.com/en-us/cpp/cpp/argument-passing-and-naming-conventions + Stdcall { .. } | Fastcall | Thiscall { .. } | Vectorcall if self.is_like_windows => { + true + } + // Outside of Windows we want to only support these calling conventions for the + // architectures for which these calling conventions are actually well defined. + Stdcall { .. } | Fastcall | Thiscall { .. } if self.arch == "x86" => true, + Vectorcall if ["x86", "x86_64"].contains(&&self.arch[..]) => true, + // Return a `None` for other cases so that we know to emit a future compat lint. + Stdcall { .. } | Fastcall | Thiscall { .. } | Vectorcall => return None, + }) + } + /// Minimum integer size in bits that this target can perform atomic /// operations on. pub fn min_atomic_width(&self) -> u64 { @@ -1511,10 +1551,6 @@ impl Target { self.max_atomic_width.unwrap_or_else(|| self.pointer_width.into()) } - pub fn is_abi_supported(&self, abi: Abi) -> bool { - abi.generic() || !self.unsupported_abis.contains(&abi) - } - /// Loads a target descriptor from a JSON object. pub fn from_json(mut obj: Json) -> Result<(Target, TargetWarnings), String> { // While ugly, this code must remain this way to retain @@ -1974,36 +2010,6 @@ impl Target { key!(supported_sanitizers, SanitizerSet)?; key!(default_adjusted_cabi, Option<Abi>)?; - // NB: The old name is deprecated, but support for it is retained for - // compatibility. - for name in ["abi-blacklist", "unsupported-abis"].iter() { - if let Some(j) = obj.remove_key(name) { - if let Some(array) = Json::as_array(&j) { - for name in array.iter().filter_map(|abi| abi.as_string()) { - match lookup_abi(name) { - Some(abi) => { - if abi.generic() { - return Err(format!( - "The ABI \"{}\" is considered to be supported on all \ - targets and cannot be marked unsupported", - abi - )); - } - - base.unsupported_abis.push(abi) - } - None => { - return Err(format!( - "Unknown ABI \"{}\" in target specification", - name - )); - } - } - } - } - } - } - // Each field should have been read using `Json::remove_key` so any keys remaining are unused. let remaining_keys = obj.as_object().ok_or("Expected JSON object for target")?.keys(); Ok(( @@ -2241,17 +2247,6 @@ impl ToJson for Target { d.insert("default-adjusted-cabi".to_string(), Abi::name(abi).to_json()); } - if default.unsupported_abis != self.unsupported_abis { - d.insert( - "unsupported-abis".to_string(), - self.unsupported_abis - .iter() - .map(|&name| Abi::name(name).to_json()) - .collect::<Vec<_>>() - .to_json(), - ); - } - Json::Object(d) } } diff --git a/compiler/rustc_target/src/spec/nvptx64_nvidia_cuda.rs b/compiler/rustc_target/src/spec/nvptx64_nvidia_cuda.rs index 97960a75b09..083262cf351 100644 --- a/compiler/rustc_target/src/spec/nvptx64_nvidia_cuda.rs +++ b/compiler/rustc_target/src/spec/nvptx64_nvidia_cuda.rs @@ -1,4 +1,3 @@ -use crate::spec::abi::Abi; use crate::spec::{LinkerFlavor, MergeFunctions, PanicStrategy, Target, TargetOptions}; pub fn target() -> Target { @@ -45,25 +44,6 @@ pub fn target() -> Target { // produce kernel functions that call other kernel functions. // This behavior is not supported by PTX ISA. merge_functions: MergeFunctions::Disabled, - - // FIXME: enable compilation tests for the target and - // create the tests for this. - unsupported_abis: vec![ - Abi::Cdecl, - Abi::Stdcall { unwind: false }, - Abi::Stdcall { unwind: true }, - Abi::Fastcall, - Abi::Vectorcall, - Abi::Thiscall { unwind: false }, - Abi::Thiscall { unwind: true }, - Abi::Aapcs, - Abi::Win64, - Abi::SysV64, - Abi::Msp430Interrupt, - Abi::X86Interrupt, - Abi::AmdGpuKernel, - ], - ..Default::default() }, } diff --git a/compiler/rustc_target/src/spec/riscv32gc_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/riscv32gc_unknown_linux_gnu.rs index cf5e0201d08..a9cdad1a8b1 100644 --- a/compiler/rustc_target/src/spec/riscv32gc_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/riscv32gc_unknown_linux_gnu.rs @@ -7,7 +7,6 @@ pub fn target() -> Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".to_string(), arch: "riscv32".to_string(), options: TargetOptions { - unsupported_abis: super::riscv_base::unsupported_abis(), code_model: Some(CodeModel::Medium), cpu: "generic-rv32".to_string(), features: "+m,+a,+f,+d,+c".to_string(), diff --git a/compiler/rustc_target/src/spec/riscv32gc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/riscv32gc_unknown_linux_musl.rs index e5fbd09297f..a64a82d55b9 100644 --- a/compiler/rustc_target/src/spec/riscv32gc_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/riscv32gc_unknown_linux_musl.rs @@ -7,7 +7,6 @@ pub fn target() -> Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".to_string(), arch: "riscv32".to_string(), options: TargetOptions { - unsupported_abis: super::riscv_base::unsupported_abis(), code_model: Some(CodeModel::Medium), cpu: "generic-rv32".to_string(), features: "+m,+a,+f,+d,+c".to_string(), diff --git a/compiler/rustc_target/src/spec/riscv32i_unknown_none_elf.rs b/compiler/rustc_target/src/spec/riscv32i_unknown_none_elf.rs index 88a22f25ff4..16d37218f41 100644 --- a/compiler/rustc_target/src/spec/riscv32i_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/riscv32i_unknown_none_elf.rs @@ -18,7 +18,6 @@ pub fn target() -> Target { panic_strategy: PanicStrategy::Abort, relocation_model: RelocModel::Static, emit_debug_gdb_scripts: false, - unsupported_abis: super::riscv_base::unsupported_abis(), eh_frame_header: false, ..Default::default() }, diff --git a/compiler/rustc_target/src/spec/riscv32imac_unknown_none_elf.rs b/compiler/rustc_target/src/spec/riscv32imac_unknown_none_elf.rs index b406eec1e75..b53bae6cb56 100644 --- a/compiler/rustc_target/src/spec/riscv32imac_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/riscv32imac_unknown_none_elf.rs @@ -18,7 +18,6 @@ pub fn target() -> Target { panic_strategy: PanicStrategy::Abort, relocation_model: RelocModel::Static, emit_debug_gdb_scripts: false, - unsupported_abis: super::riscv_base::unsupported_abis(), eh_frame_header: false, ..Default::default() }, diff --git a/compiler/rustc_target/src/spec/riscv32imc_unknown_none_elf.rs b/compiler/rustc_target/src/spec/riscv32imc_unknown_none_elf.rs index 89d760e082f..9a23def1996 100644 --- a/compiler/rustc_target/src/spec/riscv32imc_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/riscv32imc_unknown_none_elf.rs @@ -19,7 +19,6 @@ pub fn target() -> Target { panic_strategy: PanicStrategy::Abort, relocation_model: RelocModel::Static, emit_debug_gdb_scripts: false, - unsupported_abis: super::riscv_base::unsupported_abis(), eh_frame_header: false, ..Default::default() }, diff --git a/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_gnu.rs index 84f28413fcb..02d44b5ed7e 100644 --- a/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_gnu.rs @@ -7,7 +7,6 @@ pub fn target() -> Target { data_layout: "e-m:e-p:64:64-i64:64-i128:128-n64-S128".to_string(), arch: "riscv64".to_string(), options: TargetOptions { - unsupported_abis: super::riscv_base::unsupported_abis(), code_model: Some(CodeModel::Medium), cpu: "generic-rv64".to_string(), features: "+m,+a,+f,+d,+c".to_string(), diff --git a/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_musl.rs index 0232b15e8c2..3754750e48d 100644 --- a/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_musl.rs @@ -7,7 +7,6 @@ pub fn target() -> Target { data_layout: "e-m:e-p:64:64-i64:64-i128:128-n64-S128".to_string(), arch: "riscv64".to_string(), options: TargetOptions { - unsupported_abis: super::riscv_base::unsupported_abis(), code_model: Some(CodeModel::Medium), cpu: "generic-rv64".to_string(), features: "+m,+a,+f,+d,+c".to_string(), diff --git a/compiler/rustc_target/src/spec/riscv64gc_unknown_none_elf.rs b/compiler/rustc_target/src/spec/riscv64gc_unknown_none_elf.rs index 481bce05a08..f527a6cd26d 100644 --- a/compiler/rustc_target/src/spec/riscv64gc_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/riscv64gc_unknown_none_elf.rs @@ -20,7 +20,6 @@ pub fn target() -> Target { relocation_model: RelocModel::Static, code_model: Some(CodeModel::Medium), emit_debug_gdb_scripts: false, - unsupported_abis: super::riscv_base::unsupported_abis(), eh_frame_header: false, ..Default::default() }, diff --git a/compiler/rustc_target/src/spec/riscv64imac_unknown_none_elf.rs b/compiler/rustc_target/src/spec/riscv64imac_unknown_none_elf.rs index 3e4afd446dd..8b1ba88e67f 100644 --- a/compiler/rustc_target/src/spec/riscv64imac_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/riscv64imac_unknown_none_elf.rs @@ -19,7 +19,6 @@ pub fn target() -> Target { relocation_model: RelocModel::Static, code_model: Some(CodeModel::Medium), emit_debug_gdb_scripts: false, - unsupported_abis: super::riscv_base::unsupported_abis(), eh_frame_header: false, ..Default::default() }, diff --git a/compiler/rustc_target/src/spec/riscv_base.rs b/compiler/rustc_target/src/spec/riscv_base.rs deleted file mode 100644 index 5bcbb2e621b..00000000000 --- a/compiler/rustc_target/src/spec/riscv_base.rs +++ /dev/null @@ -1,22 +0,0 @@ -use crate::spec::abi::Abi; - -// All the calling conventions trigger an assertion(Unsupported calling -// convention) in llvm on RISCV -pub fn unsupported_abis() -> Vec<Abi> { - vec![ - Abi::Cdecl, - Abi::Stdcall { unwind: false }, - Abi::Stdcall { unwind: true }, - Abi::Fastcall, - Abi::Vectorcall, - Abi::Thiscall { unwind: false }, - Abi::Thiscall { unwind: true }, - Abi::Aapcs, - Abi::Win64, - Abi::SysV64, - Abi::PtxKernel, - Abi::Msp430Interrupt, - Abi::X86Interrupt, - Abi::AmdGpuKernel, - ] -} diff --git a/compiler/rustc_target/src/spec/thumb_base.rs b/compiler/rustc_target/src/spec/thumb_base.rs index fbe4dd5b501..bac1203980e 100644 --- a/compiler/rustc_target/src/spec/thumb_base.rs +++ b/compiler/rustc_target/src/spec/thumb_base.rs @@ -43,7 +43,6 @@ pub fn opts() -> TargetOptions { // Similarly, one almost always never wants to use relocatable code because of the extra // costs it involves. relocation_model: RelocModel::Static, - unsupported_abis: super::arm_base::unsupported_abis(), // When this section is added a volatile load to its start address is also generated. This // volatile load is a footgun as it can end up loading an invalid memory address, depending // on how the user set up their linker scripts. This section adds pretty printer for stuff diff --git a/compiler/rustc_target/src/spec/thumbv7a_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/thumbv7a_pc_windows_msvc.rs index 1232daa577f..369e6cd5e93 100644 --- a/compiler/rustc_target/src/spec/thumbv7a_pc_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/thumbv7a_pc_windows_msvc.rs @@ -2,7 +2,6 @@ use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, Target, TargetOptions} pub fn target() -> Target { let mut base = super::windows_msvc_base::opts(); - // Prevent error LNK2013: BRANCH24(T) fixup overflow // The LBR optimization tries to eliminate branch islands, // but if the displacement is larger than can fit @@ -17,20 +16,17 @@ pub fn target() -> Target { .or_default() .push(pre_link_args_msvc); - // FIXME(jordanrh): use PanicStrategy::Unwind when SEH is - // implemented for windows/arm in LLVM - base.panic_strategy = PanicStrategy::Abort; - Target { llvm_target: "thumbv7a-pc-windows-msvc".to_string(), pointer_width: 32, data_layout: "e-m:w-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), - options: TargetOptions { features: "+vfp3,+neon".to_string(), max_atomic_width: Some(64), - unsupported_abis: super::arm_base::unsupported_abis(), + // FIXME(jordanrh): use PanicStrategy::Unwind when SEH is + // implemented for windows/arm in LLVM + panic_strategy: PanicStrategy::Abort, ..base }, } diff --git a/compiler/rustc_target/src/spec/thumbv7a_uwp_windows_msvc.rs b/compiler/rustc_target/src/spec/thumbv7a_uwp_windows_msvc.rs index e6a59f015c9..b44c0085005 100644 --- a/compiler/rustc_target/src/spec/thumbv7a_uwp_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/thumbv7a_uwp_windows_msvc.rs @@ -1,14 +1,6 @@ use crate::spec::{PanicStrategy, Target, TargetOptions}; pub fn target() -> Target { - let mut base = super::windows_uwp_msvc_base::opts(); - base.max_atomic_width = Some(64); - base.has_elf_tls = true; - - // FIXME(jordanrh): use PanicStrategy::Unwind when SEH is - // implemented for windows/arm in LLVM - base.panic_strategy = PanicStrategy::Abort; - Target { llvm_target: "thumbv7a-pc-windows-msvc".to_string(), pointer_width: 32, @@ -16,8 +8,12 @@ pub fn target() -> Target { arch: "arm".to_string(), options: TargetOptions { features: "+vfp3,+neon".to_string(), - unsupported_abis: super::arm_base::unsupported_abis(), - ..base + max_atomic_width: Some(64), + has_elf_tls: true, + // FIXME(jordanrh): use PanicStrategy::Unwind when SEH is + // implemented for windows/arm in LLVM + panic_strategy: PanicStrategy::Abort, + ..super::windows_uwp_msvc_base::opts() }, } } diff --git a/compiler/rustc_target/src/spec/thumbv7neon_linux_androideabi.rs b/compiler/rustc_target/src/spec/thumbv7neon_linux_androideabi.rs index 58b0a9d2202..14020b88695 100644 --- a/compiler/rustc_target/src/spec/thumbv7neon_linux_androideabi.rs +++ b/compiler/rustc_target/src/spec/thumbv7neon_linux_androideabi.rs @@ -10,15 +10,16 @@ use crate::spec::{LinkerFlavor, Target, TargetOptions}; pub fn target() -> Target { let mut base = super::android_base::opts(); - base.features = "+v7,+thumb-mode,+thumb2,+vfp3,+neon".to_string(); - base.max_atomic_width = Some(64); base.pre_link_args.entry(LinkerFlavor::Gcc).or_default().push("-march=armv7-a".to_string()); - Target { llvm_target: "armv7-none-linux-android".to_string(), pointer_width: 32, 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 { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, + options: TargetOptions { + features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".to_string(), + max_atomic_width: Some(64), + ..base + }, } } diff --git a/compiler/rustc_target/src/spec/thumbv7neon_unknown_linux_gnueabihf.rs b/compiler/rustc_target/src/spec/thumbv7neon_unknown_linux_gnueabihf.rs index 12d816d095b..4042d539416 100644 --- a/compiler/rustc_target/src/spec/thumbv7neon_unknown_linux_gnueabihf.rs +++ b/compiler/rustc_target/src/spec/thumbv7neon_unknown_linux_gnueabihf.rs @@ -7,19 +7,16 @@ use crate::spec::{Target, TargetOptions}; // https://static.docs.arm.com/ddi0406/cd/DDI0406C_d_armv7ar_arm.pdf pub fn target() -> Target { - let base = super::linux_gnu_base::opts(); Target { llvm_target: "armv7-unknown-linux-gnueabihf".to_string(), pointer_width: 32, 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 { // Info about features at https://wiki.debian.org/ArmHardFloatPort features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".to_string(), max_atomic_width: Some(64), - unsupported_abis: super::arm_base::unsupported_abis(), - ..base + ..super::linux_gnu_base::opts() }, } } diff --git a/compiler/rustc_target/src/spec/thumbv7neon_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/thumbv7neon_unknown_linux_musleabihf.rs index 020de87147c..318b864a9cf 100644 --- a/compiler/rustc_target/src/spec/thumbv7neon_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/thumbv7neon_unknown_linux_musleabihf.rs @@ -7,7 +7,6 @@ use crate::spec::{Target, TargetOptions}; // https://static.docs.arm.com/ddi0406/cd/DDI0406C_d_armv7ar_arm.pdf pub fn target() -> Target { - let base = super::linux_musl_base::opts(); Target { // It's important we use "gnueabihf" and not "musleabihf" here. LLVM // uses it to determine the calling convention and float ABI, and LLVM @@ -22,9 +21,8 @@ pub fn target() -> Target { options: TargetOptions { features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".to_string(), max_atomic_width: Some(64), - unsupported_abis: super::arm_base::unsupported_abis(), mcount: "\u{1}mcount".to_string(), - ..base + ..super::linux_musl_base::opts() }, } } |
