Skip to content
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

rustc_target: Refactor target specifications related to Windows and UEFI #71030

Merged
merged 9 commits into from
Apr 15, 2020
Prev Previous commit
Next Next commit
rustc_target: Inherit windows_uwp_gnu_base from windows_gnu_base
  • Loading branch information
petrochenkov committed Apr 13, 2020
commit 88c480279b9da4487aa779c26f0445aaaf268834
34 changes: 13 additions & 21 deletions src/librustc_target/spec/windows_uwp_gnu_base.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions};

pub fn opts() -> TargetOptions {
let base = super::windows_gnu_base::opts();

// FIXME: Consider adding `-nostdlib` and inheriting from `windows_gnu_base`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this probably doesn't work great right now.
There is only one prebuilt C toolchain that advertises UWP support but it cannot be easily tested until LLD can link Rust...

let mut pre_link_args = LinkArgs::new();
pre_link_args.insert(
LinkerFlavor::Gcc,
Expand All @@ -13,7 +16,10 @@ pub fn opts() -> TargetOptions {
],
);

// FIXME: Should UWP target be updated for the exception machinery changes from #67502?
petrochenkov marked this conversation as resolved.
Show resolved Hide resolved
let mut late_link_args = LinkArgs::new();
let late_link_args_dynamic = LinkArgs::new();
let late_link_args_static = LinkArgs::new();
late_link_args.insert(
LinkerFlavor::Gcc,
vec![
Expand All @@ -32,31 +38,17 @@ pub fn opts() -> TargetOptions {
);

TargetOptions {
// FIXME(#13846) this should be enabled for windows
function_sections: false,
linker: Some("gcc".to_string()),
dynamic_linking: true,
executables: false,
dll_prefix: String::new(),
dll_suffix: ".dll".to_string(),
exe_suffix: ".exe".to_string(),
staticlib_prefix: "lib".to_string(),
staticlib_suffix: ".a".to_string(),
target_family: Some("windows".to_string()),
is_like_windows: true,
allows_weak_linkage: false,
limit_rdylib_exports: false,
pre_link_args,
pre_link_objects_exe: vec![
"rsbegin.o".to_string(), // Rust compiler runtime initialization, see rsbegin.rs
],
// FIXME: Consider adding `-nostdlib` and inheriting from `windows_gnu_base`.
pre_link_objects_exe: vec!["rsbegin.o".to_string()],
// FIXME: Consider adding `-nostdlib` and inheriting from `windows_gnu_base`.
pre_link_objects_dll: vec!["rsbegin.o".to_string()],
late_link_args,
post_link_objects: vec!["rsend.o".to_string()],
abi_return_struct_as_int: true,
emit_debug_gdb_scripts: false,
requires_uwtable: true,
limit_rdylib_exports: false,
late_link_args_dynamic,
late_link_args_static,

..Default::default()
..base
}
}