99// the timer-interrupt. Device-drivers are required to use polling-based models. Furthermore, all
1010// code runs in the same environment, no process separation is supported.
1111
12- use crate :: spec:: { LinkArgs , LinkerFlavor , LldFlavor , PanicStrategy , TargetOptions } ;
12+ use crate :: spec:: { LinkerFlavor , LldFlavor , PanicStrategy , TargetOptions } ;
1313
1414pub fn opts ( ) -> TargetOptions {
15+ let mut base = super :: msvc_base:: opts ( ) ;
16+
1517 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( ) ,
2518 // Non-standard subsystems have no default entry-point in PE+ files. We have to define
2619 // one. "efi_main" seems to be a common choice amongst other implementations and the
2720 // spec.
@@ -37,25 +30,29 @@ pub fn opts() -> TargetOptions {
3730 // exit (default for applications).
3831 "/subsystem:efi_application" . to_string( ) ,
3932 ] ;
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) ;
4338
4439 TargetOptions {
45- dynamic_linking : false ,
46- executables : true ,
4740 disable_redzone : true ,
4841 exe_suffix : ".efi" . to_string ( ) ,
4942 allows_weak_linkage : false ,
5043 panic_strategy : PanicStrategy :: Abort ,
5144 stack_probes : true ,
5245 singlethread : true ,
53- emit_debug_gdb_scripts : false ,
54-
5546 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 ,
5855
59- ..Default :: default ( )
56+ ..base
6057 }
6158}
0 commit comments