9
9
// the timer-interrupt. Device-drivers are required to use polling-based models. Furthermore, all
10
10
// code runs in the same environment, no process separation is supported.
11
11
12
- use crate :: spec:: { LinkArgs , LinkerFlavor , LldFlavor , PanicStrategy , TargetOptions } ;
12
+ use crate :: spec:: { LinkerFlavor , LldFlavor , PanicStrategy , TargetOptions } ;
13
13
14
14
pub fn opts ( ) -> TargetOptions {
15
+ let mut base = super :: msvc_base:: opts ( ) ;
16
+
15
17
let pre_link_args_msvc = vec ! [
16
- // Suppress the verbose logo and authorship debugging output, which would needlessly
17
- // clog any log files.
18
- "/NOLOGO" . to_string( ) ,
19
- // UEFI is fully compatible to non-executable data pages. Tell the compiler that
20
- // non-code sections can be marked as non-executable, including stack pages. In fact,
21
- // firmware might enforce this, so we better let the linker know about this, so it
22
- // will fail if the compiler ever tries placing code on the stack (e.g., trampoline
23
- // constructs and alike).
24
- "/NXCOMPAT" . to_string( ) ,
25
18
// Non-standard subsystems have no default entry-point in PE+ files. We have to define
26
19
// one. "efi_main" seems to be a common choice amongst other implementations and the
27
20
// spec.
@@ -37,25 +30,29 @@ pub fn opts() -> TargetOptions {
37
30
// exit (default for applications).
38
31
"/subsystem:efi_application" . to_string( ) ,
39
32
] ;
40
- let mut pre_link_args = LinkArgs :: new ( ) ;
41
- pre_link_args. insert ( LinkerFlavor :: Msvc , pre_link_args_msvc. clone ( ) ) ;
42
- pre_link_args. insert ( LinkerFlavor :: Lld ( LldFlavor :: Link ) , pre_link_args_msvc) ;
33
+ base. pre_link_args . get_mut ( & LinkerFlavor :: Msvc ) . unwrap ( ) . extend ( pre_link_args_msvc. clone ( ) ) ;
34
+ base. pre_link_args
35
+ . get_mut ( & LinkerFlavor :: Lld ( LldFlavor :: Link ) )
36
+ . unwrap ( )
37
+ . extend ( pre_link_args_msvc) ;
43
38
44
39
TargetOptions {
45
- dynamic_linking : false ,
46
- executables : true ,
47
40
disable_redzone : true ,
48
41
exe_suffix : ".efi" . to_string ( ) ,
49
42
allows_weak_linkage : false ,
50
43
panic_strategy : PanicStrategy :: Abort ,
51
44
stack_probes : true ,
52
45
singlethread : true ,
53
- emit_debug_gdb_scripts : false ,
54
-
55
46
linker : Some ( "rust-lld" . to_string ( ) ) ,
56
- lld_flavor : LldFlavor :: Link ,
57
- pre_link_args,
47
+ // FIXME: This should likely be `true` inherited from `msvc_base`
48
+ // because UEFI follows Windows ABI and uses PE/COFF.
49
+ // The `false` is probably causing ABI bugs right now.
50
+ is_like_windows : false ,
51
+ // FIXME: This should likely be `true` inherited from `msvc_base`
52
+ // because UEFI follows Windows ABI and uses PE/COFF.
53
+ // The `false` is probably causing ABI bugs right now.
54
+ is_like_msvc : false ,
58
55
59
- ..Default :: default ( )
56
+ ..base
60
57
}
61
58
}
0 commit comments