1
Fork 0

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
This commit is contained in:
Simonas Kazlauskas 2021-06-11 14:22:13 +03:00
parent 96859dbaf6
commit 8240e7aa10
101 changed files with 1507 additions and 1038 deletions

View file

@ -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)
},
}
}

View file

@ -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)
},
}
}

View file

@ -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.

View file

@ -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)
},
}
}

View file

@ -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()
},
}
}

View file

@ -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 },
}
}

View file

@ -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()
},
}
}

View file

@ -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()
},
}
}

View file

@ -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() },
}
}

View file

@ -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()
},
}
}

View file

@ -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()
},
}
}

View file

@ -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 },
}
}

View file

@ -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()
},
}
}

View file

@ -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 {

View file

@ -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 {

View file

@ -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() },
}
}

View file

@ -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() },
}
}

View file

@ -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 {

View file

@ -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,
]
}

View file

@ -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()
},
}
}

View file

@ -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()
},
}
}

View file

@ -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()
},
}
}

View file

@ -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()
},
}
}

View file

@ -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()
},
}
}

View file

@ -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()
},

View file

@ -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()
},

View file

@ -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()
},
}
}

View file

@ -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()
},
}
}

View file

@ -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()
},
}
}

View file

@ -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()
},
}

View file

@ -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()
},
}
}

View file

@ -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()
},
}
}

View file

@ -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)
},
}
}

View file

@ -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
},
}
}

View file

@ -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()
},
}
}

View file

@ -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()
},
}
}

View file

@ -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()
},
}
}

View file

@ -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()
},
}
}

View file

@ -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()
},
}
}

View file

@ -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()
},
}
}

View file

@ -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()
},
}
}

View file

@ -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()
};

View file

@ -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()
};

View file

@ -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()
},

View file

@ -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()
},

View file

@ -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)
},
}
}

View file

@ -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()
}
}

View file

@ -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()
},

View file

@ -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)
}
}

View file

@ -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()
},
}

View file

@ -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(),

View file

@ -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(),

View file

@ -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()
},

View file

@ -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()
},

View file

@ -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()
},

View file

@ -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(),

View file

@ -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(),

View file

@ -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()
},

View file

@ -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()
},

View file

@ -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,
]
}

View file

@ -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

View file

@ -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
},
}

View file

@ -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()
},
}
}

View file

@ -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
},
}
}

View file

@ -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()
},
}
}

View file

@ -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()
},
}
}