Skip to content

Commit 42cbb40

Browse files
Use aapcs for efiapi calling convention on arm
On arm, llvm treats the C calling convention as `aapcs` on soft-float targets and `aapcs-vfp` on hard-float targets [1]. UEFI specifies in the arm calling convention that floating point extensions aren't used [2], so always translate `efiapi` to `aapcs` on arm. [1]: rust-lang/compiler-builtins#116 (comment) [2]: https://uefi.org/specs/UEFI/2.10/02_Overview.html#detailed-calling-convention rust-lang#65815
1 parent 7eef946 commit 42cbb40

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

compiler/rustc_target/src/spec/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1915,6 +1915,7 @@ impl Target {
19151915
Abi::Stdcall { unwind }
19161916
}
19171917
Abi::System { unwind } => Abi::C { unwind },
1918+
Abi::EfiApi if self.arch == "arm" => Abi::Aapcs { unwind: false },
19181919
Abi::EfiApi if self.arch == "x86_64" => Abi::Win64 { unwind: false },
19191920
Abi::EfiApi => Abi::C { unwind: false },
19201921

src/test/codegen/abi-efiapi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ trait Copy { }
2727
//x86_64: define win64cc void @has_efiapi
2828
//i686: define void @has_efiapi
2929
//aarch64: define dso_local void @has_efiapi
30-
//arm: define dso_local void @has_efiapi
30+
//arm: define dso_local arm_aapcscc void @has_efiapi
3131
//riscv: define dso_local void @has_efiapi
3232
#[no_mangle]
3333
pub extern "efiapi" fn has_efiapi() {}

0 commit comments

Comments
 (0)