mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 00:03:43 +00:00
add C-cmse-nonsecure-entry
ABI
This commit is contained in:
parent
74fd001cda
commit
1ddd67a79a
@ -61,6 +61,9 @@ pub(crate) fn conv_to_call_conv(sess: &Session, c: Conv, default_call_conv: Call
|
|||||||
Conv::CCmseNonSecureCall => {
|
Conv::CCmseNonSecureCall => {
|
||||||
sess.dcx().fatal("C-cmse-nonsecure-call call conv is not yet implemented");
|
sess.dcx().fatal("C-cmse-nonsecure-call call conv is not yet implemented");
|
||||||
}
|
}
|
||||||
|
Conv::CCmseNonSecureEntry => {
|
||||||
|
sess.dcx().fatal("C-cmse-nonsecure-entry call conv is not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
Conv::Msp430Intr | Conv::PtxKernel | Conv::AvrInterrupt | Conv::AvrNonBlockingInterrupt => {
|
Conv::Msp430Intr | Conv::PtxKernel | Conv::AvrInterrupt | Conv::AvrNonBlockingInterrupt => {
|
||||||
unreachable!("tried to use {c:?} call conv which only exists on an unsupported target");
|
unreachable!("tried to use {c:?} call conv which only exists on an unsupported target");
|
||||||
|
@ -422,6 +422,9 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
|
|||||||
if let Conv::RiscvInterrupt { kind } = self.conv {
|
if let Conv::RiscvInterrupt { kind } = self.conv {
|
||||||
func_attrs.push(llvm::CreateAttrStringValue(cx.llcx, "interrupt", kind.as_str()));
|
func_attrs.push(llvm::CreateAttrStringValue(cx.llcx, "interrupt", kind.as_str()));
|
||||||
}
|
}
|
||||||
|
if let Conv::CCmseNonSecureEntry = self.conv {
|
||||||
|
func_attrs.push(llvm::CreateAttrString(cx.llcx, "cmse_nonsecure_entry"))
|
||||||
|
}
|
||||||
attributes::apply_to_llfn(llfn, llvm::AttributePlace::Function, &{ func_attrs });
|
attributes::apply_to_llfn(llfn, llvm::AttributePlace::Function, &{ func_attrs });
|
||||||
|
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
@ -659,9 +662,11 @@ impl<'tcx> AbiBuilderMethods<'tcx> for Builder<'_, '_, 'tcx> {
|
|||||||
impl From<Conv> for llvm::CallConv {
|
impl From<Conv> for llvm::CallConv {
|
||||||
fn from(conv: Conv) -> Self {
|
fn from(conv: Conv) -> Self {
|
||||||
match conv {
|
match conv {
|
||||||
Conv::C | Conv::Rust | Conv::CCmseNonSecureCall | Conv::RiscvInterrupt { .. } => {
|
Conv::C
|
||||||
llvm::CCallConv
|
| Conv::Rust
|
||||||
}
|
| Conv::CCmseNonSecureCall
|
||||||
|
| Conv::CCmseNonSecureEntry
|
||||||
|
| Conv::RiscvInterrupt { .. } => llvm::CCallConv,
|
||||||
Conv::Cold => llvm::ColdCallConv,
|
Conv::Cold => llvm::ColdCallConv,
|
||||||
Conv::PreserveMost => llvm::PreserveMost,
|
Conv::PreserveMost => llvm::PreserveMost,
|
||||||
Conv::PreserveAll => llvm::PreserveAll,
|
Conv::PreserveAll => llvm::PreserveAll,
|
||||||
|
@ -1191,6 +1191,7 @@ pub fn fn_can_unwind(tcx: TyCtxt<'_>, fn_def_id: Option<DefId>, abi: SpecAbi) ->
|
|||||||
| RiscvInterruptM
|
| RiscvInterruptM
|
||||||
| RiscvInterruptS
|
| RiscvInterruptS
|
||||||
| CCmseNonSecureCall
|
| CCmseNonSecureCall
|
||||||
|
| CCmseNonSecureEntry
|
||||||
| Unadjusted => false,
|
| Unadjusted => false,
|
||||||
Rust | RustCall | RustCold | RustIntrinsic => {
|
Rust | RustCall | RustCold | RustIntrinsic => {
|
||||||
tcx.sess.panic_strategy() == PanicStrategy::Unwind
|
tcx.sess.panic_strategy() == PanicStrategy::Unwind
|
||||||
|
@ -470,6 +470,7 @@ impl RustcInternal for Abi {
|
|||||||
Abi::AvrInterrupt => rustc_target::spec::abi::Abi::AvrInterrupt,
|
Abi::AvrInterrupt => rustc_target::spec::abi::Abi::AvrInterrupt,
|
||||||
Abi::AvrNonBlockingInterrupt => rustc_target::spec::abi::Abi::AvrNonBlockingInterrupt,
|
Abi::AvrNonBlockingInterrupt => rustc_target::spec::abi::Abi::AvrNonBlockingInterrupt,
|
||||||
Abi::CCmseNonSecureCall => rustc_target::spec::abi::Abi::CCmseNonSecureCall,
|
Abi::CCmseNonSecureCall => rustc_target::spec::abi::Abi::CCmseNonSecureCall,
|
||||||
|
Abi::CCmseNonSecureEntry => rustc_target::spec::abi::Abi::CCmseNonSecureEntry,
|
||||||
Abi::System { unwind } => rustc_target::spec::abi::Abi::System { unwind },
|
Abi::System { unwind } => rustc_target::spec::abi::Abi::System { unwind },
|
||||||
Abi::RustIntrinsic => rustc_target::spec::abi::Abi::RustIntrinsic,
|
Abi::RustIntrinsic => rustc_target::spec::abi::Abi::RustIntrinsic,
|
||||||
Abi::RustCall => rustc_target::spec::abi::Abi::RustCall,
|
Abi::RustCall => rustc_target::spec::abi::Abi::RustCall,
|
||||||
|
@ -105,6 +105,7 @@ impl<'tcx> Stable<'tcx> for rustc_target::abi::call::Conv {
|
|||||||
Conv::PreserveAll => CallConvention::PreserveAll,
|
Conv::PreserveAll => CallConvention::PreserveAll,
|
||||||
Conv::ArmAapcs => CallConvention::ArmAapcs,
|
Conv::ArmAapcs => CallConvention::ArmAapcs,
|
||||||
Conv::CCmseNonSecureCall => CallConvention::CCmseNonSecureCall,
|
Conv::CCmseNonSecureCall => CallConvention::CCmseNonSecureCall,
|
||||||
|
Conv::CCmseNonSecureEntry => CallConvention::CCmseNonSecureEntry,
|
||||||
Conv::Msp430Intr => CallConvention::Msp430Intr,
|
Conv::Msp430Intr => CallConvention::Msp430Intr,
|
||||||
Conv::PtxKernel => CallConvention::PtxKernel,
|
Conv::PtxKernel => CallConvention::PtxKernel,
|
||||||
Conv::X86Fastcall => CallConvention::X86Fastcall,
|
Conv::X86Fastcall => CallConvention::X86Fastcall,
|
||||||
|
@ -910,6 +910,7 @@ impl<'tcx> Stable<'tcx> for rustc_target::spec::abi::Abi {
|
|||||||
abi::Abi::AvrInterrupt => Abi::AvrInterrupt,
|
abi::Abi::AvrInterrupt => Abi::AvrInterrupt,
|
||||||
abi::Abi::AvrNonBlockingInterrupt => Abi::AvrNonBlockingInterrupt,
|
abi::Abi::AvrNonBlockingInterrupt => Abi::AvrNonBlockingInterrupt,
|
||||||
abi::Abi::CCmseNonSecureCall => Abi::CCmseNonSecureCall,
|
abi::Abi::CCmseNonSecureCall => Abi::CCmseNonSecureCall,
|
||||||
|
abi::Abi::CCmseNonSecureEntry => Abi::CCmseNonSecureEntry,
|
||||||
abi::Abi::System { unwind } => Abi::System { unwind },
|
abi::Abi::System { unwind } => Abi::System { unwind },
|
||||||
abi::Abi::RustIntrinsic => Abi::RustIntrinsic,
|
abi::Abi::RustIntrinsic => Abi::RustIntrinsic,
|
||||||
abi::Abi::RustCall => Abi::RustCall,
|
abi::Abi::RustCall => Abi::RustCall,
|
||||||
|
@ -779,6 +779,7 @@ pub enum Conv {
|
|||||||
// Target-specific calling conventions.
|
// Target-specific calling conventions.
|
||||||
ArmAapcs,
|
ArmAapcs,
|
||||||
CCmseNonSecureCall,
|
CCmseNonSecureCall,
|
||||||
|
CCmseNonSecureEntry,
|
||||||
|
|
||||||
Msp430Intr,
|
Msp430Intr,
|
||||||
|
|
||||||
@ -972,6 +973,7 @@ impl FromStr for Conv {
|
|||||||
"RustCold" => Ok(Conv::Rust),
|
"RustCold" => Ok(Conv::Rust),
|
||||||
"ArmAapcs" => Ok(Conv::ArmAapcs),
|
"ArmAapcs" => Ok(Conv::ArmAapcs),
|
||||||
"CCmseNonSecureCall" => Ok(Conv::CCmseNonSecureCall),
|
"CCmseNonSecureCall" => Ok(Conv::CCmseNonSecureCall),
|
||||||
|
"CCmseNonSecureEntry" => Ok(Conv::CCmseNonSecureEntry),
|
||||||
"Msp430Intr" => Ok(Conv::Msp430Intr),
|
"Msp430Intr" => Ok(Conv::Msp430Intr),
|
||||||
"PtxKernel" => Ok(Conv::PtxKernel),
|
"PtxKernel" => Ok(Conv::PtxKernel),
|
||||||
"X86Fastcall" => Ok(Conv::X86Fastcall),
|
"X86Fastcall" => Ok(Conv::X86Fastcall),
|
||||||
|
@ -103,6 +103,7 @@ impl ToJson for crate::abi::call::Conv {
|
|||||||
Self::PreserveAll => "PreserveAll",
|
Self::PreserveAll => "PreserveAll",
|
||||||
Self::ArmAapcs => "ArmAapcs",
|
Self::ArmAapcs => "ArmAapcs",
|
||||||
Self::CCmseNonSecureCall => "CCmseNonSecureCall",
|
Self::CCmseNonSecureCall => "CCmseNonSecureCall",
|
||||||
|
Self::CCmseNonSecureEntry => "CCmseNonSecureEntry",
|
||||||
Self::Msp430Intr => "Msp430Intr",
|
Self::Msp430Intr => "Msp430Intr",
|
||||||
Self::PtxKernel => "PtxKernel",
|
Self::PtxKernel => "PtxKernel",
|
||||||
Self::X86Fastcall => "X86Fastcall",
|
Self::X86Fastcall => "X86Fastcall",
|
||||||
|
@ -48,6 +48,7 @@ pub enum Abi {
|
|||||||
AvrInterrupt,
|
AvrInterrupt,
|
||||||
AvrNonBlockingInterrupt,
|
AvrNonBlockingInterrupt,
|
||||||
CCmseNonSecureCall,
|
CCmseNonSecureCall,
|
||||||
|
CCmseNonSecureEntry,
|
||||||
System {
|
System {
|
||||||
unwind: bool,
|
unwind: bool,
|
||||||
},
|
},
|
||||||
@ -124,6 +125,7 @@ const AbiDatas: &[AbiData] = &[
|
|||||||
AbiData { abi: Abi::AvrInterrupt, name: "avr-interrupt" },
|
AbiData { abi: Abi::AvrInterrupt, name: "avr-interrupt" },
|
||||||
AbiData { abi: Abi::AvrNonBlockingInterrupt, name: "avr-non-blocking-interrupt" },
|
AbiData { abi: Abi::AvrNonBlockingInterrupt, name: "avr-non-blocking-interrupt" },
|
||||||
AbiData { abi: Abi::CCmseNonSecureCall, name: "C-cmse-nonsecure-call" },
|
AbiData { abi: Abi::CCmseNonSecureCall, name: "C-cmse-nonsecure-call" },
|
||||||
|
AbiData { abi: Abi::CCmseNonSecureEntry, name: "C-cmse-nonsecure-entry" },
|
||||||
AbiData { abi: Abi::System { unwind: false }, name: "system" },
|
AbiData { abi: Abi::System { unwind: false }, name: "system" },
|
||||||
AbiData { abi: Abi::System { unwind: true }, name: "system-unwind" },
|
AbiData { abi: Abi::System { unwind: true }, name: "system-unwind" },
|
||||||
AbiData { abi: Abi::RustIntrinsic, name: "rust-intrinsic" },
|
AbiData { abi: Abi::RustIntrinsic, name: "rust-intrinsic" },
|
||||||
@ -244,6 +246,10 @@ pub fn is_stable(name: &str) -> Result<(), AbiDisabled> {
|
|||||||
feature: sym::abi_c_cmse_nonsecure_call,
|
feature: sym::abi_c_cmse_nonsecure_call,
|
||||||
explain: "C-cmse-nonsecure-call ABI is experimental and subject to change",
|
explain: "C-cmse-nonsecure-call ABI is experimental and subject to change",
|
||||||
}),
|
}),
|
||||||
|
"C-cmse-nonsecure-entry" => Err(AbiDisabled::Unstable {
|
||||||
|
feature: sym::cmse_nonsecure_entry,
|
||||||
|
explain: "C-cmse-nonsecure-entry ABI is experimental and subject to change",
|
||||||
|
}),
|
||||||
_ => Err(AbiDisabled::Unrecognized),
|
_ => Err(AbiDisabled::Unrecognized),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -286,15 +292,16 @@ impl Abi {
|
|||||||
AvrInterrupt => 23,
|
AvrInterrupt => 23,
|
||||||
AvrNonBlockingInterrupt => 24,
|
AvrNonBlockingInterrupt => 24,
|
||||||
CCmseNonSecureCall => 25,
|
CCmseNonSecureCall => 25,
|
||||||
|
CCmseNonSecureEntry => 26,
|
||||||
// Cross-platform ABIs
|
// Cross-platform ABIs
|
||||||
System { unwind: false } => 26,
|
System { unwind: false } => 27,
|
||||||
System { unwind: true } => 27,
|
System { unwind: true } => 28,
|
||||||
RustIntrinsic => 28,
|
RustIntrinsic => 29,
|
||||||
RustCall => 29,
|
RustCall => 30,
|
||||||
Unadjusted => 30,
|
Unadjusted => 31,
|
||||||
RustCold => 31,
|
RustCold => 32,
|
||||||
RiscvInterruptM => 32,
|
RiscvInterruptM => 33,
|
||||||
RiscvInterruptS => 33,
|
RiscvInterruptS => 34,
|
||||||
};
|
};
|
||||||
debug_assert!(
|
debug_assert!(
|
||||||
AbiDatas
|
AbiDatas
|
||||||
|
@ -2725,6 +2725,7 @@ impl Target {
|
|||||||
X86Interrupt => ["x86", "x86_64"].contains(&&self.arch[..]),
|
X86Interrupt => ["x86", "x86_64"].contains(&&self.arch[..]),
|
||||||
Aapcs { .. } => "arm" == self.arch,
|
Aapcs { .. } => "arm" == self.arch,
|
||||||
CCmseNonSecureCall => ["arm", "aarch64"].contains(&&self.arch[..]),
|
CCmseNonSecureCall => ["arm", "aarch64"].contains(&&self.arch[..]),
|
||||||
|
CCmseNonSecureEntry => ["arm", "aarch64"].contains(&&self.arch[..]),
|
||||||
Win64 { .. } | SysV64 { .. } => self.arch == "x86_64",
|
Win64 { .. } | SysV64 { .. } => self.arch == "x86_64",
|
||||||
PtxKernel => self.arch == "nvptx64",
|
PtxKernel => self.arch == "nvptx64",
|
||||||
Msp430Interrupt => self.arch == "msp430",
|
Msp430Interrupt => self.arch == "msp430",
|
||||||
|
@ -312,6 +312,7 @@ fn conv_from_spec_abi(tcx: TyCtxt<'_>, abi: SpecAbi, c_variadic: bool) -> Conv {
|
|||||||
SysV64 { .. } => Conv::X86_64SysV,
|
SysV64 { .. } => Conv::X86_64SysV,
|
||||||
Aapcs { .. } => Conv::ArmAapcs,
|
Aapcs { .. } => Conv::ArmAapcs,
|
||||||
CCmseNonSecureCall => Conv::CCmseNonSecureCall,
|
CCmseNonSecureCall => Conv::CCmseNonSecureCall,
|
||||||
|
CCmseNonSecureEntry => Conv::CCmseNonSecureEntry,
|
||||||
PtxKernel => Conv::PtxKernel,
|
PtxKernel => Conv::PtxKernel,
|
||||||
Msp430Interrupt => Conv::Msp430Intr,
|
Msp430Interrupt => Conv::Msp430Intr,
|
||||||
X86Interrupt => Conv::X86Intr,
|
X86Interrupt => Conv::X86Intr,
|
||||||
|
@ -433,6 +433,7 @@ pub enum CallConvention {
|
|||||||
// Target-specific calling conventions.
|
// Target-specific calling conventions.
|
||||||
ArmAapcs,
|
ArmAapcs,
|
||||||
CCmseNonSecureCall,
|
CCmseNonSecureCall,
|
||||||
|
CCmseNonSecureEntry,
|
||||||
|
|
||||||
Msp430Intr,
|
Msp430Intr,
|
||||||
|
|
||||||
|
@ -1062,6 +1062,7 @@ pub enum Abi {
|
|||||||
AvrInterrupt,
|
AvrInterrupt,
|
||||||
AvrNonBlockingInterrupt,
|
AvrNonBlockingInterrupt,
|
||||||
CCmseNonSecureCall,
|
CCmseNonSecureCall,
|
||||||
|
CCmseNonSecureEntry,
|
||||||
System { unwind: bool },
|
System { unwind: bool },
|
||||||
RustIntrinsic,
|
RustIntrinsic,
|
||||||
RustCall,
|
RustCall,
|
||||||
|
@ -377,6 +377,7 @@ pub enum FnAbi {
|
|||||||
AvrNonBlockingInterrupt,
|
AvrNonBlockingInterrupt,
|
||||||
C,
|
C,
|
||||||
CCmseNonsecureCall,
|
CCmseNonsecureCall,
|
||||||
|
CCmseNonsecureEntry,
|
||||||
CDecl,
|
CDecl,
|
||||||
CDeclUnwind,
|
CDeclUnwind,
|
||||||
CUnwind,
|
CUnwind,
|
||||||
@ -434,6 +435,7 @@ impl FnAbi {
|
|||||||
s if *s == sym::avr_dash_interrupt => FnAbi::AvrInterrupt,
|
s if *s == sym::avr_dash_interrupt => FnAbi::AvrInterrupt,
|
||||||
s if *s == sym::avr_dash_non_dash_blocking_dash_interrupt => FnAbi::AvrNonBlockingInterrupt,
|
s if *s == sym::avr_dash_non_dash_blocking_dash_interrupt => FnAbi::AvrNonBlockingInterrupt,
|
||||||
s if *s == sym::C_dash_cmse_dash_nonsecure_dash_call => FnAbi::CCmseNonsecureCall,
|
s if *s == sym::C_dash_cmse_dash_nonsecure_dash_call => FnAbi::CCmseNonsecureCall,
|
||||||
|
s if *s == sym::C_dash_cmse_dash_nonsecure_dash_entry => FnAbi::CCmseNonsecureEntry,
|
||||||
s if *s == sym::C_dash_unwind => FnAbi::CUnwind,
|
s if *s == sym::C_dash_unwind => FnAbi::CUnwind,
|
||||||
s if *s == sym::C => FnAbi::C,
|
s if *s == sym::C => FnAbi::C,
|
||||||
s if *s == sym::cdecl_dash_unwind => FnAbi::CDeclUnwind,
|
s if *s == sym::cdecl_dash_unwind => FnAbi::CDeclUnwind,
|
||||||
@ -477,6 +479,7 @@ impl FnAbi {
|
|||||||
FnAbi::AvrNonBlockingInterrupt => "avr-non-blocking-interrupt",
|
FnAbi::AvrNonBlockingInterrupt => "avr-non-blocking-interrupt",
|
||||||
FnAbi::C => "C",
|
FnAbi::C => "C",
|
||||||
FnAbi::CCmseNonsecureCall => "C-cmse-nonsecure-call",
|
FnAbi::CCmseNonsecureCall => "C-cmse-nonsecure-call",
|
||||||
|
FnAbi::CCmseNonsecureEntry => "C-cmse-nonsecure-entry",
|
||||||
FnAbi::CDecl => "C-decl",
|
FnAbi::CDecl => "C-decl",
|
||||||
FnAbi::CDeclUnwind => "cdecl-unwind",
|
FnAbi::CDeclUnwind => "cdecl-unwind",
|
||||||
FnAbi::CUnwind => "C-unwind",
|
FnAbi::CUnwind => "C-unwind",
|
||||||
|
@ -32,6 +32,7 @@ const SUPPORTED_CALLING_CONVENTIONS: &[&str] = &[
|
|||||||
"riscv-interrupt-m",
|
"riscv-interrupt-m",
|
||||||
"riscv-interrupt-s",
|
"riscv-interrupt-s",
|
||||||
"C-cmse-nonsecure-call",
|
"C-cmse-nonsecure-call",
|
||||||
|
"C-cmse-nonsecure-entry",
|
||||||
"wasm",
|
"wasm",
|
||||||
"system",
|
"system",
|
||||||
"system-unwind",
|
"system-unwind",
|
||||||
|
@ -94,6 +94,7 @@ define_symbols! {
|
|||||||
avr_dash_interrupt = "avr-interrupt",
|
avr_dash_interrupt = "avr-interrupt",
|
||||||
avr_dash_non_dash_blocking_dash_interrupt = "avr-non-blocking-interrupt",
|
avr_dash_non_dash_blocking_dash_interrupt = "avr-non-blocking-interrupt",
|
||||||
C_dash_cmse_dash_nonsecure_dash_call = "C-cmse-nonsecure-call",
|
C_dash_cmse_dash_nonsecure_dash_call = "C-cmse-nonsecure-call",
|
||||||
|
C_dash_cmse_dash_nonsecure_dash_entry = "C-cmse-nonsecure-entry",
|
||||||
C_dash_unwind = "C-unwind",
|
C_dash_unwind = "C-unwind",
|
||||||
cdecl_dash_unwind = "cdecl-unwind",
|
cdecl_dash_unwind = "cdecl-unwind",
|
||||||
fastcall_dash_unwind = "fastcall-unwind",
|
fastcall_dash_unwind = "fastcall-unwind",
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
C
|
C
|
||||||
C-cmse-nonsecure-call
|
C-cmse-nonsecure-call
|
||||||
|
C-cmse-nonsecure-entry
|
||||||
C-unwind
|
C-unwind
|
||||||
Rust
|
Rust
|
||||||
aapcs
|
aapcs
|
||||||
|
Loading…
Reference in New Issue
Block a user