summaryrefslogtreecommitdiffstats
path: root/vendor/r-efi/examples/uefi-cross-compile.rs
blob: f99870a21081f2907a2a4ac2b72e9cf3e0832f15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Bare UEFI Compilation
//
// This is a copy of a cross-compile test from the upstream rust repository. It
// is used to verify cross-compilation of UEFI targets works. It is included
// verbatim here to make sure we can run tests against it and get notifications
// when it breaks.

// -----------------------------------------------------------------------------
// COPY FROM `rust-lang/rust/src/test/codegen/uefi-cross-compile.rs`
// -----------------------------------------------------------------------------

// Checks whether UEFI targets cross-compile successfully.
//
// This test contains a simple UEFI program that simply exits with return code
// 0. It can be easily run from the UEFI shell (but any other UEFI environment
// works as well). This program is not run as part of the test. The test merely
// verifies the cross-compilation does not fail and an entry-point is emitted.
//
// The imported definitions from the UEFI specification are intentionally left
// incomplete. Only the bits that are actually used by this test are defined.

// min-llvm-version 9.0

// compile-flags: --target x86_64-unknown-uefi

#![feature(lang_items, no_core)]
#![no_core]
#![no_main]

#[lang = "sized"]
pub trait Sized {}
#[lang = "freeze"]
pub trait Freeze {}
#[lang = "copy"]
pub trait Copy {}

// CHECK: define win64cc i64 @efi_main{{.*}}
#[export_name = "efi_main"]
pub extern "efiapi" fn main(_h: *mut usize, _st: *mut usize) -> usize {
    return 0;
}