rustc_target: Add efiapi ABI support for LoongArch
This commit adds basic `efiapi` ABI support for LoongArch by recognizing `extern "efiapi"` in the ABI map and inline asm clobber handling, and mapping it to the C calling convention. This change is intentionally submitted ahead of the full LoongArch UEFI target support. While UEFI binaries are ultimately produced as PE images, LoongArch UEFI applications can already be developed by building ELF objects, applying relocation fixups, and converting them to PE in a later step. For such workflows, having `efiapi` properly recognized by the compiler is a prerequisite, even without a dedicated UEFI target. Landing this ABI support early helps unblock LoongArch UEFI application and driver development, and allows the remaining UEFI-specific pieces to be introduced incrementally in follow-up patches. MCP: https://github.com/rust-lang/compiler-team/issues/953
This commit is contained in:
parent
0208ee09be
commit
a07bd236bd
2 changed files with 8 additions and 3 deletions
|
|
@ -997,8 +997,8 @@ impl InlineAsmClobberAbi {
|
|||
_ => Err(&["C", "system"]),
|
||||
},
|
||||
InlineAsmArch::LoongArch32 | InlineAsmArch::LoongArch64 => match name {
|
||||
"C" | "system" => Ok(InlineAsmClobberAbi::LoongArch),
|
||||
_ => Err(&["C", "system"]),
|
||||
"C" | "system" | "efiapi" => Ok(InlineAsmClobberAbi::LoongArch),
|
||||
_ => Err(&["C", "system", "efiapi"]),
|
||||
},
|
||||
InlineAsmArch::PowerPC | InlineAsmArch::PowerPC64 => match name {
|
||||
"C" | "system" => Ok(if target.abi == Abi::Spe {
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ impl AbiMap {
|
|||
ArmVer::Other
|
||||
}),
|
||||
Arch::Avr => ArchKind::Avr,
|
||||
Arch::LoongArch32 | Arch::LoongArch64 => ArchKind::LoongArch,
|
||||
Arch::Msp430 => ArchKind::Msp430,
|
||||
Arch::Nvptx64 => ArchKind::Nvptx,
|
||||
Arch::RiscV32 | Arch::RiscV64 => ArchKind::Riscv,
|
||||
|
|
@ -108,7 +109,10 @@ impl AbiMap {
|
|||
|
||||
(ExternAbi::EfiApi, ArchKind::Arm(..)) => CanonAbi::Arm(ArmCall::Aapcs),
|
||||
(ExternAbi::EfiApi, ArchKind::X86_64) => CanonAbi::X86(X86Call::Win64),
|
||||
(ExternAbi::EfiApi, ArchKind::Aarch64 | ArchKind::Riscv | ArchKind::X86) => CanonAbi::C,
|
||||
(
|
||||
ExternAbi::EfiApi,
|
||||
ArchKind::Aarch64 | ArchKind::LoongArch | ArchKind::Riscv | ArchKind::X86,
|
||||
) => CanonAbi::C,
|
||||
(ExternAbi::EfiApi, _) => return AbiMapping::Invalid,
|
||||
|
||||
/* arm */
|
||||
|
|
@ -196,6 +200,7 @@ enum ArchKind {
|
|||
Amdgpu,
|
||||
Arm(ArmVer),
|
||||
Avr,
|
||||
LoongArch,
|
||||
Msp430,
|
||||
Nvptx,
|
||||
Riscv,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue