summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_target
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:26:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:26:03 +0000
commit9918693037dce8aa4bb6f08741b6812923486c18 (patch)
tree21d2b40bec7e6a7ea664acee056eb3d08e15a1cf /compiler/rustc_target
parentReleasing progress-linux version 1.75.0+dfsg1-5~progress7.99u1. (diff)
downloadrustc-9918693037dce8aa4bb6f08741b6812923486c18.tar.xz
rustc-9918693037dce8aa4bb6f08741b6812923486c18.zip
Merging upstream version 1.76.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_target')
-rw-r--r--compiler/rustc_target/src/abi/call/aarch64.rs8
-rw-r--r--compiler/rustc_target/src/abi/call/arm.rs8
-rw-r--r--compiler/rustc_target/src/abi/call/csky.rs8
-rw-r--r--compiler/rustc_target/src/abi/call/loongarch.rs8
-rw-r--r--compiler/rustc_target/src/abi/call/m68k.rs4
-rw-r--r--compiler/rustc_target/src/abi/call/mips.rs4
-rw-r--r--compiler/rustc_target/src/abi/call/mod.rs32
-rw-r--r--compiler/rustc_target/src/abi/call/nvptx64.rs9
-rw-r--r--compiler/rustc_target/src/abi/call/powerpc64.rs8
-rw-r--r--compiler/rustc_target/src/abi/call/riscv.rs8
-rw-r--r--compiler/rustc_target/src/abi/call/s390x.rs4
-rw-r--r--compiler/rustc_target/src/abi/call/sparc.rs4
-rw-r--r--compiler/rustc_target/src/abi/call/wasm.rs24
-rw-r--r--compiler/rustc_target/src/abi/call/x86.rs4
-rw-r--r--compiler/rustc_target/src/abi/call/x86_64.rs14
-rw-r--r--compiler/rustc_target/src/abi/call/x86_win64.rs4
-rw-r--r--compiler/rustc_target/src/abi/mod.rs4
-rw-r--r--compiler/rustc_target/src/lib.rs5
-rw-r--r--compiler/rustc_target/src/spec/base/android.rs3
-rw-r--r--compiler/rustc_target/src/spec/base/apple/mod.rs57
-rw-r--r--compiler/rustc_target/src/spec/base/linux_ohos.rs4
-rw-r--r--compiler/rustc_target/src/spec/base/openbsd.rs3
-rw-r--r--compiler/rustc_target/src/spec/mod.rs33
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs12
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs10
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs12
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs1
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs13
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs19
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs12
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs3
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs3
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs3
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_kmc_solid_asp3.rs3
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_linux_android.rs3
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_nintendo_switch_freestanding.rs5
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_unknown_freebsd.rs3
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs3
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_unknown_hermit.rs3
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs3
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu_ilp32.rs3
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs3
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs3
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs3
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_unknown_none.rs9
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs5
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_unknown_openbsd.rs3
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_unknown_redox.rs3
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_unknown_teeos.rs4
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_wrs_vxworks.rs3
-rw-r--r--compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs11
-rw-r--r--compiler/rustc_target/src/spec/targets/arm64e_apple_darwin.rs27
-rw-r--r--compiler/rustc_target/src/spec/targets/arm64e_apple_ios.rs25
-rw-r--r--compiler/rustc_target/src/spec/targets/armv7k_apple_watchos.rs11
-rw-r--r--compiler/rustc_target/src/spec/targets/i386_apple_ios.rs8
-rw-r--r--compiler/rustc_target/src/spec/targets/i386_unknown_linux_gnu.rs8
-rw-r--r--compiler/rustc_target/src/spec/targets/i486_unknown_linux_gnu.rs8
-rw-r--r--compiler/rustc_target/src/spec/targets/i586_pc_nto_qnx700.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs3
-rw-r--r--compiler/rustc_target/src/spec/targets/i686_linux_android.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/i686_unknown_haiku.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/i686_unknown_netbsd.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/i686_unknown_openbsd.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/i686_win7_windows_msvc.rs33
-rw-r--r--compiler/rustc_target/src/spec/targets/i686_wrs_vxworks.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/riscv32i_unknown_none_elf.rs3
-rw-r--r--compiler/rustc_target/src/spec/targets/riscv32im_unknown_none_elf.rs4
-rw-r--r--compiler/rustc_target/src/spec/targets/riscv32imac_unknown_xous_elf.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_none_elf.rs24
-rw-r--r--compiler/rustc_target/src/spec/targets/riscv32imc_unknown_none_elf.rs4
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs3
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs8
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs8
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs8
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs20
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_linux_android.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_pc_solaris.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_sun_solaris.rs20
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_unknown_dragonfly.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_unknown_freebsd.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_unknown_fuchsia.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_unknown_haiku.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_unknown_hermit.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnux32.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_ohos.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_unknown_netbsd.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_unknown_openbsd.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_unknown_redox.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_win7_windows_msvc.rs18
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_wrs_vxworks.rs2
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs3
-rw-r--r--compiler/rustc_target/src/target_features.rs429
99 files changed, 868 insertions, 282 deletions
diff --git a/compiler/rustc_target/src/abi/call/aarch64.rs b/compiler/rustc_target/src/abi/call/aarch64.rs
index b4c7b0f12..f99f6a3b7 100644
--- a/compiler/rustc_target/src/abi/call/aarch64.rs
+++ b/compiler/rustc_target/src/abi/call/aarch64.rs
@@ -40,6 +40,10 @@ where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout,
{
+ if !ret.layout.is_sized() {
+ // Not touching this...
+ return;
+ }
if !ret.layout.is_aggregate() {
if kind == AbiKind::DarwinPCS {
// On Darwin, when returning an i8/i16, it must be sign-extended to 32 bits,
@@ -67,6 +71,10 @@ where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout,
{
+ if !arg.layout.is_sized() {
+ // Not touching this...
+ return;
+ }
if !arg.layout.is_aggregate() {
if kind == AbiKind::DarwinPCS {
// On Darwin, when passing an i8/i16, it must be sign-extended to 32 bits,
diff --git a/compiler/rustc_target/src/abi/call/arm.rs b/compiler/rustc_target/src/abi/call/arm.rs
index 1923ea588..95f6691d4 100644
--- a/compiler/rustc_target/src/abi/call/arm.rs
+++ b/compiler/rustc_target/src/abi/call/arm.rs
@@ -30,6 +30,10 @@ where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout,
{
+ if !ret.layout.is_sized() {
+ // Not touching this...
+ return;
+ }
if !ret.layout.is_aggregate() {
ret.extend_integer_width_to(32);
return;
@@ -56,6 +60,10 @@ where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout,
{
+ if !arg.layout.is_sized() {
+ // Not touching this...
+ return;
+ }
if !arg.layout.is_aggregate() {
arg.extend_integer_width_to(32);
return;
diff --git a/compiler/rustc_target/src/abi/call/csky.rs b/compiler/rustc_target/src/abi/call/csky.rs
index 706493b0a..8b4328db5 100644
--- a/compiler/rustc_target/src/abi/call/csky.rs
+++ b/compiler/rustc_target/src/abi/call/csky.rs
@@ -7,6 +7,10 @@
use crate::abi::call::{ArgAbi, FnAbi, Reg, Uniform};
fn classify_ret<Ty>(arg: &mut ArgAbi<'_, Ty>) {
+ if !arg.layout.is_sized() {
+ // Not touching this...
+ return;
+ }
// For return type, aggregate which <= 2*XLen will be returned in registers.
// Otherwise, aggregate will be returned indirectly.
if arg.layout.is_aggregate() {
@@ -24,6 +28,10 @@ fn classify_ret<Ty>(arg: &mut ArgAbi<'_, Ty>) {
}
fn classify_arg<Ty>(arg: &mut ArgAbi<'_, Ty>) {
+ if !arg.layout.is_sized() {
+ // Not touching this...
+ return;
+ }
// For argument type, the first 4*XLen parts of aggregate will be passed
// in registers, and the rest will be passed in stack.
// So we can coerce to integers directly and let backend handle it correctly.
diff --git a/compiler/rustc_target/src/abi/call/loongarch.rs b/compiler/rustc_target/src/abi/call/loongarch.rs
index e649d58bb..647b6500c 100644
--- a/compiler/rustc_target/src/abi/call/loongarch.rs
+++ b/compiler/rustc_target/src/abi/call/loongarch.rs
@@ -152,6 +152,10 @@ fn classify_ret<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>, xlen: u64, flen: u6
where
Ty: TyAbiInterface<'a, C> + Copy,
{
+ if !arg.layout.is_sized() {
+ // Not touching this...
+ return false; // I guess? return value of this function is not documented
+ }
if let Some(conv) = should_use_fp_conv(cx, &arg.layout, xlen, flen) {
match conv {
FloatConv::Float(f) => {
@@ -214,6 +218,10 @@ fn classify_arg<'a, Ty, C>(
) where
Ty: TyAbiInterface<'a, C> + Copy,
{
+ if !arg.layout.is_sized() {
+ // Not touching this...
+ return;
+ }
if !is_vararg {
match should_use_fp_conv(cx, &arg.layout, xlen, flen) {
Some(FloatConv::Float(f)) if *avail_fprs >= 1 => {
diff --git a/compiler/rustc_target/src/abi/call/m68k.rs b/compiler/rustc_target/src/abi/call/m68k.rs
index 1d4649ed8..06697bdd8 100644
--- a/compiler/rustc_target/src/abi/call/m68k.rs
+++ b/compiler/rustc_target/src/abi/call/m68k.rs
@@ -9,6 +9,10 @@ fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) {
}
fn classify_arg<Ty>(arg: &mut ArgAbi<'_, Ty>) {
+ if !arg.layout.is_sized() {
+ // Not touching this...
+ return;
+ }
if arg.layout.is_aggregate() {
arg.make_indirect_byval(None);
} else {
diff --git a/compiler/rustc_target/src/abi/call/mips.rs b/compiler/rustc_target/src/abi/call/mips.rs
index edcd1bab8..57ccfe215 100644
--- a/compiler/rustc_target/src/abi/call/mips.rs
+++ b/compiler/rustc_target/src/abi/call/mips.rs
@@ -17,6 +17,10 @@ fn classify_arg<Ty, C>(cx: &C, arg: &mut ArgAbi<'_, Ty>, offset: &mut Size)
where
C: HasDataLayout,
{
+ if !arg.layout.is_sized() {
+ // Not touching this...
+ return;
+ }
let dl = cx.data_layout();
let size = arg.layout.size;
let align = arg.layout.align.max(dl.i32_align).min(dl.i64_align).abi;
diff --git a/compiler/rustc_target/src/abi/call/mod.rs b/compiler/rustc_target/src/abi/call/mod.rs
index 5efd171b9..e97309473 100644
--- a/compiler/rustc_target/src/abi/call/mod.rs
+++ b/compiler/rustc_target/src/abi/call/mod.rs
@@ -382,6 +382,7 @@ impl HomogeneousAggregate {
}
impl<'a, Ty> TyAndLayout<'a, Ty> {
+ /// Returns `true` if this is an aggregate type (including a ScalarPair!)
fn is_aggregate(&self) -> bool {
match self.abi {
Abi::Uninhabited | Abi::Scalar(_) | Abi::Vector { .. } => false,
@@ -422,7 +423,7 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
}))
}
- Abi::ScalarPair(..) | Abi::Aggregate { .. } => {
+ Abi::ScalarPair(..) | Abi::Aggregate { sized: true } => {
// Helper for computing `homogeneous_aggregate`, allowing a custom
// starting offset (used below for handling variants).
let from_fields_at =
@@ -520,6 +521,7 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
Ok(result)
}
}
+ Abi::Aggregate { sized: false } => Err(Heterogeneous),
}
}
}
@@ -555,8 +557,7 @@ impl<'a, Ty> ArgAbi<'a, Ty> {
scalar_attrs(&layout, b, a.size(cx).align_to(b.align(cx).abi)),
),
Abi::Vector { .. } => PassMode::Direct(ArgAttributes::new()),
- // The `Aggregate` ABI should always be adjusted later.
- Abi::Aggregate { .. } => PassMode::Direct(ArgAttributes::new()),
+ Abi::Aggregate { .. } => Self::indirect_pass_mode(&layout),
};
ArgAbi { layout, mode }
}
@@ -580,14 +581,30 @@ impl<'a, Ty> ArgAbi<'a, Ty> {
PassMode::Indirect { attrs, meta_attrs, on_stack: false }
}
+ /// Pass this argument directly instead. Should NOT be used!
+ /// Only exists because of past ABI mistakes that will take time to fix
+ /// (see <https://github.com/rust-lang/rust/issues/115666>).
+ pub fn make_direct_deprecated(&mut self) {
+ match self.mode {
+ PassMode::Indirect { .. } => {
+ self.mode = PassMode::Direct(ArgAttributes::new());
+ }
+ PassMode::Ignore | PassMode::Direct(_) | PassMode::Pair(_, _) => return, // already direct
+ _ => panic!("Tried to make {:?} direct", self.mode),
+ }
+ }
+
pub fn make_indirect(&mut self) {
match self.mode {
- PassMode::Direct(_) | PassMode::Pair(_, _) => {}
- PassMode::Indirect { attrs: _, meta_attrs: None, on_stack: false } => return,
+ PassMode::Direct(_) | PassMode::Pair(_, _) => {
+ self.mode = Self::indirect_pass_mode(&self.layout);
+ }
+ PassMode::Indirect { attrs: _, meta_attrs: _, on_stack: false } => {
+ // already indirect
+ return;
+ }
_ => panic!("Tried to make {:?} indirect", self.mode),
}
-
- self.mode = Self::indirect_pass_mode(&self.layout);
}
pub fn make_indirect_byval(&mut self, byval_align: Option<Align>) {
@@ -836,7 +853,6 @@ impl<'a, Ty> FnAbi<'a, Ty> {
wasm::compute_c_abi_info(cx, self)
}
}
- "asmjs" => wasm::compute_c_abi_info(cx, self),
"bpf" => bpf::compute_abi_info(self),
arch => {
return Err(AdjustForForeignAbiError::Unsupported {
diff --git a/compiler/rustc_target/src/abi/call/nvptx64.rs b/compiler/rustc_target/src/abi/call/nvptx64.rs
index 4abe51cd6..5c040ce9c 100644
--- a/compiler/rustc_target/src/abi/call/nvptx64.rs
+++ b/compiler/rustc_target/src/abi/call/nvptx64.rs
@@ -4,12 +4,18 @@ use crate::abi::{HasDataLayout, TyAbiInterface};
fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) {
if ret.layout.is_aggregate() && ret.layout.size.bits() > 64 {
ret.make_indirect();
+ } else {
+ // FIXME: this is wrong! Need to decide which ABI we really want here.
+ ret.make_direct_deprecated();
}
}
fn classify_arg<Ty>(arg: &mut ArgAbi<'_, Ty>) {
if arg.layout.is_aggregate() && arg.layout.size.bits() > 64 {
arg.make_indirect();
+ } else {
+ // FIXME: this is wrong! Need to decide which ABI we really want here.
+ arg.make_direct_deprecated();
}
}
@@ -30,6 +36,9 @@ where
_ => unreachable!("Align is given as power of 2 no larger than 16 bytes"),
};
arg.cast_to(Uniform { unit, total: Size::from_bytes(2 * align_bytes) });
+ } else {
+ // FIXME: find a better way to do this. See https://github.com/rust-lang/rust/issues/117271.
+ arg.make_direct_deprecated();
}
}
diff --git a/compiler/rustc_target/src/abi/call/powerpc64.rs b/compiler/rustc_target/src/abi/call/powerpc64.rs
index 359bb8fc0..2d41f77e5 100644
--- a/compiler/rustc_target/src/abi/call/powerpc64.rs
+++ b/compiler/rustc_target/src/abi/call/powerpc64.rs
@@ -46,6 +46,10 @@ where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout,
{
+ if !ret.layout.is_sized() {
+ // Not touching this...
+ return;
+ }
if !ret.layout.is_aggregate() {
ret.extend_integer_width_to(64);
return;
@@ -89,6 +93,10 @@ where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout,
{
+ if !arg.layout.is_sized() {
+ // Not touching this...
+ return;
+ }
if !arg.layout.is_aggregate() {
arg.extend_integer_width_to(64);
return;
diff --git a/compiler/rustc_target/src/abi/call/riscv.rs b/compiler/rustc_target/src/abi/call/riscv.rs
index 93a204563..cbde234d3 100644
--- a/compiler/rustc_target/src/abi/call/riscv.rs
+++ b/compiler/rustc_target/src/abi/call/riscv.rs
@@ -158,6 +158,10 @@ fn classify_ret<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>, xlen: u64, flen: u6
where
Ty: TyAbiInterface<'a, C> + Copy,
{
+ if !arg.layout.is_sized() {
+ // Not touching this...
+ return false; // I guess? return value of this function is not documented
+ }
if let Some(conv) = should_use_fp_conv(cx, &arg.layout, xlen, flen) {
match conv {
FloatConv::Float(f) => {
@@ -220,6 +224,10 @@ fn classify_arg<'a, Ty, C>(
) where
Ty: TyAbiInterface<'a, C> + Copy,
{
+ if !arg.layout.is_sized() {
+ // Not touching this...
+ return;
+ }
if !is_vararg {
match should_use_fp_conv(cx, &arg.layout, xlen, flen) {
Some(FloatConv::Float(f)) if *avail_fprs >= 1 => {
diff --git a/compiler/rustc_target/src/abi/call/s390x.rs b/compiler/rustc_target/src/abi/call/s390x.rs
index ea2369281..1a2191082 100644
--- a/compiler/rustc_target/src/abi/call/s390x.rs
+++ b/compiler/rustc_target/src/abi/call/s390x.rs
@@ -17,6 +17,10 @@ where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout,
{
+ if !arg.layout.is_sized() {
+ // Not touching this...
+ return;
+ }
if !arg.layout.is_aggregate() && arg.layout.size.bits() <= 64 {
arg.extend_integer_width_to(64);
return;
diff --git a/compiler/rustc_target/src/abi/call/sparc.rs b/compiler/rustc_target/src/abi/call/sparc.rs
index edcd1bab8..57ccfe215 100644
--- a/compiler/rustc_target/src/abi/call/sparc.rs
+++ b/compiler/rustc_target/src/abi/call/sparc.rs
@@ -17,6 +17,10 @@ fn classify_arg<Ty, C>(cx: &C, arg: &mut ArgAbi<'_, Ty>, offset: &mut Size)
where
C: HasDataLayout,
{
+ if !arg.layout.is_sized() {
+ // Not touching this...
+ return;
+ }
let dl = cx.data_layout();
let size = arg.layout.size;
let align = arg.layout.align.max(dl.i32_align).min(dl.i64_align).abi;
diff --git a/compiler/rustc_target/src/abi/call/wasm.rs b/compiler/rustc_target/src/abi/call/wasm.rs
index 796b752ff..a7a2b314a 100644
--- a/compiler/rustc_target/src/abi/call/wasm.rs
+++ b/compiler/rustc_target/src/abi/call/wasm.rs
@@ -34,6 +34,10 @@ where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout,
{
+ if !arg.layout.is_sized() {
+ // Not touching this...
+ return;
+ }
arg.extend_integer_width_to(32);
if arg.layout.is_aggregate() && !unwrap_trivial_aggregate(cx, arg) {
arg.make_indirect_byval(None);
@@ -67,21 +71,33 @@ where
/// Also see <https://github.com/rust-lang/rust/issues/115666>.
pub fn compute_wasm_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) {
if !fn_abi.ret.is_ignore() {
- classify_ret(&mut fn_abi.ret);
+ classify_ret_wasm_abi(&mut fn_abi.ret);
}
for arg in fn_abi.args.iter_mut() {
if arg.is_ignore() {
continue;
}
- classify_arg(arg);
+ classify_arg_wasm_abi(arg);
}
- fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) {
+ fn classify_ret_wasm_abi<Ty>(ret: &mut ArgAbi<'_, Ty>) {
+ if !ret.layout.is_sized() {
+ // Not touching this...
+ return;
+ }
+ // FIXME: this is bad! https://github.com/rust-lang/rust/issues/115666
+ ret.make_direct_deprecated();
ret.extend_integer_width_to(32);
}
- fn classify_arg<Ty>(arg: &mut ArgAbi<'_, Ty>) {
+ fn classify_arg_wasm_abi<Ty>(arg: &mut ArgAbi<'_, Ty>) {
+ if !arg.layout.is_sized() {
+ // Not touching this...
+ return;
+ }
+ // FIXME: this is bad! https://github.com/rust-lang/rust/issues/115666
+ arg.make_direct_deprecated();
arg.extend_integer_width_to(32);
}
}
diff --git a/compiler/rustc_target/src/abi/call/x86.rs b/compiler/rustc_target/src/abi/call/x86.rs
index c27f1e6dd..e9aedc3d2 100644
--- a/compiler/rustc_target/src/abi/call/x86.rs
+++ b/compiler/rustc_target/src/abi/call/x86.rs
@@ -14,7 +14,7 @@ where
C: HasDataLayout + HasTargetSpec,
{
if !fn_abi.ret.is_ignore() {
- if fn_abi.ret.layout.is_aggregate() {
+ if fn_abi.ret.layout.is_aggregate() && fn_abi.ret.layout.is_sized() {
// Returning a structure. Most often, this will use
// a hidden first argument. On some platforms, though,
// small structs are returned as integers.
@@ -50,7 +50,7 @@ where
}
for arg in fn_abi.args.iter_mut() {
- if arg.is_ignore() {
+ if arg.is_ignore() || !arg.layout.is_sized() {
continue;
}
diff --git a/compiler/rustc_target/src/abi/call/x86_64.rs b/compiler/rustc_target/src/abi/call/x86_64.rs
index d1efe9776..6c34585a1 100644
--- a/compiler/rustc_target/src/abi/call/x86_64.rs
+++ b/compiler/rustc_target/src/abi/call/x86_64.rs
@@ -153,9 +153,9 @@ fn reg_component(cls: &[Option<Class>], i: &mut usize, size: Size) -> Option<Reg
}
}
-fn cast_target(cls: &[Option<Class>], size: Size) -> Option<CastTarget> {
+fn cast_target(cls: &[Option<Class>], size: Size) -> CastTarget {
let mut i = 0;
- let lo = reg_component(cls, &mut i, size)?;
+ let lo = reg_component(cls, &mut i, size).unwrap();
let offset = Size::from_bytes(8) * (i as u64);
let mut target = CastTarget::from(lo);
if size > offset {
@@ -164,7 +164,7 @@ fn cast_target(cls: &[Option<Class>], size: Size) -> Option<CastTarget> {
}
}
assert_eq!(reg_component(cls, &mut i, Size::ZERO), None);
- Some(target)
+ target
}
const MAX_INT_REGS: usize = 6; // RDI, RSI, RDX, RCX, R8, R9
@@ -179,6 +179,10 @@ where
let mut sse_regs = MAX_SSE_REGS;
let mut x86_64_arg_or_ret = |arg: &mut ArgAbi<'a, Ty>, is_arg: bool| {
+ if !arg.layout.is_sized() {
+ // Not touching this...
+ return;
+ }
let mut cls_or_mem = classify_arg(cx, arg);
if is_arg {
@@ -227,9 +231,7 @@ where
// split into sized chunks passed individually
if arg.layout.is_aggregate() {
let size = arg.layout.size;
- if let Some(cast_target) = cast_target(cls, size) {
- arg.cast_to(cast_target);
- }
+ arg.cast_to(cast_target(cls, size));
} else {
arg.extend_integer_width_to(32);
}
diff --git a/compiler/rustc_target/src/abi/call/x86_win64.rs b/compiler/rustc_target/src/abi/call/x86_win64.rs
index 1aaf0e511..90de1a42b 100644
--- a/compiler/rustc_target/src/abi/call/x86_win64.rs
+++ b/compiler/rustc_target/src/abi/call/x86_win64.rs
@@ -6,8 +6,8 @@ use crate::abi::Abi;
pub fn compute_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) {
let fixup = |a: &mut ArgAbi<'_, Ty>| {
match a.layout.abi {
- Abi::Uninhabited => {}
- Abi::ScalarPair(..) | Abi::Aggregate { .. } => match a.layout.size.bits() {
+ Abi::Uninhabited | Abi::Aggregate { sized: false } => {}
+ Abi::ScalarPair(..) | Abi::Aggregate { sized: true } => match a.layout.size.bits() {
8 => a.cast_to(Reg::i8()),
16 => a.cast_to(Reg::i16()),
32 => a.cast_to(Reg::i32()),
diff --git a/compiler/rustc_target/src/abi/mod.rs b/compiler/rustc_target/src/abi/mod.rs
index b00567e87..a274790bf 100644
--- a/compiler/rustc_target/src/abi/mod.rs
+++ b/compiler/rustc_target/src/abi/mod.rs
@@ -42,6 +42,8 @@ rustc_index::newtype_index! {
/// `d` is `FieldIdx(1)` in `VariantIdx(1)`, and
/// `f` is `FieldIdx(1)` in `VariantIdx(0)`.
#[derive(HashStable_Generic)]
+ #[encodable]
+ #[orderable]
pub struct FieldIdx {}
}
@@ -57,6 +59,8 @@ rustc_index::newtype_index! {
/// `struct`s, `tuples`, and `unions`s are considered to have a single variant
/// with variant index zero, aka [`FIRST_VARIANT`].
#[derive(HashStable_Generic)]
+ #[encodable]
+ #[orderable]
pub struct VariantIdx {
/// Equivalent to `VariantIdx(0)`.
const FIRST_VARIANT = 0;
diff --git a/compiler/rustc_target/src/lib.rs b/compiler/rustc_target/src/lib.rs
index 9c5ce8894..257c67779 100644
--- a/compiler/rustc_target/src/lib.rs
+++ b/compiler/rustc_target/src/lib.rs
@@ -8,8 +8,8 @@
//! LLVM.
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
-#![cfg_attr(not(bootstrap), doc(rust_logo))]
-#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
+#![doc(rust_logo)]
+#![feature(rustdoc_internals)]
#![feature(assert_matches)]
#![feature(associated_type_bounds)]
#![feature(exhaustive_patterns)]
@@ -35,6 +35,7 @@ pub mod abi;
pub mod asm;
pub mod json;
pub mod spec;
+pub mod target_features;
#[cfg(test)]
mod tests;
diff --git a/compiler/rustc_target/src/spec/base/android.rs b/compiler/rustc_target/src/spec/base/android.rs
index af15c16a5..5320f1b4b 100644
--- a/compiler/rustc_target/src/spec/base/android.rs
+++ b/compiler/rustc_target/src/spec/base/android.rs
@@ -1,10 +1,11 @@
-use crate::spec::{base, SanitizerSet, TargetOptions};
+use crate::spec::{base, SanitizerSet, TargetOptions, TlsModel};
pub fn opts() -> TargetOptions {
let mut base = base::linux::opts();
base.os = "android".into();
base.is_like_android = true;
base.default_dwarf_version = 2;
+ base.tls_model = TlsModel::Emulated;
base.has_thread_local = false;
base.supported_sanitizers = SanitizerSet::ADDRESS;
// This is for backward compatibility, see https://github.com/rust-lang/rust/issues/49867
diff --git a/compiler/rustc_target/src/spec/base/apple/mod.rs b/compiler/rustc_target/src/spec/base/apple/mod.rs
index 99e64503e..afd60b40c 100644
--- a/compiler/rustc_target/src/spec/base/apple/mod.rs
+++ b/compiler/rustc_target/src/spec/base/apple/mod.rs
@@ -1,19 +1,20 @@
use std::{borrow::Cow, env};
use crate::spec::{add_link_args, add_link_args_iter};
-use crate::spec::{cvs, Cc, DebuginfoKind, FramePointer, LinkArgs};
-use crate::spec::{LinkerFlavor, Lld, SplitDebuginfo, StaticCow, Target, TargetOptions};
+use crate::spec::{cvs, Cc, DebuginfoKind, FramePointer, LinkArgs, LinkerFlavor, Lld};
+use crate::spec::{SplitDebuginfo, StackProbeType, StaticCow, Target, TargetOptions};
#[cfg(test)]
mod tests;
use Arch::*;
#[allow(non_camel_case_types)]
-#[derive(Copy, Clone)]
+#[derive(Copy, Clone, PartialEq)]
pub enum Arch {
Armv7k,
Armv7s,
Arm64,
+ Arm64e,
Arm64_32,
I386,
I686,
@@ -31,6 +32,7 @@ impl Arch {
Armv7k => "armv7k",
Armv7s => "armv7s",
Arm64 | Arm64_macabi | Arm64_sim => "arm64",
+ Arm64e => "arm64e",
Arm64_32 => "arm64_32",
I386 => "i386",
I686 => "i686",
@@ -42,7 +44,7 @@ impl Arch {
pub fn target_arch(self) -> Cow<'static, str> {
Cow::Borrowed(match self {
Armv7k | Armv7s => "arm",
- Arm64 | Arm64_32 | Arm64_macabi | Arm64_sim => "aarch64",
+ Arm64 | Arm64e | Arm64_32 | Arm64_macabi | Arm64_sim => "aarch64",
I386 | I686 => "x86",
X86_64 | X86_64_sim | X86_64_macabi | X86_64h => "x86_64",
})
@@ -50,7 +52,7 @@ impl Arch {
fn target_abi(self) -> &'static str {
match self {
- Armv7k | Armv7s | Arm64 | Arm64_32 | I386 | I686 | X86_64 | X86_64h => "",
+ Armv7k | Armv7s | Arm64 | Arm64e | Arm64_32 | I386 | I686 | X86_64 | X86_64h => "",
X86_64_macabi | Arm64_macabi => "macabi",
// x86_64-apple-ios is a simulator target, even though it isn't
// declared that way in the target like the other ones...
@@ -63,6 +65,7 @@ impl Arch {
Armv7k => "cortex-a8",
Armv7s => "swift", // iOS 10 is only supported on iPhone 5 or higher.
Arm64 => "apple-a7",
+ Arm64e => "apple-a12",
Arm64_32 => "apple-s4",
// Only macOS 10.12+ is supported, which means
// all x86_64/x86 CPUs must be running at least penryn
@@ -78,6 +81,14 @@ impl Arch {
Arm64_sim => "apple-a12",
}
}
+
+ fn stack_probes(self) -> StackProbeType {
+ match self {
+ Armv7k | Armv7s => StackProbeType::None,
+ Arm64 | Arm64e | Arm64_32 | I386 | I686 | X86_64 | X86_64h | X86_64_sim
+ | X86_64_macabi | Arm64_macabi | Arm64_sim => StackProbeType::Inline,
+ }
+ }
}
fn pre_link_args(os: &'static str, arch: Arch, abi: &'static str) -> LinkArgs {
@@ -88,7 +99,7 @@ fn pre_link_args(os: &'static str, arch: Arch, abi: &'static str) -> LinkArgs {
};
let platform_version: StaticCow<str> = match os {
- "ios" => ios_lld_platform_version(),
+ "ios" => ios_lld_platform_version(arch),
"tvos" => tvos_lld_platform_version(),
"watchos" => watchos_lld_platform_version(),
"macos" => macos_lld_platform_version(arch),
@@ -144,6 +155,7 @@ pub fn opts(os: &'static str, arch: Arch) -> TargetOptions {
abi_return_struct_as_int: true,
emit_debug_gdb_scripts: false,
eh_frame_header: false,
+ stack_probes: arch.stack_probes(),
debuginfo_kind: DebuginfoKind::DwarfDsym,
// The historical default for macOS targets is to run `dsymutil` which
@@ -202,12 +214,22 @@ pub fn deployment_target(target: &Target) -> Option<(u32, u32)> {
let (major, minor) = match &*target.os {
"macos" => {
// This does not need to be specific. It just needs to handle x86 vs M1.
- let arch = if target.arch == "x86" || target.arch == "x86_64" { X86_64 } else { Arm64 };
+ let arch = match target.arch.as_ref() {
+ "x86" | "x86_64" => X86_64,
+ "arm64e" => Arm64e,
+ _ => Arm64,
+ };
macos_deployment_target(arch)
}
"ios" => match &*target.abi {
"macabi" => mac_catalyst_deployment_target(),
- _ => ios_deployment_target(),
+ _ => {
+ let arch = match target.arch.as_ref() {
+ "arm64e" => Arm64e,
+ _ => Arm64,
+ };
+ ios_deployment_target(arch)
+ }
},
"watchos" => watchos_deployment_target(),
"tvos" => tvos_deployment_target(),
@@ -228,7 +250,7 @@ fn from_set_deployment_target(var_name: &str) -> Option<(u32, u32)> {
fn macos_default_deployment_target(arch: Arch) -> (u32, u32) {
match arch {
// Note: Arm64_sim is not included since macOS has no simulator.
- Arm64 | Arm64_macabi => (11, 0),
+ Arm64 | Arm64e | Arm64_macabi => (11, 0),
_ => (10, 12),
}
}
@@ -280,8 +302,8 @@ fn link_env_remove(arch: Arch, os: &'static str) -> StaticCow<[StaticCow<str>]>
// Otherwise if cross-compiling for a different OS/SDK, remove any part
// of the linking environment that's wrong and reversed.
match arch {
- Armv7k | Armv7s | Arm64 | Arm64_32 | I386 | I686 | X86_64 | X86_64_sim | X86_64h
- | Arm64_sim => {
+ Armv7k | Armv7s | Arm64 | Arm64e | Arm64_32 | I386 | I686 | X86_64 | X86_64_sim
+ | X86_64h | Arm64_sim => {
cvs!["MACOSX_DEPLOYMENT_TARGET"]
}
X86_64_macabi | Arm64_macabi => cvs!["IPHONEOS_DEPLOYMENT_TARGET"],
@@ -289,9 +311,10 @@ fn link_env_remove(arch: Arch, os: &'static str) -> StaticCow<[StaticCow<str>]>
}
}
-fn ios_deployment_target() -> (u32, u32) {
+fn ios_deployment_target(arch: Arch) -> (u32, u32) {
// If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
- from_set_deployment_target("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or((10, 0))
+ let (major, minor) = if arch == Arm64e { (14, 0) } else { (10, 0) };
+ from_set_deployment_target("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or((major, minor))
}
fn mac_catalyst_deployment_target() -> (u32, u32) {
@@ -306,17 +329,17 @@ pub fn ios_llvm_target(arch: Arch) -> String {
// set high enough. Luckily one LC_BUILD_VERSION is enough, for Xcode
// to pick it up (since std and core are still built with the fallback
// of version 7.0 and hence emit the old LC_IPHONE_MIN_VERSION).
- let (major, minor) = ios_deployment_target();
+ let (major, minor) = ios_deployment_target(arch);
format!("{}-apple-ios{}.{}.0", arch.target_name(), major, minor)
}
-fn ios_lld_platform_version() -> String {
- let (major, minor) = ios_deployment_target();
+fn ios_lld_platform_version(arch: Arch) -> String {
+ let (major, minor) = ios_deployment_target(arch);
format!("{major}.{minor}")
}
pub fn ios_sim_llvm_target(arch: Arch) -> String {
- let (major, minor) = ios_deployment_target();
+ let (major, minor) = ios_deployment_target(arch);
format!("{}-apple-ios{}.{}.0-simulator", arch.target_name(), major, minor)
}
diff --git a/compiler/rustc_target/src/spec/base/linux_ohos.rs b/compiler/rustc_target/src/spec/base/linux_ohos.rs
index 273e6a98d..8272cda05 100644
--- a/compiler/rustc_target/src/spec/base/linux_ohos.rs
+++ b/compiler/rustc_target/src/spec/base/linux_ohos.rs
@@ -1,11 +1,11 @@
-use crate::spec::{base, TargetOptions};
+use crate::spec::{base, TargetOptions, TlsModel};
pub fn opts() -> TargetOptions {
let mut base = base::linux::opts();
base.env = "ohos".into();
base.crt_static_default = false;
- base.force_emulated_tls = true;
+ base.tls_model = TlsModel::Emulated;
base.has_thread_local = false;
base
diff --git a/compiler/rustc_target/src/spec/base/openbsd.rs b/compiler/rustc_target/src/spec/base/openbsd.rs
index e7db14e05..bc3aecb5c 100644
--- a/compiler/rustc_target/src/spec/base/openbsd.rs
+++ b/compiler/rustc_target/src/spec/base/openbsd.rs
@@ -1,4 +1,4 @@
-use crate::spec::{cvs, FramePointer, RelroLevel, TargetOptions};
+use crate::spec::{cvs, FramePointer, RelroLevel, TargetOptions, TlsModel};
pub fn opts() -> TargetOptions {
TargetOptions {
@@ -11,6 +11,7 @@ pub fn opts() -> TargetOptions {
frame_pointer: FramePointer::Always, // FIXME 43575: should be MayOmit...
relro_level: RelroLevel::Full,
default_dwarf_version: 2,
+ tls_model: TlsModel::Emulated,
..Default::default()
}
}
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index f04799482..b688c9731 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -929,6 +929,7 @@ pub enum TlsModel {
LocalDynamic,
InitialExec,
LocalExec,
+ Emulated,
}
impl FromStr for TlsModel {
@@ -942,6 +943,7 @@ impl FromStr for TlsModel {
"local-dynamic" => TlsModel::LocalDynamic,
"initial-exec" => TlsModel::InitialExec,
"local-exec" => TlsModel::LocalExec,
+ "emulated" => TlsModel::Emulated,
_ => return Err(()),
})
}
@@ -954,6 +956,7 @@ impl ToJson for TlsModel {
TlsModel::LocalDynamic => "local-dynamic",
TlsModel::InitialExec => "initial-exec",
TlsModel::LocalExec => "local-exec",
+ TlsModel::Emulated => "emulated",
}
.to_json()
}
@@ -1155,10 +1158,6 @@ pub enum StackProbeType {
}
impl StackProbeType {
- // LLVM X86 targets (ix86 and x86_64) can use inline-asm stack probes starting with LLVM 16.
- // Notable past issues were rust#83139 (fixed in 14) and rust#84667 (fixed in 16).
- const X86: Self = Self::InlineOrCall { min_llvm_version_for_inline: (16, 0, 0) };
-
fn from_json(json: &Json) -> Result<Self, String> {
let object = json.as_object().ok_or_else(|| "expected a JSON object")?;
let kind = object
@@ -1544,6 +1543,7 @@ supported_targets! {
("i686-unknown-hurd-gnu", i686_unknown_hurd_gnu),
("aarch64-apple-darwin", aarch64_apple_darwin),
+ ("arm64e-apple-darwin", arm64e_apple_darwin),
("x86_64-apple-darwin", x86_64_apple_darwin),
("x86_64h-apple-darwin", x86_64h_apple_darwin),
("i686-apple-darwin", i686_apple_darwin),
@@ -1566,6 +1566,7 @@ supported_targets! {
("i386-apple-ios", i386_apple_ios),
("x86_64-apple-ios", x86_64_apple_ios),
("aarch64-apple-ios", aarch64_apple_ios),
+ ("arm64e-apple-ios", arm64e_apple_ios),
("armv7s-apple-ios", armv7s_apple_ios),
("x86_64-apple-ios-macabi", x86_64_apple_ios_macabi),
("aarch64-apple-ios-macabi", aarch64_apple_ios_macabi),
@@ -1577,6 +1578,7 @@ supported_targets! {
("armv7k-apple-watchos", armv7k_apple_watchos),
("arm64_32-apple-watchos", arm64_32_apple_watchos),
("x86_64-apple-watchos-sim", x86_64_apple_watchos_sim),
+ ("aarch64-apple-watchos", aarch64_apple_watchos),
("aarch64-apple-watchos-sim", aarch64_apple_watchos_sim),
("armebv7r-none-eabi", armebv7r_none_eabi),
@@ -1585,7 +1587,6 @@ supported_targets! {
("armv7r-none-eabihf", armv7r_none_eabihf),
("x86_64-pc-solaris", x86_64_pc_solaris),
- ("x86_64-sun-solaris", x86_64_sun_solaris),
("sparcv9-sun-solaris", sparcv9_sun_solaris),
("x86_64-unknown-illumos", x86_64_unknown_illumos),
@@ -1603,13 +1604,14 @@ supported_targets! {
("aarch64-uwp-windows-msvc", aarch64_uwp_windows_msvc),
("x86_64-pc-windows-msvc", x86_64_pc_windows_msvc),
("x86_64-uwp-windows-msvc", x86_64_uwp_windows_msvc),
+ ("x86_64-win7-windows-msvc", x86_64_win7_windows_msvc),
("i686-pc-windows-msvc", i686_pc_windows_msvc),
("i686-uwp-windows-msvc", i686_uwp_windows_msvc),
+ ("i686-win7-windows-msvc", i686_win7_windows_msvc),
("i586-pc-windows-msvc", i586_pc_windows_msvc),
("thumbv7a-pc-windows-msvc", thumbv7a_pc_windows_msvc),
("thumbv7a-uwp-windows-msvc", thumbv7a_uwp_windows_msvc),
- ("asmjs-unknown-emscripten", asmjs_unknown_emscripten),
("wasm32-unknown-emscripten", wasm32_unknown_emscripten),
("wasm32-unknown-unknown", wasm32_unknown_unknown),
("wasm32-wasi", wasm32_wasi),
@@ -1641,6 +1643,7 @@ supported_targets! {
("riscv32imc-esp-espidf", riscv32imc_esp_espidf),
("riscv32imac-esp-espidf", riscv32imac_esp_espidf),
("riscv32imac-unknown-none-elf", riscv32imac_unknown_none_elf),
+ ("riscv32imafc-unknown-none-elf", riscv32imafc_unknown_none_elf),
("riscv32imac-unknown-xous-elf", riscv32imac_unknown_xous_elf),
("riscv32gc-unknown-linux-gnu", riscv32gc_unknown_linux_gnu),
("riscv32gc-unknown-linux-musl", riscv32gc_unknown_linux_musl),
@@ -2092,7 +2095,11 @@ pub struct TargetOptions {
pub no_builtins: bool,
/// The default visibility for symbols in this target should be "hidden"
- /// rather than "default"
+ /// rather than "default".
+ ///
+ /// This value typically shouldn't be accessed directly, but through
+ /// the `rustc_session::Session::default_hidden_visibility` method, which
+ /// allows `rustc` users to override this setting using cmdline flags.
pub default_hidden_visibility: bool,
/// Whether a .debug_gdb_scripts section will be added to the output object file
@@ -2194,9 +2201,6 @@ pub struct TargetOptions {
/// Whether the target supports XRay instrumentation.
pub supports_xray: bool,
-
- /// Forces the use of emulated TLS (__emutls_get_address)
- pub force_emulated_tls: bool,
}
/// Add arguments for the given flavor and also for its "twin" flavors
@@ -2244,10 +2248,6 @@ impl TargetOptions {
add_link_args(&mut self.pre_link_args, flavor, args);
}
- fn add_post_link_args(&mut self, flavor: LinkerFlavor, args: &[&'static str]) {
- add_link_args(&mut self.post_link_args, flavor, args);
- }
-
fn update_from_cli(&mut self) {
self.linker_flavor = LinkerFlavor::from_cli_json(
self.linker_flavor_json,
@@ -2416,7 +2416,6 @@ impl Default for TargetOptions {
entry_name: "main".into(),
entry_abi: Conv::C,
supports_xray: false,
- force_emulated_tls: false,
}
}
}
@@ -3120,7 +3119,6 @@ impl Target {
key!(entry_name);
key!(entry_abi, Conv)?;
key!(supports_xray, bool);
- key!(force_emulated_tls, bool);
if base.is_builtin {
// This can cause unfortunate ICEs later down the line.
@@ -3376,7 +3374,6 @@ impl ToJson for Target {
target_option_val!(entry_name);
target_option_val!(entry_abi);
target_option_val!(supports_xray);
- target_option_val!(force_emulated_tls);
if let Some(abi) = self.default_adjusted_cabi {
d.insert("default-adjusted-cabi".into(), Abi::name(abi).to_json());
@@ -3503,7 +3500,7 @@ impl TargetTriple {
/// If this target is a path, a hash of the path is appended to the triple returned
/// by `triple()`.
pub fn debug_triple(&self) -> String {
- use std::collections::hash_map::DefaultHasher;
+ use std::hash::DefaultHasher;
match self {
TargetTriple::TargetTriple(triple) => triple.to_owned(),
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs
index 9fc5b5de4..f291ac545 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs
@@ -18,19 +18,7 @@ pub fn target() -> Target {
options: TargetOptions {
features: "+neon,+fp-armv8,+apple-a7".into(),
max_atomic_width: Some(128),
- forces_embed_bitcode: true,
frame_pointer: FramePointer::NonLeaf,
- // Taken from a clang build on Xcode 11.4.1.
- // These arguments are not actually invoked - they just have
- // to look right to pass App Store validation.
- bitcode_llvm_cmdline: "-triple\0\
- arm64-apple-ios11.0.0\0\
- -emit-obj\0\
- -disable-llvm-passes\0\
- -target-abi\0\
- darwinpcs\0\
- -Os\0"
- .into(),
..base
},
}
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs
index 0172a3a9c..78067a138 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs
@@ -17,17 +17,7 @@ pub fn target() -> Target {
options: TargetOptions {
features: "+neon,+fp-armv8,+apple-a12".into(),
max_atomic_width: Some(128),
- forces_embed_bitcode: true,
frame_pointer: FramePointer::NonLeaf,
- // Taken from a clang build on Xcode 11.4.1.
- // These arguments are not actually invoked - they just have
- // to look right to pass App Store validation.
- bitcode_llvm_cmdline: "-triple\0\
- arm64-apple-ios-macabi\0\
- -emit-obj\0\
- -disable-llvm-passes\0\
- -Os\0"
- .into(),
..base
},
}
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs
index 602a68777..41760e909 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs
@@ -18,19 +18,7 @@ pub fn target() -> Target {
options: TargetOptions {
features: "+neon,+fp-armv8,+apple-a7".into(),
max_atomic_width: Some(128),
- forces_embed_bitcode: true,
frame_pointer: FramePointer::NonLeaf,
- // Taken from a clang build on Xcode 11.4.1.
- // These arguments are not actually invoked - they just have
- // to look right to pass App Store validation.
- bitcode_llvm_cmdline: "-triple\0\
- arm64-apple-ios14.0-simulator\0\
- -emit-obj\0\
- -disable-llvm-passes\0\
- -target-abi\0\
- darwinpcs\0\
- -Os\0"
- .into(),
..base
},
}
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs
index a1a319355..e817308b6 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs
@@ -11,7 +11,6 @@ pub fn target() -> Target {
options: TargetOptions {
features: "+neon,+fp-armv8,+apple-a7".into(),
max_atomic_width: Some(128),
- forces_embed_bitcode: true,
frame_pointer: FramePointer::NonLeaf,
..opts("tvos", arch)
},
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs
index 7b0bbb28e..c4aa84792 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs
@@ -11,20 +11,7 @@ pub fn target() -> Target {
options: TargetOptions {
features: "+neon,+fp-armv8,+apple-a7".into(),
max_atomic_width: Some(128),
- forces_embed_bitcode: true,
frame_pointer: FramePointer::NonLeaf,
- // Taken from (and slightly modified) the aarch64-apple-ios-sim spec which says:
- // Taken from a clang build on Xcode 11.4.1.
- // These arguments are not actually invoked - they just have
- // to look right to pass App Store validation.
- bitcode_llvm_cmdline: "-triple\0\
- arm64-apple-tvos15.0-simulator\0\
- -emit-obj\0\
- -disable-llvm-passes\0\
- -target-abi\0\
- darwinpcs\0\
- -Os\0"
- .into(),
..opts("tvos", arch)
},
}
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs
new file mode 100644
index 000000000..b62666dcc
--- /dev/null
+++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs
@@ -0,0 +1,19 @@
+use crate::spec::base::apple::{opts, Arch};
+use crate::spec::{Target, TargetOptions};
+
+pub fn target() -> Target {
+ let base = opts("watchos", Arch::Arm64);
+ Target {
+ llvm_target: "aarch-apple-watchos".into(),
+ pointer_width: 64,
+ data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(),
+ arch: "aarch64".into(),
+ options: TargetOptions {
+ features: "+v8a,+neon,+fp-armv8,+apple-a7".into(),
+ max_atomic_width: Some(128),
+ dynamic_linking: false,
+ position_independent_executables: true,
+ ..base
+ },
+ }
+}
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs
index 014560d22..96d43e6d2 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs
@@ -15,19 +15,7 @@ pub fn target() -> Target {
options: TargetOptions {
features: "+neon,+fp-armv8,+apple-a7".into(),
max_atomic_width: Some(128),
- forces_embed_bitcode: true,
frame_pointer: FramePointer::NonLeaf,
- // Taken from a clang build on Xcode 11.4.1.
- // These arguments are not actually invoked - they just have
- // to look right to pass App Store validation.
- bitcode_llvm_cmdline: "-triple\0\
- arm64-apple-watchos5.0-simulator\0\
- -emit-obj\0\
- -disable-llvm-passes\0\
- -target-abi\0\
- darwinpcs\0\
- -Os\0"
- .into(),
..opts("watchos", arch)
},
}
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs
index bbaa870ec..739a9e4a3 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs
@@ -1,5 +1,5 @@
use crate::abi::Endian;
-use crate::spec::{base, Target, TargetOptions};
+use crate::spec::{base, StackProbeType, Target, TargetOptions};
pub fn target() -> Target {
Target {
@@ -10,6 +10,7 @@ pub fn target() -> Target {
options: TargetOptions {
features: "+v8a,+outline-atomics".into(),
max_atomic_width: Some(128),
+ stack_probes: StackProbeType::Inline,
mcount: "\u{1}_mcount".into(),
endian: Endian::Big,
..base::linux_gnu::opts()
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs
index 7536e507b..1b87c09e3 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs
@@ -1,5 +1,5 @@
use crate::abi::Endian;
-use crate::spec::{base, Target, TargetOptions};
+use crate::spec::{base, StackProbeType, Target, TargetOptions};
pub fn target() -> Target {
let mut base = base::linux_gnu::opts();
@@ -13,6 +13,7 @@ pub fn target() -> Target {
options: TargetOptions {
abi: "ilp32".into(),
features: "+v8a,+outline-atomics".into(),
+ stack_probes: StackProbeType::Inline,
mcount: "\u{1}_mcount".into(),
endian: Endian::Big,
..base
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs
index 21de8a71a..02e156f19 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs
@@ -1,5 +1,5 @@
use crate::abi::Endian;
-use crate::spec::{base, Target, TargetOptions};
+use crate::spec::{base, StackProbeType, Target, TargetOptions};
pub fn target() -> Target {
Target {
@@ -10,6 +10,7 @@ pub fn target() -> Target {
options: TargetOptions {
mcount: "__mcount".into(),
max_atomic_width: Some(128),
+ stack_probes: StackProbeType::Inline,
endian: Endian::Big,
..base::netbsd::opts()
},
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_kmc_solid_asp3.rs b/compiler/rustc_target/src/spec/targets/aarch64_kmc_solid_asp3.rs
index e5e22fd1e..5b4ffc08a 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_kmc_solid_asp3.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_kmc_solid_asp3.rs
@@ -1,4 +1,4 @@
-use crate::spec::{base, RelocModel, Target, TargetOptions};
+use crate::spec::{base, RelocModel, StackProbeType, Target, TargetOptions};
pub fn target() -> Target {
let base = base::solid::opts("asp3");
@@ -13,6 +13,7 @@ pub fn target() -> Target {
relocation_model: RelocModel::Static,
disable_redzone: true,
max_atomic_width: Some(128),
+ stack_probes: StackProbeType::Inline,
..base
},
}
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_linux_android.rs b/compiler/rustc_target/src/spec/targets/aarch64_linux_android.rs
index 7c6fed7ab..db9a18085 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_linux_android.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_linux_android.rs
@@ -1,4 +1,4 @@
-use crate::spec::{base, SanitizerSet, Target, TargetOptions};
+use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions};
// See https://developer.android.com/ndk/guides/abis.html#arm64-v8a
// for target ABI requirements.
@@ -14,6 +14,7 @@ pub fn target() -> Target {
// 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: "+v8a,+neon,+fp-armv8".into(),
+ stack_probes: StackProbeType::Inline,
supported_sanitizers: SanitizerSet::CFI
| SanitizerSet::HWADDRESS
| SanitizerSet::MEMTAG
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_nintendo_switch_freestanding.rs b/compiler/rustc_target/src/spec/targets/aarch64_nintendo_switch_freestanding.rs
index 02fcc2bb4..5a92225c4 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_nintendo_switch_freestanding.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_nintendo_switch_freestanding.rs
@@ -1,4 +1,6 @@
-use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelroLevel, Target, TargetOptions};
+use crate::spec::{
+ Cc, LinkerFlavor, Lld, PanicStrategy, RelroLevel, StackProbeType, Target, TargetOptions,
+};
const LINKER_SCRIPT: &str = include_str!("./aarch64_nintendo_switch_freestanding_linker_script.ld");
@@ -16,6 +18,7 @@ pub fn target() -> Target {
link_script: Some(LINKER_SCRIPT.into()),
os: "horizon".into(),
max_atomic_width: Some(128),
+ stack_probes: StackProbeType::Inline,
panic_strategy: PanicStrategy::Abort,
position_independent_executables: true,
dynamic_linking: true,
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_freebsd.rs
index 0f95984a3..0ba91a54f 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_freebsd.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_freebsd.rs
@@ -1,4 +1,4 @@
-use crate::spec::{base, SanitizerSet, Target, TargetOptions};
+use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions};
pub fn target() -> Target {
Target {
@@ -9,6 +9,7 @@ pub fn target() -> Target {
options: TargetOptions {
features: "+v8a".into(),
max_atomic_width: Some(128),
+ stack_probes: StackProbeType::Inline,
supported_sanitizers: SanitizerSet::ADDRESS
| SanitizerSet::CFI
| SanitizerSet::MEMORY
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs
index cacc6ea23..430a1c5e7 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs
@@ -1,4 +1,4 @@
-use crate::spec::{base, SanitizerSet, Target, TargetOptions};
+use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions};
pub fn target() -> Target {
Target {
@@ -9,6 +9,7 @@ pub fn target() -> Target {
options: TargetOptions {
features: "+v8a".into(),
max_atomic_width: Some(128),
+ stack_probes: StackProbeType::Inline,
supported_sanitizers: SanitizerSet::ADDRESS
| SanitizerSet::CFI
| SanitizerSet::SHADOWCALLSTACK,
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_hermit.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_hermit.rs
index 3839e0b9c..50813b81b 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_hermit.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_hermit.rs
@@ -1,4 +1,4 @@
-use crate::spec::{base, Target, TargetOptions};
+use crate::spec::{base, StackProbeType, Target, TargetOptions};
pub fn target() -> Target {
Target {
@@ -9,6 +9,7 @@ pub fn target() -> Target {
options: TargetOptions {
features: "+v8a,+strict-align,+neon,+fp-armv8".into(),
max_atomic_width: Some(128),
+ stack_probes: StackProbeType::Inline,
..base::hermit::opts()
},
}
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs
index c0b07db38..5b3a2ffa5 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs
@@ -1,4 +1,4 @@
-use crate::spec::{base, SanitizerSet, Target, TargetOptions};
+use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions};
pub fn target() -> Target {
Target {
@@ -10,6 +10,7 @@ pub fn target() -> Target {
features: "+v8a,+outline-atomics".into(),
mcount: "\u{1}_mcount".into(),
max_atomic_width: Some(128),
+ stack_probes: StackProbeType::Inline,
supported_sanitizers: SanitizerSet::ADDRESS
| SanitizerSet::CFI
| SanitizerSet::LEAK
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu_ilp32.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu_ilp32.rs
index d4c6271b2..0ff5c8651 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu_ilp32.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu_ilp32.rs
@@ -1,4 +1,4 @@
-use crate::spec::{base, Target, TargetOptions};
+use crate::spec::{base, StackProbeType, Target, TargetOptions};
pub fn target() -> Target {
Target {
@@ -10,6 +10,7 @@ pub fn target() -> Target {
abi: "ilp32".into(),
features: "+v8a,+outline-atomics".into(),
max_atomic_width: Some(128),
+ stack_probes: StackProbeType::Inline,
mcount: "\u{1}_mcount".into(),
..base::linux_gnu::opts()
},
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
index 364df677e..d16ccd803 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
@@ -1,10 +1,11 @@
-use crate::spec::{base, SanitizerSet, Target, TargetOptions};
+use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions};
pub fn target() -> Target {
let mut base = base::linux_musl::opts();
base.max_atomic_width = Some(128);
base.supports_xray = true;
base.features = "+v8a".into();
+ base.stack_probes = StackProbeType::Inline;
base.supported_sanitizers = SanitizerSet::ADDRESS
| SanitizerSet::CFI
| SanitizerSet::LEAK
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs
index 5f3bef63a..1be27a511 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs
@@ -1,5 +1,5 @@
use crate::spec::SanitizerSet;
-use crate::spec::{base, Target, TargetOptions};
+use crate::spec::{base, StackProbeType, Target, TargetOptions};
pub fn target() -> Target {
let mut base = base::linux_ohos::opts();
@@ -14,6 +14,7 @@ pub fn target() -> Target {
options: TargetOptions {
features: "+reserve-x18".into(),
mcount: "\u{1}_mcount".into(),
+ stack_probes: StackProbeType::Inline,
supported_sanitizers: SanitizerSet::ADDRESS
| SanitizerSet::CFI
| SanitizerSet::LEAK
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs
index 3194d16ff..32a0816cf 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs
@@ -1,4 +1,4 @@
-use crate::spec::{base, Target, TargetOptions};
+use crate::spec::{base, StackProbeType, Target, TargetOptions};
pub fn target() -> Target {
Target {
@@ -10,6 +10,7 @@ pub fn target() -> Target {
features: "+v8a".into(),
mcount: "__mcount".into(),
max_atomic_width: Some(128),
+ stack_probes: StackProbeType::Inline,
..base::netbsd::opts()
},
}
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none.rs
index 88fa6d5a7..518597b38 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none.rs
@@ -7,18 +7,25 @@
// For example, `-C target-cpu=cortex-a53`.
use crate::spec::{
- Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, Target, TargetOptions,
+ Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, StackProbeType, Target,
+ TargetOptions,
};
pub fn target() -> Target {
let opts = TargetOptions {
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
linker: Some("rust-lld".into()),
+ // Enable the Cortex-A53 errata 843419 mitigation by default
+ pre_link_args: TargetOptions::link_args(
+ LinkerFlavor::Gnu(Cc::No, Lld::No),
+ &["--fix-cortex-a53-843419"],
+ ),
features: "+v8a,+strict-align,+neon,+fp-armv8".into(),
supported_sanitizers: SanitizerSet::KCFI | SanitizerSet::KERNELADDRESS,
relocation_model: RelocModel::Static,
disable_redzone: true,
max_atomic_width: Some(128),
+ stack_probes: StackProbeType::Inline,
panic_strategy: PanicStrategy::Abort,
..Default::default()
};
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs
index 48b79b0b9..d56fbdbbe 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs
@@ -6,7 +6,9 @@
//
// For example, `-C target-cpu=cortex-a53`.
-use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
+use crate::spec::{
+ Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, StackProbeType, Target, TargetOptions,
+};
pub fn target() -> Target {
let opts = TargetOptions {
@@ -17,6 +19,7 @@ pub fn target() -> Target {
relocation_model: RelocModel::Static,
disable_redzone: true,
max_atomic_width: Some(128),
+ stack_probes: StackProbeType::Inline,
panic_strategy: PanicStrategy::Abort,
..Default::default()
};
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_openbsd.rs
index e3f5aafc7..d5fca5c31 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_openbsd.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_openbsd.rs
@@ -1,4 +1,4 @@
-use crate::spec::{base, Target, TargetOptions};
+use crate::spec::{base, StackProbeType, Target, TargetOptions};
pub fn target() -> Target {
Target {
@@ -9,6 +9,7 @@ pub fn target() -> Target {
options: TargetOptions {
features: "+v8a".into(),
max_atomic_width: Some(128),
+ stack_probes: StackProbeType::Inline,
..base::openbsd::opts()
},
}
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_redox.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_redox.rs
index de875e29f..844fed472 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_redox.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_redox.rs
@@ -1,8 +1,9 @@
-use crate::spec::{base, Target};
+use crate::spec::{base, StackProbeType, Target};
pub fn target() -> Target {
let mut base = base::redox::opts();
base.max_atomic_width = Some(128);
+ base.stack_probes = StackProbeType::Inline;
base.features = "+v8a".into();
Target {
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_teeos.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_teeos.rs
index eec2668d4..204e9b061 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_teeos.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_teeos.rs
@@ -1,10 +1,10 @@
-use crate::spec::{base, Target};
+use crate::spec::{base, StackProbeType, Target};
pub fn target() -> Target {
let mut base = base::teeos::opts();
base.features = "+strict-align,+neon,+fp-armv8".into();
base.max_atomic_width = Some(128);
- base.linker = Some("aarch64-linux-gnu-ld".into());
+ base.stack_probes = StackProbeType::Inline;
Target {
llvm_target: "aarch64-unknown-none".into(),
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_wrs_vxworks.rs b/compiler/rustc_target/src/spec/targets/aarch64_wrs_vxworks.rs
index 29f61d857..48e142347 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_wrs_vxworks.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_wrs_vxworks.rs
@@ -1,4 +1,4 @@
-use crate::spec::{base, Target, TargetOptions};
+use crate::spec::{base, StackProbeType, Target, TargetOptions};
pub fn target() -> Target {
Target {
@@ -9,6 +9,7 @@ pub fn target() -> Target {
options: TargetOptions {
features: "+v8a".into(),
max_atomic_width: Some(128),
+ stack_probes: StackProbeType::Inline,
..base::vxworks::opts()
},
}
diff --git a/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs b/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs
index 9931b7b86..59e6022d9 100644
--- a/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs
+++ b/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs
@@ -11,19 +11,8 @@ pub fn target() -> Target {
options: TargetOptions {
features: "+v8a,+neon,+fp-armv8,+apple-a7".into(),
max_atomic_width: Some(128),
- forces_embed_bitcode: true,
dynamic_linking: false,
position_independent_executables: true,
- // These arguments are not actually invoked - they just have
- // to look right to pass App Store validation.
- bitcode_llvm_cmdline: "-triple\0\
- arm64_32-apple-watchos5.0.0\0\
- -emit-obj\0\
- -disable-llvm-passes\0\
- -target-abi\0\
- darwinpcs\0\
- -Os\0"
- .into(),
..base
},
}
diff --git a/compiler/rustc_target/src/spec/targets/arm64e_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/arm64e_apple_darwin.rs
new file mode 100644
index 000000000..5d1f81158
--- /dev/null
+++ b/compiler/rustc_target/src/spec/targets/arm64e_apple_darwin.rs
@@ -0,0 +1,27 @@
+use crate::spec::base::apple::{macos_llvm_target, opts, Arch};
+use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
+
+pub fn target() -> Target {
+ let arch = Arch::Arm64e;
+ let mut base = opts("macos", arch);
+ base.cpu = "apple-m1".into();
+ base.max_atomic_width = Some(128);
+
+ // FIXME: The leak sanitizer currently fails the tests, see #88132.
+ base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::THREAD;
+
+ Target {
+ // Clang automatically chooses a more specific target based on
+ // MACOSX_DEPLOYMENT_TARGET. To enable cross-language LTO to work
+ // correctly, we do too.
+ llvm_target: macos_llvm_target(arch).into(),
+ pointer_width: 64,
+ data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(),
+ arch: arch.target_arch(),
+ options: TargetOptions {
+ mcount: "\u{1}mcount".into(),
+ frame_pointer: FramePointer::NonLeaf,
+ ..base
+ },
+ }
+}
diff --git a/compiler/rustc_target/src/spec/targets/arm64e_apple_ios.rs b/compiler/rustc_target/src/spec/targets/arm64e_apple_ios.rs
new file mode 100644
index 000000000..38657d7f1
--- /dev/null
+++ b/compiler/rustc_target/src/spec/targets/arm64e_apple_ios.rs
@@ -0,0 +1,25 @@
+use crate::spec::base::apple::{ios_llvm_target, opts, Arch};
+use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
+
+pub fn target() -> Target {
+ let arch = Arch::Arm64e;
+ let mut base = opts("ios", arch);
+ base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::THREAD;
+
+ Target {
+ // Clang automatically chooses a more specific target based on
+ // IPHONEOS_DEPLOYMENT_TARGET.
+ // This is required for the target to pick the right
+ // MACH-O commands, so we do too.
+ llvm_target: ios_llvm_target(arch).into(),
+ pointer_width: 64,
+ data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(),
+ arch: arch.target_arch(),
+ options: TargetOptions {
+ features: "+neon,+fp-armv8,+apple-a12,+v8.3a,+pauth".into(),
+ max_atomic_width: Some(128),
+ frame_pointer: FramePointer::NonLeaf,
+ ..base
+ },
+ }
+}
diff --git a/compiler/rustc_target/src/spec/targets/armv7k_apple_watchos.rs b/compiler/rustc_target/src/spec/targets/armv7k_apple_watchos.rs
index 751fdcb20..7ed71c1ba 100644
--- a/compiler/rustc_target/src/spec/targets/armv7k_apple_watchos.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7k_apple_watchos.rs
@@ -11,19 +11,8 @@ pub fn target() -> Target {
options: TargetOptions {
features: "+v7,+vfp4,+neon".into(),
max_atomic_width: Some(64),
- forces_embed_bitcode: true,
dynamic_linking: false,
position_independent_executables: true,
- // These arguments are not actually invoked - they just have
- // to look right to pass App Store validation.
- bitcode_llvm_cmdline: "-triple\0\
- armv7k-apple-watchos3.0.0\0\
- -emit-obj\0\
- -disable-llvm-passes\0\
- -target-abi\0\
- darwinpcs\0\
- -Os\0"
- .into(),
..opts("watchos", arch)
},
}
diff --git a/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs b/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs
index ed2c990ff..13f8b6b5a 100644
--- a/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs
+++ b/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs
@@ -1,5 +1,5 @@
use crate::spec::base::apple::{ios_sim_llvm_target, opts, Arch};
-use crate::spec::{StackProbeType, Target, TargetOptions};
+use crate::spec::{Target, TargetOptions};
pub fn target() -> Target {
let arch = Arch::I386;
@@ -14,10 +14,6 @@ pub fn target() -> Target {
f64:32:64-f80:128-n8:16:32-S128"
.into(),
arch: arch.target_arch(),
- options: TargetOptions {
- max_atomic_width: Some(64),
- stack_probes: StackProbeType::X86,
- ..opts("ios", arch)
- },
+ options: TargetOptions { max_atomic_width: Some(64), ..opts("ios", arch) },
}
}
diff --git a/compiler/rustc_target/src/spec/targets/i386_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/i386_unknown_linux_gnu.rs
deleted file mode 100644
index 801a88933..000000000
--- a/compiler/rustc_target/src/spec/targets/i386_unknown_linux_gnu.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-use crate::spec::Target;
-
-pub fn target() -> Target {
- let mut base = super::i686_unknown_linux_gnu::target();
- base.cpu = "i386".into();
- base.llvm_target = "i386-unknown-linux-gnu".into();
- base
-}
diff --git a/compiler/rustc_target/src/spec/targets/i486_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/i486_unknown_linux_gnu.rs
deleted file mode 100644
index a11fbecc3..000000000
--- a/compiler/rustc_target/src/spec/targets/i486_unknown_linux_gnu.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-use crate::spec::Target;
-
-pub fn target() -> Target {
- let mut base = super::i686_unknown_linux_gnu::target();
- base.cpu = "i486".into();
- base.llvm_target = "i486-unknown-linux-gnu".into();
- base
-}
diff --git a/compiler/rustc_target/src/spec/targets/i586_pc_nto_qnx700.rs b/compiler/rustc_target/src/spec/targets/i586_pc_nto_qnx700.rs
index 060893916..3ebf4bcf5 100644
--- a/compiler/rustc_target/src/spec/targets/i586_pc_nto_qnx700.rs
+++ b/compiler/rustc_target/src/spec/targets/i586_pc_nto_qnx700.rs
@@ -16,7 +16,7 @@ pub fn target() -> Target {
&["-Vgcc_ntox86_cxx"],
),
env: "nto70".into(),
- stack_probes: StackProbeType::X86,
+ stack_probes: StackProbeType::Inline,
..base::nto_qnx::opts()
},
}
diff --git a/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs
index 242fe5ed9..59069fe4e 100644
--- a/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs
@@ -1,5 +1,5 @@
use crate::spec::base::apple::{macos_llvm_target, opts, Arch};
-use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
+use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, Target, TargetOptions};
pub fn target() -> Target {
// ld64 only understands i386 and not i686
@@ -7,7 +7,6 @@ pub fn target() -> Target {
let mut base = opts("macos", arch);
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Darwin(Cc::Yes, Lld::No), &["-m32"]);
- base.stack_probes = StackProbeType::X86;
base.frame_pointer = FramePointer::Always;
Target {
diff --git a/compiler/rustc_target/src/spec/targets/i686_linux_android.rs b/compiler/rustc_target/src/spec/targets/i686_linux_android.rs
index 987265598..79471040f 100644
--- a/compiler/rustc_target/src/spec/targets/i686_linux_android.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_linux_android.rs
@@ -11,7 +11,7 @@ pub fn target() -> Target {
// https://developer.android.com/ndk/guides/abis.html#x86
base.cpu = "pentiumpro".into();
base.features = "+mmx,+sse,+sse2,+sse3,+ssse3".into();
- base.stack_probes = StackProbeType::X86;
+ base.stack_probes = StackProbeType::Inline;
Target {
llvm_target: "i686-linux-android".into(),
diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs
index 70aa0b479..927b2ab87 100644
--- a/compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs
@@ -5,7 +5,7 @@ pub fn target() -> Target {
base.cpu = "pentium4".into();
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32", "-Wl,-znotext"]);
- base.stack_probes = StackProbeType::X86;
+ base.stack_probes = StackProbeType::Inline;
Target {
llvm_target: "i686-unknown-freebsd".into(),
diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_haiku.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_haiku.rs
index 9715f6c21..bc7fd6fbc 100644
--- a/compiler/rustc_target/src/spec/targets/i686_unknown_haiku.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_unknown_haiku.rs
@@ -5,7 +5,7 @@ pub fn target() -> Target {
base.cpu = "pentium4".into();
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
- base.stack_probes = StackProbeType::X86;
+ base.stack_probes = StackProbeType::Inline;
Target {
llvm_target: "i686-unknown-haiku".into(),
diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs
index 0ca058b2f..3b7be48db 100644
--- a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs
@@ -6,7 +6,7 @@ pub fn target() -> Target {
base.max_atomic_width = Some(64);
base.supported_sanitizers = SanitizerSet::ADDRESS;
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
- base.stack_probes = StackProbeType::X86;
+ base.stack_probes = StackProbeType::Inline;
Target {
llvm_target: "i686-unknown-linux-gnu".into(),
diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs
index ce0df3a72..ef58b4fb4 100644
--- a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs
@@ -5,7 +5,7 @@ pub fn target() -> Target {
base.cpu = "pentium4".into();
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32", "-Wl,-melf_i386"]);
- base.stack_probes = StackProbeType::X86;
+ base.stack_probes = StackProbeType::Inline;
// The unwinder used by i686-unknown-linux-musl, the LLVM libunwind
// implementation, apparently relies on frame pointers existing... somehow.
diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_netbsd.rs
index 2a3ac5932..5f3afbe5a 100644
--- a/compiler/rustc_target/src/spec/targets/i686_unknown_netbsd.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_unknown_netbsd.rs
@@ -5,7 +5,7 @@ pub fn target() -> Target {
base.cpu = "pentium4".into();
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
- base.stack_probes = StackProbeType::X86;
+ base.stack_probes = StackProbeType::Inline;
Target {
llvm_target: "i686-unknown-netbsdelf".into(),
diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_openbsd.rs
index 45883542b..f44584a10 100644
--- a/compiler/rustc_target/src/spec/targets/i686_unknown_openbsd.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_unknown_openbsd.rs
@@ -5,7 +5,7 @@ pub fn target() -> Target {
base.cpu = "pentium4".into();
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32", "-fuse-ld=lld"]);
- base.stack_probes = StackProbeType::X86;
+ base.stack_probes = StackProbeType::Inline;
Target {
llvm_target: "i686-unknown-openbsd".into(),
diff --git a/compiler/rustc_target/src/spec/targets/i686_win7_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/i686_win7_windows_msvc.rs
new file mode 100644
index 000000000..5b91682e1
--- /dev/null
+++ b/compiler/rustc_target/src/spec/targets/i686_win7_windows_msvc.rs
@@ -0,0 +1,33 @@
+use crate::spec::{base, LinkerFlavor, Lld, Target};
+
+pub fn target() -> Target {
+ let mut base = base::windows_msvc::opts();
+ base.cpu = "pentium4".into();
+ base.max_atomic_width = Some(64);
+ base.vendor = "win7".into();
+
+ base.add_pre_link_args(
+ LinkerFlavor::Msvc(Lld::No),
+ &[
+ // Mark all dynamic libraries and executables as compatible with the larger 4GiB address
+ // space available to x86 Windows binaries on x86_64.
+ "/LARGEADDRESSAWARE",
+ // Ensure the linker will only produce an image if it can also produce a table of
+ // the image's safe exception handlers.
+ // https://docs.microsoft.com/en-us/cpp/build/reference/safeseh-image-has-safe-exception-handlers
+ "/SAFESEH",
+ ],
+ );
+ // Workaround for #95429
+ base.has_thread_local = false;
+
+ Target {
+ llvm_target: "i686-pc-windows-msvc".into(),
+ pointer_width: 32,
+ data_layout: "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
+ i64:64-f80:128-n8:16:32-a:0:32-S32"
+ .into(),
+ arch: "x86".into(),
+ options: base,
+ }
+}
diff --git a/compiler/rustc_target/src/spec/targets/i686_wrs_vxworks.rs b/compiler/rustc_target/src/spec/targets/i686_wrs_vxworks.rs
index 965a89597..ee501c516 100644
--- a/compiler/rustc_target/src/spec/targets/i686_wrs_vxworks.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_wrs_vxworks.rs
@@ -5,7 +5,7 @@ pub fn target() -> Target {
base.cpu = "pentium4".into();
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
- base.stack_probes = StackProbeType::X86;
+ base.stack_probes = StackProbeType::Inline;
Target {
llvm_target: "i686-unknown-linux-gnu".into(),
diff --git a/compiler/rustc_target/src/spec/targets/riscv32i_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32i_unknown_none_elf.rs
index 75a65a268..b80a5fbea 100644
--- a/compiler/rustc_target/src/spec/targets/riscv32i_unknown_none_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv32i_unknown_none_elf.rs
@@ -11,8 +11,9 @@ pub fn target() -> Target {
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
linker: Some("rust-lld".into()),
cpu: "generic-rv32".into(),
- max_atomic_width: Some(0),
+ max_atomic_width: Some(32),
atomic_cas: false,
+ features: "+forced-atomics".into(),
panic_strategy: PanicStrategy::Abort,
relocation_model: RelocModel::Static,
emit_debug_gdb_scripts: false,
diff --git a/compiler/rustc_target/src/spec/targets/riscv32im_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32im_unknown_none_elf.rs
index f2242bbe0..6480facb1 100644
--- a/compiler/rustc_target/src/spec/targets/riscv32im_unknown_none_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv32im_unknown_none_elf.rs
@@ -11,9 +11,9 @@ pub fn target() -> Target {
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
linker: Some("rust-lld".into()),
cpu: "generic-rv32".into(),
- max_atomic_width: Some(0),
+ max_atomic_width: Some(32),
atomic_cas: false,
- features: "+m".into(),
+ features: "+m,+forced-atomics".into(),
panic_strategy: PanicStrategy::Abort,
relocation_model: RelocModel::Static,
emit_debug_gdb_scripts: false,
diff --git a/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_xous_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_xous_elf.rs
index a263e5d5c..ed0591ad9 100644
--- a/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_xous_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_xous_elf.rs
@@ -14,7 +14,7 @@ pub fn target() -> Target {
cpu: "generic-rv32".into(),
max_atomic_width: Some(32),
features: "+m,+a,+c".into(),
- panic_strategy: PanicStrategy::Abort,
+ panic_strategy: PanicStrategy::Unwind,
relocation_model: RelocModel::Static,
..Default::default()
},
diff --git a/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_none_elf.rs
new file mode 100644
index 000000000..9fb68874a
--- /dev/null
+++ b/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_none_elf.rs
@@ -0,0 +1,24 @@
+use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
+
+pub fn target() -> Target {
+ Target {
+ data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(),
+ llvm_target: "riscv32".into(),
+ pointer_width: 32,
+ arch: "riscv32".into(),
+
+ options: TargetOptions {
+ linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
+ linker: Some("rust-lld".into()),
+ cpu: "generic-rv32".into(),
+ max_atomic_width: Some(32),
+ llvm_abiname: "ilp32f".into(),
+ features: "+m,+a,+c,+f".into(),
+ panic_strategy: PanicStrategy::Abort,
+ relocation_model: RelocModel::Static,
+ emit_debug_gdb_scripts: false,
+ eh_frame_header: false,
+ ..Default::default()
+ },
+ }
+}
diff --git a/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_none_elf.rs
index 01e773fae..13a621a66 100644
--- a/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_none_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_none_elf.rs
@@ -11,9 +11,9 @@ pub fn target() -> Target {
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
linker: Some("rust-lld".into()),
cpu: "generic-rv32".into(),
- max_atomic_width: Some(0),
+ max_atomic_width: Some(32),
atomic_cas: false,
- features: "+m,+c".into(),
+ features: "+m,+c,+forced-atomics".into(),
panic_strategy: PanicStrategy::Abort,
relocation_model: RelocModel::Static,
emit_debug_gdb_scripts: false,
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs
index 9170a10d2..59df3937e 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs
@@ -1,6 +1,6 @@
use crate::spec::base::apple::{macos_llvm_target, opts, Arch};
use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, SanitizerSet};
-use crate::spec::{StackProbeType, Target, TargetOptions};
+use crate::spec::{Target, TargetOptions};
pub fn target() -> Target {
let arch = Arch::X86_64;
@@ -8,7 +8,6 @@ pub fn target() -> Target {
base.max_atomic_width = Some(128); // penryn+ supports cmpxchg16b
base.frame_pointer = FramePointer::Always;
base.add_pre_link_args(LinkerFlavor::Darwin(Cc::Yes, Lld::No), &["-m64"]);
- base.stack_probes = StackProbeType::X86;
base.supported_sanitizers =
SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::LEAK | SanitizerSet::THREAD;
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs
index d9f3f7de6..d0e2ac44a 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs
@@ -1,5 +1,5 @@
use crate::spec::base::apple::{ios_sim_llvm_target, opts, Arch};
-use crate::spec::{SanitizerSet, StackProbeType, Target, TargetOptions};
+use crate::spec::{SanitizerSet, Target, TargetOptions};
pub fn target() -> Target {
let arch = Arch::X86_64_sim;
@@ -12,10 +12,6 @@ pub fn target() -> Target {
data_layout: "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
.into(),
arch: arch.target_arch(),
- options: TargetOptions {
- max_atomic_width: Some(128),
- stack_probes: StackProbeType::X86,
- ..base
- },
+ options: TargetOptions { max_atomic_width: Some(128), ..base },
}
}
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs
index 5e6fbac34..8ef4b88b8 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs
@@ -1,5 +1,5 @@
use crate::spec::base::apple::{opts, Arch};
-use crate::spec::{Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, TargetOptions};
+use crate::spec::{Cc, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptions};
pub fn target() -> Target {
let llvm_target = "x86_64-apple-ios14.0-macabi";
@@ -15,10 +15,6 @@ pub fn target() -> Target {
data_layout: "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
.into(),
arch: arch.target_arch(),
- options: TargetOptions {
- max_atomic_width: Some(128),
- stack_probes: StackProbeType::X86,
- ..base
- },
+ options: TargetOptions { max_atomic_width: Some(128), ..base },
}
}
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs
index 1c4d9196c..17efd437f 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs
@@ -1,5 +1,5 @@
use crate::spec::base::apple::{opts, tvos_sim_llvm_target, Arch};
-use crate::spec::{StackProbeType, Target, TargetOptions};
+use crate::spec::{Target, TargetOptions};
pub fn target() -> Target {
let arch = Arch::X86_64_sim;
@@ -9,10 +9,6 @@ pub fn target() -> Target {
data_layout: "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
.into(),
arch: arch.target_arch(),
- options: TargetOptions {
- max_atomic_width: Some(128),
- stack_probes: StackProbeType::X86,
- ..opts("tvos", arch)
- },
+ options: TargetOptions { max_atomic_width: Some(128), ..opts("tvos", arch) },
}
}
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs
index 258148677..b1f72ee2f 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs
@@ -1,5 +1,5 @@
use crate::spec::base::apple::{opts, watchos_sim_llvm_target, Arch};
-use crate::spec::{StackProbeType, Target, TargetOptions};
+use crate::spec::{Target, TargetOptions};
pub fn target() -> Target {
let arch = Arch::X86_64_sim;
@@ -9,22 +9,6 @@ pub fn target() -> Target {
data_layout: "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
.into(),
arch: arch.target_arch(),
- options: TargetOptions {
- max_atomic_width: Some(128),
- stack_probes: StackProbeType::X86,
- forces_embed_bitcode: true,
- // Taken from a clang build on Xcode 11.4.1.
- // These arguments are not actually invoked - they just have
- // to look right to pass App Store validation.
- bitcode_llvm_cmdline: "-triple\0\
- x86_64-apple-watchos5.0-simulator\0\
- -emit-obj\0\
- -disable-llvm-passes\0\
- -target-abi\0\
- darwinpcs\0\
- -Os\0"
- .into(),
- ..opts("watchos", arch)
- },
+ options: TargetOptions { max_atomic_width: Some(128), ..opts("watchos", arch) },
}
}
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_linux_android.rs b/compiler/rustc_target/src/spec/targets/x86_64_linux_android.rs
index 6cffda44f..0e6d41abc 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_linux_android.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_linux_android.rs
@@ -10,7 +10,7 @@ pub fn target() -> Target {
base.features = "+mmx,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt".into();
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
- base.stack_probes = StackProbeType::X86;
+ base.stack_probes = StackProbeType::Inline;
base.supports_xray = true;
Target {
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_pc_solaris.rs b/compiler/rustc_target/src/spec/targets/x86_64_pc_solaris.rs
index ca6a6dc50..f15ad8dda 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_pc_solaris.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_pc_solaris.rs
@@ -7,7 +7,7 @@ pub fn target() -> Target {
base.plt_by_default = false;
base.vendor = "pc".into();
base.max_atomic_width = Some(64);
- base.stack_probes = StackProbeType::X86;
+ base.stack_probes = StackProbeType::Inline;
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::THREAD;
Target {
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_sun_solaris.rs b/compiler/rustc_target/src/spec/targets/x86_64_sun_solaris.rs
deleted file mode 100644
index cca099d3b..000000000
--- a/compiler/rustc_target/src/spec/targets/x86_64_sun_solaris.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-use crate::spec::{base, Cc, LinkerFlavor, StackProbeType, Target};
-
-pub fn target() -> Target {
- let mut base = base::solaris::opts();
- base.add_pre_link_args(LinkerFlavor::Unix(Cc::Yes), &["-m64"]);
- base.cpu = "x86-64".into();
- base.plt_by_default = false;
- base.vendor = "sun".into();
- base.max_atomic_width = Some(64);
- base.stack_probes = StackProbeType::X86;
-
- Target {
- llvm_target: "x86_64-pc-solaris".into(),
- pointer_width: 64,
- data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
- .into(),
- arch: "x86_64".into(),
- options: base,
- }
-}
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs b/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs
index c12cb1ab0..e6159fca3 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs
@@ -12,7 +12,7 @@ pub fn target() -> Target {
plt_by_default: false,
pre_link_args: TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]),
max_atomic_width: Some(64),
- stack_probes: StackProbeType::X86,
+ stack_probes: StackProbeType::Inline,
..base::unikraft_linux_musl::opts()
},
}
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_dragonfly.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_dragonfly.rs
index 68d1a755b..80adb8fa2 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_dragonfly.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_dragonfly.rs
@@ -6,7 +6,7 @@ pub fn target() -> Target {
base.plt_by_default = false;
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
- base.stack_probes = StackProbeType::X86;
+ base.stack_probes = StackProbeType::Inline;
Target {
llvm_target: "x86_64-unknown-dragonfly".into(),
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_freebsd.rs
index e3f29fa5a..fa3210353 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_freebsd.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_freebsd.rs
@@ -6,7 +6,7 @@ pub fn target() -> Target {
base.plt_by_default = false;
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
- base.stack_probes = StackProbeType::X86;
+ base.stack_probes = StackProbeType::Inline;
base.supported_sanitizers =
SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::MEMORY | SanitizerSet::THREAD;
base.supports_xray = true;
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_fuchsia.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_fuchsia.rs
index c8850d703..f0515615b 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_fuchsia.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_fuchsia.rs
@@ -5,7 +5,7 @@ pub fn target() -> Target {
base.cpu = "x86-64".into();
base.plt_by_default = false;
base.max_atomic_width = Some(64);
- base.stack_probes = StackProbeType::X86;
+ base.stack_probes = StackProbeType::Inline;
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI;
Target {
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_haiku.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_haiku.rs
index ca55e6514..0f927be96 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_haiku.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_haiku.rs
@@ -6,7 +6,7 @@ pub fn target() -> Target {
base.plt_by_default = false;
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
- base.stack_probes = StackProbeType::X86;
+ base.stack_probes = StackProbeType::Inline;
// This option is required to build executables on Haiku x86_64
base.position_independent_executables = true;
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_hermit.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_hermit.rs
index 3cc50d40d..df191f515 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_hermit.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_hermit.rs
@@ -12,7 +12,7 @@ pub fn target() -> Target {
features: "+rdrnd,+rdseed".into(),
plt_by_default: false,
max_atomic_width: Some(64),
- stack_probes: StackProbeType::X86,
+ stack_probes: StackProbeType::Inline,
..base::hermit::opts()
},
}
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs
index 80e267c16..bf10f7e5d 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs
@@ -6,7 +6,7 @@ pub fn target() -> Target {
base.plt_by_default = false;
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
- base.stack_probes = StackProbeType::X86;
+ base.stack_probes = StackProbeType::Inline;
base.static_position_independent_executables = true;
base.supported_sanitizers = SanitizerSet::ADDRESS
| SanitizerSet::CFI
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnux32.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnux32.rs
index 622bfe8bb..1856c6afd 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnux32.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnux32.rs
@@ -6,7 +6,7 @@ pub fn target() -> Target {
base.abi = "x32".into();
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-mx32"]);
- base.stack_probes = StackProbeType::X86;
+ base.stack_probes = StackProbeType::Inline;
base.has_thread_local = false;
// BUG(GabrielMajeri): disabling the PLT on x86_64 Linux with x32 ABI
// breaks code gen. See LLVM bug 36743
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
index d74ff466a..8dc5503e3 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
@@ -6,7 +6,7 @@ pub fn target() -> Target {
base.plt_by_default = false;
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
- base.stack_probes = StackProbeType::X86;
+ base.stack_probes = StackProbeType::Inline;
base.static_position_independent_executables = true;
base.supported_sanitizers = SanitizerSet::ADDRESS
| SanitizerSet::CFI
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_ohos.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_ohos.rs
index 87b004df0..35862656a 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_ohos.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_ohos.rs
@@ -5,7 +5,7 @@ pub fn target() -> Target {
base.cpu = "x86-64".into();
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
- base.stack_probes = StackProbeType::X86;
+ base.stack_probes = StackProbeType::Inline;
base.static_position_independent_executables = true;
base.supported_sanitizers = SanitizerSet::ADDRESS
| SanitizerSet::CFI
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_netbsd.rs
index 04060513a..e2cee0513 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_netbsd.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_netbsd.rs
@@ -8,7 +8,7 @@ pub fn target() -> Target {
base.plt_by_default = false;
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
- base.stack_probes = StackProbeType::X86;
+ base.stack_probes = StackProbeType::Inline;
base.supported_sanitizers = SanitizerSet::ADDRESS
| SanitizerSet::CFI
| SanitizerSet::LEAK
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs
index 9aa95a35f..8f7655d8c 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs
@@ -12,7 +12,7 @@ pub fn target() -> Target {
cpu: "x86-64".into(),
plt_by_default: false,
max_atomic_width: Some(64),
- stack_probes: StackProbeType::X86,
+ stack_probes: StackProbeType::Inline,
position_independent_executables: true,
static_position_independent_executables: true,
relro_level: RelroLevel::Full,
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_openbsd.rs
index 5e6e7efb2..1133b50f3 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_openbsd.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_openbsd.rs
@@ -6,7 +6,7 @@ pub fn target() -> Target {
base.plt_by_default = false;
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
- base.stack_probes = StackProbeType::X86;
+ base.stack_probes = StackProbeType::Inline;
base.supports_xray = true;
Target {
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_redox.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_redox.rs
index 382ff71f0..c1f573112 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_redox.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_redox.rs
@@ -6,7 +6,7 @@ pub fn target() -> Target {
base.plt_by_default = false;
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
- base.stack_probes = StackProbeType::X86;
+ base.stack_probes = StackProbeType::Inline;
Target {
llvm_target: "x86_64-unknown-redox".into(),
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_win7_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/x86_64_win7_windows_msvc.rs
new file mode 100644
index 000000000..5a59839eb
--- /dev/null
+++ b/compiler/rustc_target/src/spec/targets/x86_64_win7_windows_msvc.rs
@@ -0,0 +1,18 @@
+use crate::spec::{base, Target};
+
+pub fn target() -> Target {
+ let mut base = base::windows_msvc::opts();
+ base.cpu = "x86-64".into();
+ base.plt_by_default = false;
+ base.max_atomic_width = Some(64);
+ base.vendor = "win7".into();
+
+ Target {
+ llvm_target: "x86_64-win7-windows-msvc".into(),
+ pointer_width: 64,
+ data_layout: "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+ .into(),
+ arch: "x86_64".into(),
+ options: base,
+ }
+}
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_wrs_vxworks.rs b/compiler/rustc_target/src/spec/targets/x86_64_wrs_vxworks.rs
index 4b221fe69..765239bdd 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_wrs_vxworks.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_wrs_vxworks.rs
@@ -6,7 +6,7 @@ pub fn target() -> Target {
base.plt_by_default = false;
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
- base.stack_probes = StackProbeType::X86;
+ base.stack_probes = StackProbeType::Inline;
base.disable_redzone = true;
Target {
diff --git a/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs
index a30e9d17c..0c731e369 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs
@@ -1,6 +1,6 @@
use crate::spec::base::apple::{macos_llvm_target, opts, Arch};
use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, SanitizerSet};
-use crate::spec::{StackProbeType, Target, TargetOptions};
+use crate::spec::{Target, TargetOptions};
pub fn target() -> Target {
let arch = Arch::X86_64h;
@@ -8,7 +8,6 @@ pub fn target() -> Target {
base.max_atomic_width = Some(128);
base.frame_pointer = FramePointer::Always;
base.add_pre_link_args(LinkerFlavor::Darwin(Cc::Yes, Lld::No), &["-m64"]);
- base.stack_probes = StackProbeType::X86;
base.supported_sanitizers =
SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::LEAK | SanitizerSet::THREAD;
diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs
new file mode 100644
index 000000000..5f5de57dd
--- /dev/null
+++ b/compiler/rustc_target/src/target_features.rs
@@ -0,0 +1,429 @@
+use rustc_span::symbol::sym;
+use rustc_span::symbol::Symbol;
+
+/// Features that control behaviour of rustc, rather than the codegen.
+pub const RUSTC_SPECIFIC_FEATURES: &[&str] = &["crt-static"];
+
+/// Stability information for target features.
+#[derive(Debug, Clone, Copy)]
+pub enum Stability {
+ /// This target feature is stable, it can be used in `#[target_feature]` and
+ /// `#[cfg(target_feature)]`.
+ Stable,
+ /// This target feature is unstable; using it in `#[target_feature]` or `#[cfg(target_feature)]`
+ /// requires enabling the given nightly feature.
+ Unstable(Symbol),
+}
+use Stability::*;
+
+impl Stability {
+ pub fn as_feature_name(self) -> Option<Symbol> {
+ match self {
+ Stable => None,
+ Unstable(s) => Some(s),
+ }
+ }
+
+ pub fn is_stable(self) -> bool {
+ matches!(self, Stable)
+ }
+}
+
+// Here we list target features that rustc "understands": they can be used in `#[target_feature]`
+// and `#[cfg(target_feature)]`. They also do not trigger any warnings when used with
+// `-Ctarget-feature`.
+//
+// When adding features to the below lists
+// check whether they're named already elsewhere in rust
+// e.g. in stdarch and whether the given name matches LLVM's
+// if it doesn't, to_llvm_feature in llvm_util in rustc_codegen_llvm needs to be adapted.
+//
+// Also note that all target features listed here must be purely additive: for target_feature 1.1 to
+// be sound, we can never allow features like `+soft-float` (on x86) to be controlled on a
+// per-function level, since we would then allow safe calls from functions with `+soft-float` to
+// functions without that feature!
+//
+// When adding a new feature, be particularly mindful of features that affect function ABIs. Those
+// need to be treated very carefully to avoid introducing unsoundness! This often affects features
+// that enable/disable hardfloat support (see https://github.com/rust-lang/rust/issues/116344 for an
+// example of this going wrong), but features enabling new SIMD registers are also a concern (see
+// https://github.com/rust-lang/rust/issues/116558 for an example of this going wrong).
+//
+// Stabilizing a target feature requires t-lang approval.
+
+const ARM_ALLOWED_FEATURES: &[(&str, Stability)] = &[
+ // tidy-alphabetical-start
+ ("aclass", Unstable(sym::arm_target_feature)),
+ ("aes", Unstable(sym::arm_target_feature)),
+ ("crc", Unstable(sym::arm_target_feature)),
+ ("d32", Unstable(sym::arm_target_feature)),
+ ("dotprod", Unstable(sym::arm_target_feature)),
+ ("dsp", Unstable(sym::arm_target_feature)),
+ ("fp-armv8", Unstable(sym::arm_target_feature)),
+ ("i8mm", Unstable(sym::arm_target_feature)),
+ ("mclass", Unstable(sym::arm_target_feature)),
+ ("neon", Unstable(sym::arm_target_feature)),
+ ("rclass", Unstable(sym::arm_target_feature)),
+ ("sha2", Unstable(sym::arm_target_feature)),
+ // This is needed for inline assembly, but shouldn't be stabilized as-is
+ // since it should be enabled per-function using #[instruction_set], not
+ // #[target_feature].
+ ("thumb-mode", Unstable(sym::arm_target_feature)),
+ ("thumb2", Unstable(sym::arm_target_feature)),
+ ("trustzone", Unstable(sym::arm_target_feature)),
+ ("v5te", Unstable(sym::arm_target_feature)),
+ ("v6", Unstable(sym::arm_target_feature)),
+ ("v6k", Unstable(sym::arm_target_feature)),
+ ("v6t2", Unstable(sym::arm_target_feature)),
+ ("v7", Unstable(sym::arm_target_feature)),
+ ("v8", Unstable(sym::arm_target_feature)),
+ ("vfp2", Unstable(sym::arm_target_feature)),
+ ("vfp3", Unstable(sym::arm_target_feature)),
+ ("vfp4", Unstable(sym::arm_target_feature)),
+ ("virtualization", Unstable(sym::arm_target_feature)),
+ // tidy-alphabetical-end
+];
+
+const AARCH64_ALLOWED_FEATURES: &[(&str, Stability)] = &[
+ // tidy-alphabetical-start
+ // FEAT_AES
+ ("aes", Stable),
+ // FEAT_BF16
+ ("bf16", Stable),
+ // FEAT_BTI
+ ("bti", Stable),
+ // FEAT_CRC
+ ("crc", Stable),
+ // FEAT_DIT
+ ("dit", Stable),
+ // FEAT_DotProd
+ ("dotprod", Stable),
+ // FEAT_DPB
+ ("dpb", Stable),
+ // FEAT_DPB2
+ ("dpb2", Stable),
+ // FEAT_F32MM
+ ("f32mm", Stable),
+ // FEAT_F64MM
+ ("f64mm", Stable),
+ // FEAT_FCMA
+ ("fcma", Stable),
+ // FEAT_FHM
+ ("fhm", Stable),
+ // FEAT_FLAGM
+ ("flagm", Stable),
+ // FEAT_FP16
+ ("fp16", Stable),
+ // FEAT_FRINTTS
+ ("frintts", Stable),
+ // FEAT_I8MM
+ ("i8mm", Stable),
+ // FEAT_JSCVT
+ ("jsconv", Stable),
+ // FEAT_LOR
+ ("lor", Stable),
+ // FEAT_LSE
+ ("lse", Stable),
+ // FEAT_MTE
+ ("mte", Stable),
+ // FEAT_AdvSimd & FEAT_FP
+ ("neon", Stable),
+ // FEAT_PAUTH (address authentication)
+ ("paca", Stable),
+ // FEAT_PAUTH (generic authentication)
+ ("pacg", Stable),
+ // FEAT_PAN
+ ("pan", Stable),
+ // FEAT_PMUv3
+ ("pmuv3", Stable),
+ // FEAT_RAND
+ ("rand", Stable),
+ // FEAT_RAS
+ ("ras", Stable),
+ // FEAT_RCPC
+ ("rcpc", Stable),
+ // FEAT_RCPC2
+ ("rcpc2", Stable),
+ // FEAT_RDM
+ ("rdm", Stable),
+ // FEAT_SB
+ ("sb", Stable),
+ // FEAT_SHA1 & FEAT_SHA256
+ ("sha2", Stable),
+ // FEAT_SHA512 & FEAT_SHA3
+ ("sha3", Stable),
+ // FEAT_SM3 & FEAT_SM4
+ ("sm4", Stable),
+ // FEAT_SPE
+ ("spe", Stable),
+ // FEAT_SSBS
+ ("ssbs", Stable),
+ // FEAT_SVE
+ ("sve", Stable),
+ // FEAT_SVE2
+ ("sve2", Stable),
+ // FEAT_SVE2_AES
+ ("sve2-aes", Stable),
+ // FEAT_SVE2_BitPerm
+ ("sve2-bitperm", Stable),
+ // FEAT_SVE2_SHA3
+ ("sve2-sha3", Stable),
+ // FEAT_SVE2_SM4
+ ("sve2-sm4", Stable),
+ // FEAT_TME
+ ("tme", Stable),
+ ("v8.1a", Unstable(sym::aarch64_ver_target_feature)),
+ ("v8.2a", Unstable(sym::aarch64_ver_target_feature)),
+ ("v8.3a", Unstable(sym::aarch64_ver_target_feature)),
+ ("v8.4a", Unstable(sym::aarch64_ver_target_feature)),
+ ("v8.5a", Unstable(sym::aarch64_ver_target_feature)),
+ ("v8.6a", Unstable(sym::aarch64_ver_target_feature)),
+ ("v8.7a", Unstable(sym::aarch64_ver_target_feature)),
+ // FEAT_VHE
+ ("vh", Stable),
+ // tidy-alphabetical-end
+];
+
+const AARCH64_TIED_FEATURES: &[&[&str]] = &[
+ &["paca", "pacg"], // Together these represent `pauth` in LLVM
+];
+
+const X86_ALLOWED_FEATURES: &[(&str, Stability)] = &[
+ // tidy-alphabetical-start
+ ("adx", Stable),
+ ("aes", Stable),
+ ("avx", Stable),
+ ("avx2", Stable),
+ ("avx512bf16", Unstable(sym::avx512_target_feature)),
+ ("avx512bitalg", Unstable(sym::avx512_target_feature)),
+ ("avx512bw", Unstable(sym::avx512_target_feature)),
+ ("avx512cd", Unstable(sym::avx512_target_feature)),
+ ("avx512dq", Unstable(sym::avx512_target_feature)),
+ ("avx512er", Unstable(sym::avx512_target_feature)),
+ ("avx512f", Unstable(sym::avx512_target_feature)),
+ ("avx512ifma", Unstable(sym::avx512_target_feature)),
+ ("avx512pf", Unstable(sym::avx512_target_feature)),
+ ("avx512vbmi", Unstable(sym::avx512_target_feature)),
+ ("avx512vbmi2", Unstable(sym::avx512_target_feature)),
+ ("avx512vl", Unstable(sym::avx512_target_feature)),
+ ("avx512vnni", Unstable(sym::avx512_target_feature)),
+ ("avx512vp2intersect", Unstable(sym::avx512_target_feature)),
+ ("avx512vpopcntdq", Unstable(sym::avx512_target_feature)),
+ ("bmi1", Stable),
+ ("bmi2", Stable),
+ ("cmpxchg16b", Stable),
+ ("ermsb", Unstable(sym::ermsb_target_feature)),
+ ("f16c", Stable),
+ ("fma", Stable),
+ ("fxsr", Stable),
+ ("gfni", Unstable(sym::avx512_target_feature)),
+ ("lzcnt", Stable),
+ ("movbe", Stable),
+ ("pclmulqdq", Stable),
+ ("popcnt", Stable),
+ ("rdrand", Stable),
+ ("rdseed", Stable),
+ ("rtm", Unstable(sym::rtm_target_feature)),
+ ("sha", Stable),
+ ("sse", Stable),
+ ("sse2", Stable),
+ ("sse3", Stable),
+ ("sse4.1", Stable),
+ ("sse4.2", Stable),
+ ("sse4a", Unstable(sym::sse4a_target_feature)),
+ ("ssse3", Stable),
+ ("tbm", Unstable(sym::tbm_target_feature)),
+ ("vaes", Unstable(sym::avx512_target_feature)),
+ ("vpclmulqdq", Unstable(sym::avx512_target_feature)),
+ ("xsave", Stable),
+ ("xsavec", Stable),
+ ("xsaveopt", Stable),
+ ("xsaves", Stable),
+ // tidy-alphabetical-end
+];
+
+const HEXAGON_ALLOWED_FEATURES: &[(&str, Stability)] = &[
+ // tidy-alphabetical-start
+ ("hvx", Unstable(sym::hexagon_target_feature)),
+ ("hvx-length128b", Unstable(sym::hexagon_target_feature)),
+ // tidy-alphabetical-end
+];
+
+const POWERPC_ALLOWED_FEATURES: &[(&str, Stability)] = &[
+ // tidy-alphabetical-start
+ ("altivec", Unstable(sym::powerpc_target_feature)),
+ ("power10-vector", Unstable(sym::powerpc_target_feature)),
+ ("power8-altivec", Unstable(sym::powerpc_target_feature)),
+ ("power8-vector", Unstable(sym::powerpc_target_feature)),
+ ("power9-altivec", Unstable(sym::powerpc_target_feature)),
+ ("power9-vector", Unstable(sym::powerpc_target_feature)),
+ ("vsx", Unstable(sym::powerpc_target_feature)),
+ // tidy-alphabetical-end
+];
+
+const MIPS_ALLOWED_FEATURES: &[(&str, Stability)] = &[
+ // tidy-alphabetical-start
+ ("fp64", Unstable(sym::mips_target_feature)),
+ ("msa", Unstable(sym::mips_target_feature)),
+ ("virt", Unstable(sym::mips_target_feature)),
+ // tidy-alphabetical-end
+];
+
+const RISCV_ALLOWED_FEATURES: &[(&str, Stability)] = &[
+ // tidy-alphabetical-start
+ ("a", Stable),
+ ("c", Stable),
+ ("d", Unstable(sym::riscv_target_feature)),
+ ("e", Unstable(sym::riscv_target_feature)),
+ ("f", Unstable(sym::riscv_target_feature)),
+ ("fast-unaligned-access", Unstable(sym::riscv_target_feature)),
+ ("m", Stable),
+ ("relax", Unstable(sym::riscv_target_feature)),
+ ("v", Unstable(sym::riscv_target_feature)),
+ ("zba", Stable),
+ ("zbb", Stable),
+ ("zbc", Stable),
+ ("zbkb", Stable),
+ ("zbkc", Stable),
+ ("zbkx", Stable),
+ ("zbs", Stable),
+ ("zdinx", Unstable(sym::riscv_target_feature)),
+ ("zfh", Unstable(sym::riscv_target_feature)),
+ ("zfhmin", Unstable(sym::riscv_target_feature)),
+ ("zfinx", Unstable(sym::riscv_target_feature)),
+ ("zhinx", Unstable(sym::riscv_target_feature)),
+ ("zhinxmin", Unstable(sym::riscv_target_feature)),
+ ("zk", Stable),
+ ("zkn", Stable),
+ ("zknd", Stable),
+ ("zkne", Stable),
+ ("zknh", Stable),
+ ("zkr", Stable),
+ ("zks", Stable),
+ ("zksed", Stable),
+ ("zksh", Stable),
+ ("zkt", Stable),
+ // tidy-alphabetical-end
+];
+
+const WASM_ALLOWED_FEATURES: &[(&str, Stability)] = &[
+ // tidy-alphabetical-start
+ ("atomics", Unstable(sym::wasm_target_feature)),
+ ("bulk-memory", Unstable(sym::wasm_target_feature)),
+ ("exception-handling", Unstable(sym::wasm_target_feature)),
+ ("multivalue", Unstable(sym::wasm_target_feature)),
+ ("mutable-globals", Unstable(sym::wasm_target_feature)),
+ ("nontrapping-fptoint", Unstable(sym::wasm_target_feature)),
+ ("reference-types", Unstable(sym::wasm_target_feature)),
+ ("relaxed-simd", Unstable(sym::wasm_target_feature)),
+ ("sign-ext", Unstable(sym::wasm_target_feature)),
+ ("simd128", Stable),
+ // tidy-alphabetical-end
+];
+
+const BPF_ALLOWED_FEATURES: &[(&str, Stability)] = &[("alu32", Unstable(sym::bpf_target_feature))];
+
+const CSKY_ALLOWED_FEATURES: &[(&str, Stability)] = &[
+ // tidy-alphabetical-start
+ ("10e60", Unstable(sym::csky_target_feature)),
+ ("2e3", Unstable(sym::csky_target_feature)),
+ ("3e3r1", Unstable(sym::csky_target_feature)),
+ ("3e3r2", Unstable(sym::csky_target_feature)),
+ ("3e3r3", Unstable(sym::csky_target_feature)),
+ ("3e7", Unstable(sym::csky_target_feature)),
+ ("7e10", Unstable(sym::csky_target_feature)),
+ ("cache", Unstable(sym::csky_target_feature)),
+ ("doloop", Unstable(sym::csky_target_feature)),
+ ("dsp1e2", Unstable(sym::csky_target_feature)),
+ ("dspe60", Unstable(sym::csky_target_feature)),
+ ("e1", Unstable(sym::csky_target_feature)),
+ ("e2", Unstable(sym::csky_target_feature)),
+ ("edsp", Unstable(sym::csky_target_feature)),
+ ("elrw", Unstable(sym::csky_target_feature)),
+ ("float1e2", Unstable(sym::csky_target_feature)),
+ ("float1e3", Unstable(sym::csky_target_feature)),
+ ("float3e4", Unstable(sym::csky_target_feature)),
+ ("float7e60", Unstable(sym::csky_target_feature)),
+ ("floate1", Unstable(sym::csky_target_feature)),
+ ("hard-tp", Unstable(sym::csky_target_feature)),
+ ("high-registers", Unstable(sym::csky_target_feature)),
+ ("hwdiv", Unstable(sym::csky_target_feature)),
+ ("mp", Unstable(sym::csky_target_feature)),
+ ("mp1e2", Unstable(sym::csky_target_feature)),
+ ("nvic", Unstable(sym::csky_target_feature)),
+ ("trust", Unstable(sym::csky_target_feature)),
+ ("vdsp2e60f", Unstable(sym::csky_target_feature)),
+ ("vdspv1", Unstable(sym::csky_target_feature)),
+ ("vdspv2", Unstable(sym::csky_target_feature)),
+ // tidy-alphabetical-end
+ //fpu
+ // tidy-alphabetical-start
+ ("fdivdu", Unstable(sym::csky_target_feature)),
+ ("fpuv2_df", Unstable(sym::csky_target_feature)),
+ ("fpuv2_sf", Unstable(sym::csky_target_feature)),
+ ("fpuv3_df", Unstable(sym::csky_target_feature)),
+ ("fpuv3_hf", Unstable(sym::csky_target_feature)),
+ ("fpuv3_hi", Unstable(sym::csky_target_feature)),
+ ("fpuv3_sf", Unstable(sym::csky_target_feature)),
+ ("hard-float", Unstable(sym::csky_target_feature)),
+ ("hard-float-abi", Unstable(sym::csky_target_feature)),
+ // tidy-alphabetical-end
+];
+
+const LOONGARCH_ALLOWED_FEATURES: &[(&str, Stability)] = &[
+ // tidy-alphabetical-start
+ ("d", Unstable(sym::loongarch_target_feature)),
+ ("f", Unstable(sym::loongarch_target_feature)),
+ ("lasx", Unstable(sym::loongarch_target_feature)),
+ ("lbt", Unstable(sym::loongarch_target_feature)),
+ ("lsx", Unstable(sym::loongarch_target_feature)),
+ ("lvz", Unstable(sym::loongarch_target_feature)),
+ ("ual", Unstable(sym::loongarch_target_feature)),
+ // tidy-alphabetical-end
+];
+
+/// When rustdoc is running, provide a list of all known features so that all their respective
+/// primitives may be documented.
+///
+/// IMPORTANT: If you're adding another feature list above, make sure to add it to this iterator!
+pub fn all_known_features() -> impl Iterator<Item = (&'static str, Stability)> {
+ std::iter::empty()
+ .chain(ARM_ALLOWED_FEATURES.iter())
+ .chain(AARCH64_ALLOWED_FEATURES.iter())
+ .chain(X86_ALLOWED_FEATURES.iter())
+ .chain(HEXAGON_ALLOWED_FEATURES.iter())
+ .chain(POWERPC_ALLOWED_FEATURES.iter())
+ .chain(MIPS_ALLOWED_FEATURES.iter())
+ .chain(RISCV_ALLOWED_FEATURES.iter())
+ .chain(WASM_ALLOWED_FEATURES.iter())
+ .chain(BPF_ALLOWED_FEATURES.iter())
+ .chain(CSKY_ALLOWED_FEATURES)
+ .chain(LOONGARCH_ALLOWED_FEATURES)
+ .cloned()
+}
+
+impl super::spec::Target {
+ pub fn supported_target_features(&self) -> &'static [(&'static str, Stability)] {
+ match &*self.arch {
+ "arm" => ARM_ALLOWED_FEATURES,
+ "aarch64" => AARCH64_ALLOWED_FEATURES,
+ "x86" | "x86_64" => X86_ALLOWED_FEATURES,
+ "hexagon" => HEXAGON_ALLOWED_FEATURES,
+ "mips" | "mips32r6" | "mips64" | "mips64r6" => MIPS_ALLOWED_FEATURES,
+ "powerpc" | "powerpc64" => POWERPC_ALLOWED_FEATURES,
+ "riscv32" | "riscv64" => RISCV_ALLOWED_FEATURES,
+ "wasm32" | "wasm64" => WASM_ALLOWED_FEATURES,
+ "bpf" => BPF_ALLOWED_FEATURES,
+ "csky" => CSKY_ALLOWED_FEATURES,
+ "loongarch64" => LOONGARCH_ALLOWED_FEATURES,
+ _ => &[],
+ }
+ }
+
+ pub fn tied_target_features(&self) -> &'static [&'static [&'static str]] {
+ match &*self.arch {
+ "aarch64" => AARCH64_TIED_FEATURES,
+ _ => &[],
+ }
+ }
+}