Skip to content

rustc_target: support Unix-flavor linkers for UEFI #110869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/msvc_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 6 additions & 1 deletion compiler/rustc_target/src/spec/uefi_msvc_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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),
Expand Down