diff --git a/compiler/rustc_target/src/spec/msvc_base.rs b/compiler/rustc_target/src/spec/msvc_base.rs index efe949a4e9074..1b4274dcfb0c5 100644 --- a/compiler/rustc_target/src/spec/msvc_base.rs +++ b/compiler/rustc_target/src/spec/msvc_base.rs @@ -14,6 +14,7 @@ pub fn opts() -> TargetOptions { pre_link_args, abi_return_struct_as_int: true, emit_debug_gdb_scripts: false, + eh_frame_header: false, // Currently this is the only supported method of debuginfo on MSVC // where `*.pdb` files show up next to the final artifact. diff --git a/compiler/rustc_target/src/spec/uefi_msvc_base.rs b/compiler/rustc_target/src/spec/uefi_msvc_base.rs index 8968d3c8fc100..4d62fb2262d5b 100644 --- a/compiler/rustc_target/src/spec/uefi_msvc_base.rs +++ b/compiler/rustc_target/src/spec/uefi_msvc_base.rs @@ -9,7 +9,7 @@ // the timer-interrupt. Device-drivers are required to use polling-based models. Furthermore, all // code runs in the same environment, no process separation is supported. -use crate::spec::{LinkerFlavor, Lld, PanicStrategy, StackProbeType, TargetOptions}; +use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, StackProbeType, TargetOptions}; pub fn opts() -> TargetOptions { let mut base = super::msvc_base::opts(); @@ -34,6 +34,11 @@ pub fn opts() -> TargetOptions { ], ); + base.add_pre_link_args( + LinkerFlavor::Unix(Cc::Yes), + &["-Wl,--entry=efi_main", "-Wl,--subsystem=efi_application"], + ); + TargetOptions { os: "uefi".into(), linker_flavor: LinkerFlavor::Msvc(Lld::Yes),