1 use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, SplitDebuginfo, TargetOptions};
3 pub fn opts() -> TargetOptions {
4 let pre_link_args_msvc = vec![
5 // Suppress the verbose logo and authorship debugging output, which would needlessly
8 // Tell the compiler that non-code sections can be marked as non-executable,
9 // including stack pages.
10 // UEFI is fully compatible to non-executable data pages.
11 // In fact, firmware might enforce this, so we better let the linker know about this,
12 // so it will fail if the compiler ever tries placing code on the stack
13 // (e.g., trampoline constructs and alike).
14 "/NXCOMPAT".to_string(),
16 let mut pre_link_args = LinkArgs::new();
17 pre_link_args.insert(LinkerFlavor::Msvc, pre_link_args_msvc.clone());
18 pre_link_args.insert(LinkerFlavor::Lld(LldFlavor::Link), pre_link_args_msvc);
21 linker_flavor: LinkerFlavor::Msvc,
23 is_like_windows: true,
25 lld_flavor: LldFlavor::Link,
27 abi_return_struct_as_int: true,
28 emit_debug_gdb_scripts: false,
30 // Currently this is the only supported method of debuginfo on MSVC
31 // where `*.pdb` files show up next to the final artifact.
32 split_debuginfo: SplitDebuginfo::Packed,