Skip to content

Commit 6173280

Browse files
committed
Fix EFIABI test
Use revisions to run the EFIABI in multiple configurations, compiling for each supported UEFI platform, and checking the ABI generated in the LLVM IR is correct. Use no_core to make it easier to test.
1 parent 093ec70 commit 6173280

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

src/test/codegen/abi-efiapi.rs

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
// Checks if the correct annotation for the efiapi ABI is passed to llvm.
22

3+
// revisions:x86_64 i686 aarch64 arm riscv
4+
5+
//[x86_64] compile-flags: --target x86_64-unknown-uefi
6+
//[i686] compile-flags: --target i686-unknown-linux-musl
7+
//[aarch64] compile-flags: --target aarch64-unknown-none
8+
//[arm] compile-flags: --target armv7r-none-eabi
9+
//[riscv] compile-flags: --target riscv64gc-unknown-none-elf
310
// compile-flags: -C no-prepopulate-passes
411

512
#![crate_type = "lib"]
6-
#![feature(abi_efiapi)]
13+
#![feature(no_core, lang_items, abi_efiapi)]
14+
#![no_core]
715

8-
// CHECK: define win64 i64 @has_efiapi
9-
#[no_mangle]
10-
#[cfg(target_arch = "x86_64")]
11-
pub extern "efiapi" fn has_efiapi(a: i64) -> i64 {
12-
a * 2
13-
}
16+
#[lang="sized"]
17+
trait Sized { }
18+
#[lang="freeze"]
19+
trait Freeze { }
20+
#[lang="copy"]
21+
trait Copy { }
1422

15-
// CHECK: define c i64 @has_efiapi
23+
//x86_64: define win64cc void @has_efiapi
24+
//i686: define void @has_efiapi
25+
//aarch64: define void @has_efiapi
26+
//arm: define void @has_efiapi
27+
//riscv: define void @has_efiapi
1628
#[no_mangle]
17-
#[cfg(not(target_arch = "x86_64"))]
18-
pub extern "efiapi" fn has_efiapi(a: i64) -> i64 {
19-
a * 2
20-
}
29+
pub extern "efiapi" fn has_efiapi() {}

0 commit comments

Comments
 (0)