From 093ec70b1e4da3d814a137f5aea6f4ff75ad3399 Mon Sep 17 00:00:00 2001 From: roblabla Date: Thu, 24 Oct 2019 15:29:29 +0000 Subject: Add new EFIAPI ABI Adds a new ABI for the EFIAPI calls. This ABI should reflect the latest version of the UEFI specification at the time of commit (UEFI spec 2.8, URL below). The specification says that for x86_64, we should follow the win64 ABI, while on all other supported platforms (ia32, itanium, arm, arm64 and risc-v), we should follow the C ABI. To simplify the implementation, we will simply follow the C ABI on all platforms except x86_64, even those technically unsupported by the UEFI specification. https://uefi.org/sites/default/files/resources/UEFI_Spec_2_8_final.pdf --- src/test/codegen/abi-efiapi.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/test/codegen/abi-efiapi.rs (limited to 'src/test/codegen') diff --git a/src/test/codegen/abi-efiapi.rs b/src/test/codegen/abi-efiapi.rs new file mode 100644 index 00000000000..471f572375a --- /dev/null +++ b/src/test/codegen/abi-efiapi.rs @@ -0,0 +1,20 @@ +// Checks if the correct annotation for the efiapi ABI is passed to llvm. + +// compile-flags: -C no-prepopulate-passes + +#![crate_type = "lib"] +#![feature(abi_efiapi)] + +// CHECK: define win64 i64 @has_efiapi +#[no_mangle] +#[cfg(target_arch = "x86_64")] +pub extern "efiapi" fn has_efiapi(a: i64) -> i64 { + a * 2 +} + +// CHECK: define c i64 @has_efiapi +#[no_mangle] +#[cfg(not(target_arch = "x86_64"))] +pub extern "efiapi" fn has_efiapi(a: i64) -> i64 { + a * 2 +} -- cgit 1.4.1-3-g733a5