rust/src/test/codegen/abi-efiapi.rs
roblabla 093ec70b1e 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
2019-10-25 13:01:25 +00:00

20 lines
461 B
Rust

// 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
}