summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_target
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /compiler/rustc_target
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_target')
-rw-r--r--compiler/rustc_target/Cargo.toml1
-rw-r--r--compiler/rustc_target/src/abi/call/avr.rs2
-rw-r--r--compiler/rustc_target/src/abi/call/mod.rs10
-rw-r--r--compiler/rustc_target/src/abi/mod.rs15
-rw-r--r--compiler/rustc_target/src/asm/loongarch.rs130
-rw-r--r--compiler/rustc_target/src/asm/mod.rs46
-rw-r--r--compiler/rustc_target/src/spec/aarch64_apple_darwin.rs2
-rw-r--r--compiler/rustc_target/src/spec/aarch64_apple_ios_macabi.rs2
-rw-r--r--compiler/rustc_target/src/spec/aarch64_unknown_linux_musl.rs7
-rw-r--r--compiler/rustc_target/src/spec/abi.rs53
-rw-r--r--compiler/rustc_target/src/spec/apple_base.rs63
-rw-r--r--compiler/rustc_target/src/spec/armebv7r_none_eabi.rs2
-rw-r--r--compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs2
-rw-r--r--compiler/rustc_target/src/spec/armv7_sony_vita_newlibeabihf.rs4
-rw-r--r--compiler/rustc_target/src/spec/armv7r_none_eabi.rs2
-rw-r--r--compiler/rustc_target/src/spec/armv7r_none_eabihf.rs2
-rw-r--r--compiler/rustc_target/src/spec/m68k_unknown_linux_gnu.rs1
-rw-r--r--compiler/rustc_target/src/spec/mod.rs8
-rw-r--r--compiler/rustc_target/src/spec/thumb_base.rs2
-rw-r--r--compiler/rustc_target/src/spec/x86_64_apple_ios_macabi.rs2
-rw-r--r--compiler/rustc_target/src/spec/x86_64h_apple_darwin.rs44
21 files changed, 321 insertions, 79 deletions
diff --git a/compiler/rustc_target/Cargo.toml b/compiler/rustc_target/Cargo.toml
index 4e7a8d166..dff22fad4 100644
--- a/compiler/rustc_target/Cargo.toml
+++ b/compiler/rustc_target/Cargo.toml
@@ -11,7 +11,6 @@ rustc_fs_util = { path = "../rustc_fs_util" }
rustc_abi = { path = "../rustc_abi" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_feature = { path = "../rustc_feature" }
-rustc_index = { path = "../rustc_index" }
rustc_macros = { path = "../rustc_macros" }
rustc_serialize = { path = "../rustc_serialize" }
rustc_span = { path = "../rustc_span" }
diff --git a/compiler/rustc_target/src/abi/call/avr.rs b/compiler/rustc_target/src/abi/call/avr.rs
index e20f01355..b01dac8c7 100644
--- a/compiler/rustc_target/src/abi/call/avr.rs
+++ b/compiler/rustc_target/src/abi/call/avr.rs
@@ -10,7 +10,7 @@
//! > self-consistent and sensible LLVM IR generation, but does not
//! > conform to any particular ABI.
//! >
-//! > - Doxygen Doxumentation of `clang::DefaultABIInfo`
+//! > - Doxygen Documentation of `clang::DefaultABIInfo`
//!
//! This calling convention may not match AVR-GCC in all cases.
//!
diff --git a/compiler/rustc_target/src/abi/call/mod.rs b/compiler/rustc_target/src/abi/call/mod.rs
index 57011aa8a..1ae11f567 100644
--- a/compiler/rustc_target/src/abi/call/mod.rs
+++ b/compiler/rustc_target/src/abi/call/mod.rs
@@ -28,7 +28,7 @@ mod x86;
mod x86_64;
mod x86_win64;
-#[derive(PartialEq, Eq, Hash, Debug, HashStable_Generic)]
+#[derive(Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
pub enum PassMode {
/// Ignore the argument.
///
@@ -65,7 +65,7 @@ mod attr_impl {
// The subset of llvm::Attribute needed for arguments, packed into a bitfield.
bitflags::bitflags! {
#[derive(Default, HashStable_Generic)]
- pub struct ArgAttribute: u16 {
+ pub struct ArgAttribute: u8 {
const NoAlias = 1 << 1;
const NoCapture = 1 << 2;
const NonNull = 1 << 3;
@@ -211,7 +211,7 @@ impl Uniform {
}
}
-#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
+#[derive(Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
pub struct CastTarget {
pub prefix: [Option<Reg>; 8],
pub rest: Uniform,
@@ -458,7 +458,7 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
/// Information about how to pass an argument to,
/// or return a value from, a function, under some ABI.
-#[derive(PartialEq, Eq, Hash, Debug, HashStable_Generic)]
+#[derive(Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
pub struct ArgAbi<'a, Ty> {
pub layout: TyAndLayout<'a, Ty>,
pub mode: PassMode,
@@ -605,7 +605,7 @@ pub enum Conv {
///
/// I will do my best to describe this structure, but these
/// comments are reverse-engineered and may be inaccurate. -NDM
-#[derive(PartialEq, Eq, Hash, Debug, HashStable_Generic)]
+#[derive(Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
pub struct FnAbi<'a, Ty> {
/// The LLVM types of each argument.
pub args: Box<[ArgAbi<'a, Ty>]>,
diff --git a/compiler/rustc_target/src/abi/mod.rs b/compiler/rustc_target/src/abi/mod.rs
index 8d2e92cc7..589cd3cf9 100644
--- a/compiler/rustc_target/src/abi/mod.rs
+++ b/compiler/rustc_target/src/abi/mod.rs
@@ -124,6 +124,21 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
{
Ty::is_unit(self)
}
+
+ pub fn offset_of_subfield<C>(self, cx: &C, indices: impl Iterator<Item = usize>) -> Size
+ where
+ Ty: TyAbiInterface<'a, C>,
+ {
+ let mut layout = self;
+ let mut offset = Size::ZERO;
+
+ for index in indices {
+ offset += layout.fields.offset(index);
+ layout = layout.field(cx, index);
+ }
+
+ offset
+ }
}
impl<'a, Ty> TyAndLayout<'a, Ty> {
diff --git a/compiler/rustc_target/src/asm/loongarch.rs b/compiler/rustc_target/src/asm/loongarch.rs
new file mode 100644
index 000000000..9d1a4f3ee
--- /dev/null
+++ b/compiler/rustc_target/src/asm/loongarch.rs
@@ -0,0 +1,130 @@
+use super::{InlineAsmArch, InlineAsmType};
+use rustc_macros::HashStable_Generic;
+use rustc_span::Symbol;
+use std::fmt;
+
+def_reg_class! {
+ LoongArch LoongArchInlineAsmRegClass {
+ reg,
+ freg,
+ }
+}
+
+impl LoongArchInlineAsmRegClass {
+ pub fn valid_modifiers(self, _arch: super::InlineAsmArch) -> &'static [char] {
+ &[]
+ }
+
+ pub fn suggest_class(self, _arch: InlineAsmArch, _ty: InlineAsmType) -> Option<Self> {
+ None
+ }
+
+ pub fn suggest_modifier(
+ self,
+ _arch: InlineAsmArch,
+ _ty: InlineAsmType,
+ ) -> Option<(char, &'static str)> {
+ None
+ }
+
+ pub fn default_modifier(self, _arch: InlineAsmArch) -> Option<(char, &'static str)> {
+ None
+ }
+
+ pub fn supported_types(
+ self,
+ _arch: InlineAsmArch,
+ ) -> &'static [(InlineAsmType, Option<Symbol>)] {
+ match self {
+ Self::reg => types! { _: I8, I16, I32, I64, F32, F64; },
+ Self::freg => types! { _: F32, F64; },
+ }
+ }
+}
+
+// The reserved registers are taken from <https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/LoongArch/LoongArchRegisterInfo.cpp#79>
+def_regs! {
+ LoongArch LoongArchInlineAsmReg LoongArchInlineAsmRegClass {
+ r1: reg = ["$r1","$ra"],
+ r4: reg = ["$r4","$a0"],
+ r5: reg = ["$r5","$a1"],
+ r6: reg = ["$r6","$a2"],
+ r7: reg = ["$r7","$a3"],
+ r8: reg = ["$r8","$a4"],
+ r9: reg = ["$r9","$a5"],
+ r10: reg = ["$r10","$a6"],
+ r11: reg = ["$r11","$a7"],
+ r12: reg = ["$r12","$t0"],
+ r13: reg = ["$r13","$t1"],
+ r14: reg = ["$r14","$t2"],
+ r15: reg = ["$r15","$t3"],
+ r16: reg = ["$r16","$t4"],
+ r17: reg = ["$r17","$t5"],
+ r18: reg = ["$r18","$t6"],
+ r19: reg = ["$r19","$t7"],
+ r20: reg = ["$r20","$t8"],
+ r23: reg = ["$r23","$s0"],
+ r24: reg = ["$r24","$s1"],
+ r25: reg = ["$r25","$s2"],
+ r26: reg = ["$r26","$s3"],
+ r27: reg = ["$r27","$s4"],
+ r28: reg = ["$r28","$s5"],
+ r29: reg = ["$r29","$s6"],
+ r30: reg = ["$r30","$s7"],
+ f0: freg = ["$f0","$fa0"],
+ f1: freg = ["$f1","$fa1"],
+ f2: freg = ["$f2","$fa2"],
+ f3: freg = ["$f3","$fa3"],
+ f4: freg = ["$f4","$fa4"],
+ f5: freg = ["$f5","$fa5"],
+ f6: freg = ["$f6","$fa6"],
+ f7: freg = ["$f7","$fa7"],
+ f8: freg = ["$f8","$ft0"],
+ f9: freg = ["$f9","$ft1"],
+ f10: freg = ["$f10","$ft2"],
+ f11: freg = ["$f11","$ft3"],
+ f12: freg = ["$f12","$ft4"],
+ f13: freg = ["$f13","$ft5"],
+ f14: freg = ["$f14","$ft6"],
+ f15: freg = ["$f15","$ft7"],
+ f16: freg = ["$f16","$ft8"],
+ f17: freg = ["$f17","$ft9"],
+ f18: freg = ["$f18","$ft10"],
+ f19: freg = ["$f19","$ft11"],
+ f20: freg = ["$f20","$ft12"],
+ f21: freg = ["$f21","$ft13"],
+ f22: freg = ["$f22","$ft14"],
+ f23: freg = ["$f23","$ft15"],
+ f24: freg = ["$f24","$fs0"],
+ f25: freg = ["$f25","$fs1"],
+ f26: freg = ["$f26","$fs2"],
+ f27: freg = ["$f27","$fs3"],
+ f28: freg = ["$f28","$fs4"],
+ f29: freg = ["$f29","$fs5"],
+ f30: freg = ["$f30","$fs6"],
+ f31: freg = ["$f31","$fs7"],
+ #error = ["$r0","$zero"] =>
+ "constant zero cannot be used as an operand for inline asm",
+ #error = ["$r2","$tp"] =>
+ "reserved for TLS",
+ #error = ["$r3","$sp"] =>
+ "the stack pointer cannot be used as an operand for inline asm",
+ #error = ["$r21"] =>
+ "reserved by the ABI",
+ #error = ["$r22","$fp"] =>
+ "the frame pointer cannot be used as an operand for inline asm",
+ #error = ["$r31","$s8"] =>
+ "$r31 is used internally by LLVM and cannot be used as an operand for inline asm",
+ }
+}
+
+impl LoongArchInlineAsmReg {
+ pub fn emit(
+ self,
+ out: &mut dyn fmt::Write,
+ _arch: InlineAsmArch,
+ _modifier: Option<char>,
+ ) -> fmt::Result {
+ out.write_str(self.name())
+ }
+}
diff --git a/compiler/rustc_target/src/asm/mod.rs b/compiler/rustc_target/src/asm/mod.rs
index 3f9c850b3..e60b8e78e 100644
--- a/compiler/rustc_target/src/asm/mod.rs
+++ b/compiler/rustc_target/src/asm/mod.rs
@@ -168,6 +168,7 @@ mod arm;
mod avr;
mod bpf;
mod hexagon;
+mod loongarch;
mod m68k;
mod mips;
mod msp430;
@@ -184,6 +185,7 @@ pub use arm::{ArmInlineAsmReg, ArmInlineAsmRegClass};
pub use avr::{AvrInlineAsmReg, AvrInlineAsmRegClass};
pub use bpf::{BpfInlineAsmReg, BpfInlineAsmRegClass};
pub use hexagon::{HexagonInlineAsmReg, HexagonInlineAsmRegClass};
+pub use loongarch::{LoongArchInlineAsmReg, LoongArchInlineAsmRegClass};
pub use m68k::{M68kInlineAsmReg, M68kInlineAsmRegClass};
pub use mips::{MipsInlineAsmReg, MipsInlineAsmRegClass};
pub use msp430::{Msp430InlineAsmReg, Msp430InlineAsmRegClass};
@@ -205,6 +207,7 @@ pub enum InlineAsmArch {
RiscV64,
Nvptx64,
Hexagon,
+ LoongArch64,
Mips,
Mips64,
PowerPC,
@@ -234,6 +237,7 @@ impl FromStr for InlineAsmArch {
"powerpc" => Ok(Self::PowerPC),
"powerpc64" => Ok(Self::PowerPC64),
"hexagon" => Ok(Self::Hexagon),
+ "loongarch64" => Ok(Self::LoongArch64),
"mips" => Ok(Self::Mips),
"mips64" => Ok(Self::Mips64),
"s390x" => Ok(Self::S390x),
@@ -259,6 +263,7 @@ pub enum InlineAsmReg {
Nvptx(NvptxInlineAsmReg),
PowerPC(PowerPCInlineAsmReg),
Hexagon(HexagonInlineAsmReg),
+ LoongArch(LoongArchInlineAsmReg),
Mips(MipsInlineAsmReg),
S390x(S390xInlineAsmReg),
SpirV(SpirVInlineAsmReg),
@@ -280,6 +285,7 @@ impl InlineAsmReg {
Self::RiscV(r) => r.name(),
Self::PowerPC(r) => r.name(),
Self::Hexagon(r) => r.name(),
+ Self::LoongArch(r) => r.name(),
Self::Mips(r) => r.name(),
Self::S390x(r) => r.name(),
Self::Bpf(r) => r.name(),
@@ -298,6 +304,7 @@ impl InlineAsmReg {
Self::RiscV(r) => InlineAsmRegClass::RiscV(r.reg_class()),
Self::PowerPC(r) => InlineAsmRegClass::PowerPC(r.reg_class()),
Self::Hexagon(r) => InlineAsmRegClass::Hexagon(r.reg_class()),
+ Self::LoongArch(r) => InlineAsmRegClass::LoongArch(r.reg_class()),
Self::Mips(r) => InlineAsmRegClass::Mips(r.reg_class()),
Self::S390x(r) => InlineAsmRegClass::S390x(r.reg_class()),
Self::Bpf(r) => InlineAsmRegClass::Bpf(r.reg_class()),
@@ -324,6 +331,7 @@ impl InlineAsmReg {
Self::PowerPC(PowerPCInlineAsmReg::parse(name)?)
}
InlineAsmArch::Hexagon => Self::Hexagon(HexagonInlineAsmReg::parse(name)?),
+ InlineAsmArch::LoongArch64 => Self::LoongArch(LoongArchInlineAsmReg::parse(name)?),
InlineAsmArch::Mips | InlineAsmArch::Mips64 => {
Self::Mips(MipsInlineAsmReg::parse(name)?)
}
@@ -354,6 +362,9 @@ impl InlineAsmReg {
Self::RiscV(r) => r.validate(arch, reloc_model, target_features, target, is_clobber),
Self::PowerPC(r) => r.validate(arch, reloc_model, target_features, target, is_clobber),
Self::Hexagon(r) => r.validate(arch, reloc_model, target_features, target, is_clobber),
+ Self::LoongArch(r) => {
+ r.validate(arch, reloc_model, target_features, target, is_clobber)
+ }
Self::Mips(r) => r.validate(arch, reloc_model, target_features, target, is_clobber),
Self::S390x(r) => r.validate(arch, reloc_model, target_features, target, is_clobber),
Self::Bpf(r) => r.validate(arch, reloc_model, target_features, target, is_clobber),
@@ -379,6 +390,7 @@ impl InlineAsmReg {
Self::RiscV(r) => r.emit(out, arch, modifier),
Self::PowerPC(r) => r.emit(out, arch, modifier),
Self::Hexagon(r) => r.emit(out, arch, modifier),
+ Self::LoongArch(r) => r.emit(out, arch, modifier),
Self::Mips(r) => r.emit(out, arch, modifier),
Self::S390x(r) => r.emit(out, arch, modifier),
Self::Bpf(r) => r.emit(out, arch, modifier),
@@ -397,6 +409,7 @@ impl InlineAsmReg {
Self::RiscV(_) => cb(self),
Self::PowerPC(r) => r.overlapping_regs(|r| cb(Self::PowerPC(r))),
Self::Hexagon(r) => r.overlapping_regs(|r| cb(Self::Hexagon(r))),
+ Self::LoongArch(_) => cb(self),
Self::Mips(_) => cb(self),
Self::S390x(_) => cb(self),
Self::Bpf(r) => r.overlapping_regs(|r| cb(Self::Bpf(r))),
@@ -418,6 +431,7 @@ pub enum InlineAsmRegClass {
Nvptx(NvptxInlineAsmRegClass),
PowerPC(PowerPCInlineAsmRegClass),
Hexagon(HexagonInlineAsmRegClass),
+ LoongArch(LoongArchInlineAsmRegClass),
Mips(MipsInlineAsmRegClass),
S390x(S390xInlineAsmRegClass),
SpirV(SpirVInlineAsmRegClass),
@@ -440,6 +454,7 @@ impl InlineAsmRegClass {
Self::Nvptx(r) => r.name(),
Self::PowerPC(r) => r.name(),
Self::Hexagon(r) => r.name(),
+ Self::LoongArch(r) => r.name(),
Self::Mips(r) => r.name(),
Self::S390x(r) => r.name(),
Self::SpirV(r) => r.name(),
@@ -464,6 +479,7 @@ impl InlineAsmRegClass {
Self::Nvptx(r) => r.suggest_class(arch, ty).map(InlineAsmRegClass::Nvptx),
Self::PowerPC(r) => r.suggest_class(arch, ty).map(InlineAsmRegClass::PowerPC),
Self::Hexagon(r) => r.suggest_class(arch, ty).map(InlineAsmRegClass::Hexagon),
+ Self::LoongArch(r) => r.suggest_class(arch, ty).map(InlineAsmRegClass::LoongArch),
Self::Mips(r) => r.suggest_class(arch, ty).map(InlineAsmRegClass::Mips),
Self::S390x(r) => r.suggest_class(arch, ty).map(InlineAsmRegClass::S390x),
Self::SpirV(r) => r.suggest_class(arch, ty).map(InlineAsmRegClass::SpirV),
@@ -495,6 +511,7 @@ impl InlineAsmRegClass {
Self::Nvptx(r) => r.suggest_modifier(arch, ty),
Self::PowerPC(r) => r.suggest_modifier(arch, ty),
Self::Hexagon(r) => r.suggest_modifier(arch, ty),
+ Self::LoongArch(r) => r.suggest_modifier(arch, ty),
Self::Mips(r) => r.suggest_modifier(arch, ty),
Self::S390x(r) => r.suggest_modifier(arch, ty),
Self::SpirV(r) => r.suggest_modifier(arch, ty),
@@ -522,6 +539,7 @@ impl InlineAsmRegClass {
Self::Nvptx(r) => r.default_modifier(arch),
Self::PowerPC(r) => r.default_modifier(arch),
Self::Hexagon(r) => r.default_modifier(arch),
+ Self::LoongArch(r) => r.default_modifier(arch),
Self::Mips(r) => r.default_modifier(arch),
Self::S390x(r) => r.default_modifier(arch),
Self::SpirV(r) => r.default_modifier(arch),
@@ -548,6 +566,7 @@ impl InlineAsmRegClass {
Self::Nvptx(r) => r.supported_types(arch),
Self::PowerPC(r) => r.supported_types(arch),
Self::Hexagon(r) => r.supported_types(arch),
+ Self::LoongArch(r) => r.supported_types(arch),
Self::Mips(r) => r.supported_types(arch),
Self::S390x(r) => r.supported_types(arch),
Self::SpirV(r) => r.supported_types(arch),
@@ -575,6 +594,7 @@ impl InlineAsmRegClass {
Self::PowerPC(PowerPCInlineAsmRegClass::parse(name)?)
}
InlineAsmArch::Hexagon => Self::Hexagon(HexagonInlineAsmRegClass::parse(name)?),
+ InlineAsmArch::LoongArch64 => Self::LoongArch(LoongArchInlineAsmRegClass::parse(name)?),
InlineAsmArch::Mips | InlineAsmArch::Mips64 => {
Self::Mips(MipsInlineAsmRegClass::parse(name)?)
}
@@ -601,6 +621,7 @@ impl InlineAsmRegClass {
Self::Nvptx(r) => r.valid_modifiers(arch),
Self::PowerPC(r) => r.valid_modifiers(arch),
Self::Hexagon(r) => r.valid_modifiers(arch),
+ Self::LoongArch(r) => r.valid_modifiers(arch),
Self::Mips(r) => r.valid_modifiers(arch),
Self::S390x(r) => r.valid_modifiers(arch),
Self::SpirV(r) => r.valid_modifiers(arch),
@@ -760,6 +781,11 @@ pub fn allocatable_registers(
hexagon::fill_reg_map(arch, reloc_model, target_features, target, &mut map);
map
}
+ InlineAsmArch::LoongArch64 => {
+ let mut map = loongarch::regclass_map();
+ loongarch::fill_reg_map(arch, reloc_model, target_features, target, &mut map);
+ map
+ }
InlineAsmArch::Mips | InlineAsmArch::Mips64 => {
let mut map = mips::regclass_map();
mips::fill_reg_map(arch, reloc_model, target_features, target, &mut map);
@@ -813,6 +839,7 @@ pub enum InlineAsmClobberAbi {
AArch64,
AArch64NoX18,
RiscV,
+ LoongArch,
}
impl InlineAsmClobberAbi {
@@ -854,6 +881,10 @@ impl InlineAsmClobberAbi {
"C" | "system" | "efiapi" => Ok(InlineAsmClobberAbi::RiscV),
_ => Err(&["C", "system", "efiapi"]),
},
+ InlineAsmArch::LoongArch64 => match name {
+ "C" | "system" => Ok(InlineAsmClobberAbi::LoongArch),
+ _ => Err(&["C", "system"]),
+ },
_ => Err(&[]),
}
}
@@ -996,6 +1027,21 @@ impl InlineAsmClobberAbi {
v24, v25, v26, v27, v28, v29, v30, v31,
}
},
+ InlineAsmClobberAbi::LoongArch => clobbered_regs! {
+ LoongArch LoongArchInlineAsmReg {
+ // ra
+ r1,
+ // a0-a7
+ r4, r5, r6, r7, r8, r9, r10, r11,
+ // t0-t8
+ r12, r13, r14, r15, r16, r17, r18, r19, r20,
+ // fa0-fa7
+ f0, f1, f2, f3, f4, f5, f6, f7,
+ // ft0-ft15
+ f8, f9, f10, f11, f12, f13, f14, f15,
+ f16, f17, f18, f19, f20, f21, f22, f23,
+ }
+ },
}
}
}
diff --git a/compiler/rustc_target/src/spec/aarch64_apple_darwin.rs b/compiler/rustc_target/src/spec/aarch64_apple_darwin.rs
index b69ade7e4..9ac732351 100644
--- a/compiler/rustc_target/src/spec/aarch64_apple_darwin.rs
+++ b/compiler/rustc_target/src/spec/aarch64_apple_darwin.rs
@@ -4,7 +4,7 @@ use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
pub fn target() -> Target {
let arch = Arch::Arm64;
let mut base = opts("macos", arch);
- base.cpu = "apple-a14".into();
+ base.cpu = "apple-m1".into();
base.max_atomic_width = Some(128);
// FIXME: The leak sanitizer currently fails the tests, see #88132.
diff --git a/compiler/rustc_target/src/spec/aarch64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/aarch64_apple_ios_macabi.rs
index 2b135b670..e2df7e0bd 100644
--- a/compiler/rustc_target/src/spec/aarch64_apple_ios_macabi.rs
+++ b/compiler/rustc_target/src/spec/aarch64_apple_ios_macabi.rs
@@ -2,7 +2,7 @@ use super::apple_base::{opts, Arch};
use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, Target, TargetOptions};
pub fn target() -> Target {
- let llvm_target = "arm64-apple-ios-macabi";
+ let llvm_target = "arm64-apple-ios14.0-macabi";
let arch = Arch::Arm64_macabi;
let mut base = opts("ios", arch);
diff --git a/compiler/rustc_target/src/spec/aarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/aarch64_unknown_linux_musl.rs
index d0c950c2e..523eb6bd2 100644
--- a/compiler/rustc_target/src/spec/aarch64_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/aarch64_unknown_linux_musl.rs
@@ -1,10 +1,15 @@
-use crate::spec::{Target, TargetOptions};
+use crate::spec::{SanitizerSet, Target, TargetOptions};
pub fn target() -> Target {
let mut base = super::linux_musl_base::opts();
base.max_atomic_width = Some(128);
base.supports_xray = true;
base.features = "+v8a".into();
+ base.supported_sanitizers = SanitizerSet::ADDRESS
+ | SanitizerSet::CFI
+ | SanitizerSet::LEAK
+ | SanitizerSet::MEMORY
+ | SanitizerSet::THREAD;
Target {
llvm_target: "aarch64-unknown-linux-musl".into(),
diff --git a/compiler/rustc_target/src/spec/abi.rs b/compiler/rustc_target/src/spec/abi.rs
index 5582d909f..eb3f66ac3 100644
--- a/compiler/rustc_target/src/spec/abi.rs
+++ b/compiler/rustc_target/src/spec/abi.rs
@@ -148,8 +148,9 @@ pub fn is_enabled(
pub fn is_stable(name: &str) -> Result<(), AbiDisabled> {
match name {
// Stable
- "Rust" | "C" | "cdecl" | "stdcall" | "fastcall" | "aapcs" | "win64" | "sysv64"
- | "system" | "efiapi" => Ok(()),
+ "Rust" | "C" | "C-unwind" | "cdecl" | "cdecl-unwind" | "stdcall" | "stdcall-unwind"
+ | "fastcall" | "fastcall-unwind" | "aapcs" | "aapcs-unwind" | "win64" | "win64-unwind"
+ | "sysv64" | "sysv64-unwind" | "system" | "system-unwind" | "efiapi" => Ok(()),
"rust-intrinsic" => Err(AbiDisabled::Unstable {
feature: sym::intrinsics,
explain: "intrinsics are subject to change",
@@ -162,10 +163,18 @@ pub fn is_stable(name: &str) -> Result<(), AbiDisabled> {
feature: sym::abi_vectorcall,
explain: "vectorcall is experimental and subject to change",
}),
+ "vectorcall-unwind" => Err(AbiDisabled::Unstable {
+ feature: sym::abi_vectorcall,
+ explain: "vectorcall-unwind ABI is experimental and subject to change",
+ }),
"thiscall" => Err(AbiDisabled::Unstable {
feature: sym::abi_thiscall,
explain: "thiscall is experimental and subject to change",
}),
+ "thiscall-unwind" => Err(AbiDisabled::Unstable {
+ feature: sym::abi_thiscall,
+ explain: "thiscall-unwind ABI is experimental and subject to change",
+ }),
"rust-call" => Err(AbiDisabled::Unstable {
feature: sym::unboxed_closures,
explain: "rust-call ABI is subject to change",
@@ -202,46 +211,6 @@ pub fn is_stable(name: &str) -> Result<(), AbiDisabled> {
feature: sym::abi_c_cmse_nonsecure_call,
explain: "C-cmse-nonsecure-call ABI is experimental and subject to change",
}),
- "C-unwind" => Err(AbiDisabled::Unstable {
- feature: sym::c_unwind,
- explain: "C-unwind ABI is experimental and subject to change",
- }),
- "stdcall-unwind" => Err(AbiDisabled::Unstable {
- feature: sym::c_unwind,
- explain: "stdcall-unwind ABI is experimental and subject to change",
- }),
- "system-unwind" => Err(AbiDisabled::Unstable {
- feature: sym::c_unwind,
- explain: "system-unwind ABI is experimental and subject to change",
- }),
- "thiscall-unwind" => Err(AbiDisabled::Unstable {
- feature: sym::c_unwind,
- explain: "thiscall-unwind ABI is experimental and subject to change",
- }),
- "cdecl-unwind" => Err(AbiDisabled::Unstable {
- feature: sym::c_unwind,
- explain: "cdecl-unwind ABI is experimental and subject to change",
- }),
- "fastcall-unwind" => Err(AbiDisabled::Unstable {
- feature: sym::c_unwind,
- explain: "fastcall-unwind ABI is experimental and subject to change",
- }),
- "vectorcall-unwind" => Err(AbiDisabled::Unstable {
- feature: sym::c_unwind,
- explain: "vectorcall-unwind ABI is experimental and subject to change",
- }),
- "aapcs-unwind" => Err(AbiDisabled::Unstable {
- feature: sym::c_unwind,
- explain: "aapcs-unwind ABI is experimental and subject to change",
- }),
- "win64-unwind" => Err(AbiDisabled::Unstable {
- feature: sym::c_unwind,
- explain: "win64-unwind ABI is experimental and subject to change",
- }),
- "sysv64-unwind" => Err(AbiDisabled::Unstable {
- feature: sym::c_unwind,
- explain: "sysv64-unwind ABI is experimental and subject to change",
- }),
"wasm" => Err(AbiDisabled::Unstable {
feature: sym::wasm_abi,
explain: "wasm ABI is experimental and subject to change",
diff --git a/compiler/rustc_target/src/spec/apple_base.rs b/compiler/rustc_target/src/spec/apple_base.rs
index 5c6dcc0ab..ff2246318 100644
--- a/compiler/rustc_target/src/spec/apple_base.rs
+++ b/compiler/rustc_target/src/spec/apple_base.rs
@@ -1,7 +1,7 @@
use std::{borrow::Cow, env};
use crate::spec::{cvs, Cc, DebuginfoKind, FramePointer, LinkArgs};
-use crate::spec::{LinkerFlavor, Lld, SplitDebuginfo, StaticCow, TargetOptions};
+use crate::spec::{LinkerFlavor, Lld, SplitDebuginfo, StaticCow, Target, TargetOptions};
#[cfg(test)]
#[path = "apple/tests.rs"]
@@ -19,6 +19,7 @@ pub enum Arch {
I386,
I686,
X86_64,
+ X86_64h,
X86_64_sim,
X86_64_macabi,
Arm64_macabi,
@@ -36,6 +37,7 @@ impl Arch {
I386 => "i386",
I686 => "i686",
X86_64 | X86_64_sim | X86_64_macabi => "x86_64",
+ X86_64h => "x86_64h",
}
}
@@ -44,13 +46,13 @@ impl Arch {
Armv7 | Armv7k | Armv7s => "arm",
Arm64 | Arm64_32 | Arm64_macabi | Arm64_sim => "aarch64",
I386 | I686 => "x86",
- X86_64 | X86_64_sim | X86_64_macabi => "x86_64",
+ X86_64 | X86_64_sim | X86_64_macabi | X86_64h => "x86_64",
})
}
fn target_abi(self) -> &'static str {
match self {
- Armv7 | Armv7k | Armv7s | Arm64 | Arm64_32 | I386 | I686 | X86_64 => "",
+ Armv7 | Armv7k | Armv7s | Arm64 | 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...
@@ -67,6 +69,10 @@ impl Arch {
Arm64_32 => "apple-s4",
I386 | I686 => "yonah",
X86_64 | X86_64_sim => "core2",
+ // Note: `core-avx2` is slightly more advanced than `x86_64h`, see
+ // comments (and disabled features) in `x86_64h_apple_darwin` for
+ // details.
+ X86_64h => "core-avx2",
X86_64_macabi => "core2",
Arm64_macabi => "apple-a12",
Arm64_sim => "apple-a12",
@@ -173,21 +179,43 @@ pub fn opts(os: &'static str, arch: Arch) -> TargetOptions {
}
}
-fn deployment_target(var_name: &str) -> Option<(u32, u32)> {
- let deployment_target = env::var(var_name).ok();
- deployment_target
- .as_ref()
- .and_then(|s| s.split_once('.'))
- .and_then(|(a, b)| a.parse::<u32>().and_then(|a| b.parse::<u32>().map(|b| (a, b))).ok())
+pub fn deployment_target(target: &Target) -> Option<String> {
+ 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 };
+ macos_deployment_target(arch)
+ }
+ "ios" => ios_deployment_target(),
+ "watchos" => watchos_deployment_target(),
+ "tvos" => tvos_deployment_target(),
+ _ => return None,
+ };
+
+ Some(format!("{major}.{minor}"))
+}
+
+fn from_set_deployment_target(var_name: &str) -> Option<(u32, u32)> {
+ let deployment_target = env::var(var_name).ok()?;
+ let (unparsed_major, unparsed_minor) = deployment_target.split_once('.')?;
+ let (major, minor) = (unparsed_major.parse().ok()?, unparsed_minor.parse().ok()?);
+
+ Some((major, minor))
}
fn macos_default_deployment_target(arch: Arch) -> (u32, u32) {
- // Note: Arm64_sim is not included since macOS has no simulator.
- if matches!(arch, Arm64 | Arm64_macabi) { (11, 0) } else { (10, 7) }
+ match arch {
+ // Note: Arm64_sim is not included since macOS has no simulator.
+ Arm64 | Arm64_macabi => (11, 0),
+ // x86_64h-apple-darwin only supports macOS 10.8 and later
+ X86_64h => (10, 8),
+ _ => (10, 7),
+ }
}
fn macos_deployment_target(arch: Arch) -> (u32, u32) {
- deployment_target("MACOSX_DEPLOYMENT_TARGET")
+ // If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
+ from_set_deployment_target("MACOSX_DEPLOYMENT_TARGET")
.unwrap_or_else(|| macos_default_deployment_target(arch))
}
@@ -227,7 +255,7 @@ fn link_env_remove(arch: Arch, os: &'static str) -> StaticCow<[StaticCow<str>]>
// of the linking environment that's wrong and reversed.
match arch {
Armv7 | Armv7k | Armv7s | Arm64 | Arm64_32 | I386 | I686 | X86_64 | X86_64_sim
- | Arm64_sim => {
+ | X86_64h | Arm64_sim => {
cvs!["MACOSX_DEPLOYMENT_TARGET"]
}
X86_64_macabi | Arm64_macabi => cvs!["IPHONEOS_DEPLOYMENT_TARGET"],
@@ -236,7 +264,8 @@ fn link_env_remove(arch: Arch, os: &'static str) -> StaticCow<[StaticCow<str>]>
}
fn ios_deployment_target() -> (u32, u32) {
- deployment_target("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or((7, 0))
+ // If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
+ from_set_deployment_target("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or((7, 0))
}
pub fn ios_llvm_target(arch: Arch) -> String {
@@ -261,7 +290,8 @@ pub fn ios_sim_llvm_target(arch: Arch) -> String {
}
fn tvos_deployment_target() -> (u32, u32) {
- deployment_target("TVOS_DEPLOYMENT_TARGET").unwrap_or((7, 0))
+ // If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
+ from_set_deployment_target("TVOS_DEPLOYMENT_TARGET").unwrap_or((7, 0))
}
fn tvos_lld_platform_version() -> String {
@@ -270,7 +300,8 @@ fn tvos_lld_platform_version() -> String {
}
fn watchos_deployment_target() -> (u32, u32) {
- deployment_target("WATCHOS_DEPLOYMENT_TARGET").unwrap_or((5, 0))
+ // If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
+ from_set_deployment_target("WATCHOS_DEPLOYMENT_TARGET").unwrap_or((5, 0))
}
fn watchos_lld_platform_version() -> String {
diff --git a/compiler/rustc_target/src/spec/armebv7r_none_eabi.rs b/compiler/rustc_target/src/spec/armebv7r_none_eabi.rs
index f6f46aac4..5632bcfce 100644
--- a/compiler/rustc_target/src/spec/armebv7r_none_eabi.rs
+++ b/compiler/rustc_target/src/spec/armebv7r_none_eabi.rs
@@ -16,7 +16,7 @@ pub fn target() -> Target {
linker: Some("rust-lld".into()),
relocation_model: RelocModel::Static,
panic_strategy: PanicStrategy::Abort,
- max_atomic_width: Some(32),
+ max_atomic_width: Some(64),
emit_debug_gdb_scripts: false,
// GCC and Clang default to 8 for arm-none here
c_enum_min_bits: Some(8),
diff --git a/compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs b/compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs
index 9608efe8b..2815de358 100644
--- a/compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs
+++ b/compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs
@@ -17,7 +17,7 @@ pub fn target() -> Target {
relocation_model: RelocModel::Static,
panic_strategy: PanicStrategy::Abort,
features: "+vfp3,-d32,-fp16".into(),
- max_atomic_width: Some(32),
+ max_atomic_width: Some(64),
emit_debug_gdb_scripts: false,
// GCC and Clang default to 8 for arm-none here
c_enum_min_bits: Some(8),
diff --git a/compiler/rustc_target/src/spec/armv7_sony_vita_newlibeabihf.rs b/compiler/rustc_target/src/spec/armv7_sony_vita_newlibeabihf.rs
index ebd2cca25..e2c0808f1 100644
--- a/compiler/rustc_target/src/spec/armv7_sony_vita_newlibeabihf.rs
+++ b/compiler/rustc_target/src/spec/armv7_sony_vita_newlibeabihf.rs
@@ -9,7 +9,7 @@ pub fn target() -> Target {
let pre_link_args = TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-Wl,-q"]);
Target {
- llvm_target: "armv7a-vita-newlibeabihf".into(),
+ llvm_target: "armv7a-vita-eabihf".into(),
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
arch: "arm".into(),
@@ -33,7 +33,7 @@ pub fn target() -> Target {
pre_link_args,
exe_suffix: ".elf".into(),
panic_strategy: PanicStrategy::Abort,
- max_atomic_width: Some(32),
+ max_atomic_width: Some(64),
..Default::default()
},
}
diff --git a/compiler/rustc_target/src/spec/armv7r_none_eabi.rs b/compiler/rustc_target/src/spec/armv7r_none_eabi.rs
index 5225abf44..74905ed5a 100644
--- a/compiler/rustc_target/src/spec/armv7r_none_eabi.rs
+++ b/compiler/rustc_target/src/spec/armv7r_none_eabi.rs
@@ -15,7 +15,7 @@ pub fn target() -> Target {
linker: Some("rust-lld".into()),
relocation_model: RelocModel::Static,
panic_strategy: PanicStrategy::Abort,
- max_atomic_width: Some(32),
+ max_atomic_width: Some(64),
emit_debug_gdb_scripts: false,
// GCC and Clang default to 8 for arm-none here
c_enum_min_bits: Some(8),
diff --git a/compiler/rustc_target/src/spec/armv7r_none_eabihf.rs b/compiler/rustc_target/src/spec/armv7r_none_eabihf.rs
index 9a35e0461..516b3f5c1 100644
--- a/compiler/rustc_target/src/spec/armv7r_none_eabihf.rs
+++ b/compiler/rustc_target/src/spec/armv7r_none_eabihf.rs
@@ -16,7 +16,7 @@ pub fn target() -> Target {
relocation_model: RelocModel::Static,
panic_strategy: PanicStrategy::Abort,
features: "+vfp3,-d32,-fp16".into(),
- max_atomic_width: Some(32),
+ max_atomic_width: Some(64),
emit_debug_gdb_scripts: false,
// GCC and Clang default to 8 for arm-none here
c_enum_min_bits: Some(8),
diff --git a/compiler/rustc_target/src/spec/m68k_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/m68k_unknown_linux_gnu.rs
index ebd74012d..9bcd56bed 100644
--- a/compiler/rustc_target/src/spec/m68k_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/m68k_unknown_linux_gnu.rs
@@ -3,6 +3,7 @@ use crate::spec::{Target, TargetOptions};
pub fn target() -> Target {
let mut base = super::linux_gnu_base::opts();
+ base.cpu = "M68020".into();
base.max_atomic_width = Some(32);
Target {
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index 4e5a821f0..ba4b89c9e 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -60,6 +60,7 @@ pub mod crt_objects;
mod aix_base;
mod android_base;
mod apple_base;
+pub use apple_base::deployment_target as current_apple_deployment_target;
mod avr_gnu_base;
mod bpf_base;
mod dragonfly_base;
@@ -1112,6 +1113,7 @@ supported_targets! {
("aarch64-apple-darwin", aarch64_apple_darwin),
("x86_64-apple-darwin", x86_64_apple_darwin),
+ ("x86_64h-apple-darwin", x86_64h_apple_darwin),
("i686-apple-darwin", i686_apple_darwin),
// FIXME(#106649): Remove aarch64-fuchsia in favor of aarch64-unknown-fuchsia
@@ -2285,13 +2287,13 @@ impl Target {
}
}
} );
- ($key_name:ident, falliable_list) => ( {
+ ($key_name:ident, fallible_list) => ( {
let name = (stringify!($key_name)).replace("_", "-");
obj.remove(&name).and_then(|j| {
if let Some(v) = j.as_array() {
match v.iter().map(|a| FromStr::from_str(a.as_str().unwrap())).collect() {
Ok(l) => { base.$key_name = l },
- // FIXME: `falliable_list` can't re-use the `key!` macro for list
+ // FIXME: `fallible_list` can't re-use the `key!` macro for list
// elements and the error messages from that macro, so it has a bad
// generic message instead
Err(_) => return Some(Err(
@@ -2610,7 +2612,7 @@ impl Target {
key!(has_thumb_interworking, bool);
key!(debuginfo_kind, DebuginfoKind)?;
key!(split_debuginfo, SplitDebuginfo)?;
- key!(supported_split_debuginfo, falliable_list)?;
+ key!(supported_split_debuginfo, fallible_list)?;
key!(supported_sanitizers, SanitizerSet)?;
key!(default_adjusted_cabi, Option<Abi>)?;
key!(generate_arange_section, bool);
diff --git a/compiler/rustc_target/src/spec/thumb_base.rs b/compiler/rustc_target/src/spec/thumb_base.rs
index 4dcf47fe4..2220b9326 100644
--- a/compiler/rustc_target/src/spec/thumb_base.rs
+++ b/compiler/rustc_target/src/spec/thumb_base.rs
@@ -12,7 +12,7 @@
//
// We have opted for these instead of one target per processor (e.g., `cortex-m0`, `cortex-m3`,
// etc) because the differences between some processors like the cortex-m0 and cortex-m1 are almost
-// non-existent from the POV of codegen so it doesn't make sense to have separate targets for them.
+// nonexistent from the POV of codegen so it doesn't make sense to have separate targets for them.
// And if differences exist between two processors under the same target, rustc flags can be used to
// optimize for one processor or the other.
//
diff --git a/compiler/rustc_target/src/spec/x86_64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/x86_64_apple_ios_macabi.rs
index 5a3e2a79b..9f3b0fab6 100644
--- a/compiler/rustc_target/src/spec/x86_64_apple_ios_macabi.rs
+++ b/compiler/rustc_target/src/spec/x86_64_apple_ios_macabi.rs
@@ -2,7 +2,7 @@ use super::apple_base::{opts, Arch};
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
pub fn target() -> Target {
- let llvm_target = "x86_64-apple-ios-macabi";
+ let llvm_target = "x86_64-apple-ios14.0-macabi";
let arch = Arch::X86_64_macabi;
let mut base = opts("ios", arch);
diff --git a/compiler/rustc_target/src/spec/x86_64h_apple_darwin.rs b/compiler/rustc_target/src/spec/x86_64h_apple_darwin.rs
new file mode 100644
index 000000000..54f7490b2
--- /dev/null
+++ b/compiler/rustc_target/src/spec/x86_64h_apple_darwin.rs
@@ -0,0 +1,44 @@
+use super::apple_base::{macos_llvm_target, opts, Arch};
+use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, SanitizerSet};
+use crate::spec::{StackProbeType, Target, TargetOptions};
+
+pub fn target() -> Target {
+ let arch = Arch::X86_64h;
+ let mut base = opts("macos", arch);
+ 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;
+
+ // x86_64h is core2-avx without a few of the features which would otherwise
+ // be guaranteed, so we need to disable those. This imitates clang's logic:
+ // - https://github.com/llvm/llvm-project/blob/bd1f7c417/clang/lib/Driver/ToolChains/Arch/X86.cpp#L77-L78
+ // - https://github.com/llvm/llvm-project/blob/bd1f7c417/clang/lib/Driver/ToolChains/Arch/X86.cpp#L133-L141
+ //
+ // FIXME: Sadly, turning these off here disables them in such a way that they
+ // aren't re-enabled by `-Ctarget-cpu=native` (on a machine that has them).
+ // It would be nice if this were not the case, but fixing it seems tricky
+ // (and given that the main use-case for this target is for use in universal
+ // binaries, probably not that important).
+ base.features = "-rdrnd,-aes,-pclmul,-rtm,-fsgsbase".into();
+ // Double-check that the `cpu` is what we expect (if it's not the list above
+ // may need updating).
+ assert_eq!(
+ base.cpu, "core-avx2",
+ "you need to adjust the feature list in x86_64h-apple-darwin if you change this",
+ );
+
+ 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-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 { mcount: "\u{1}mcount".into(), ..base },
+ }
+}