]> git.proxmox.com Git - rustc.git/blob - src/librustc_target/spec/windows_uwp_base.rs
New upstream version 1.42.0+dfsg0+pve1
[rustc.git] / src / librustc_target / spec / windows_uwp_base.rs
1 use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions};
2 use std::default::Default;
3
4 pub fn opts() -> TargetOptions {
5 let mut pre_link_args = LinkArgs::new();
6 pre_link_args.insert(
7 LinkerFlavor::Gcc,
8 vec![
9 // Tell GCC to avoid linker plugins, because we are not bundling
10 // them with Windows installer, and Rust does its own LTO anyways.
11 "-fno-use-linker-plugin".to_string(),
12 // Always enable DEP (NX bit) when it is available
13 "-Wl,--nxcompat".to_string(),
14 ],
15 );
16
17 let mut late_link_args = LinkArgs::new();
18 late_link_args.insert(
19 LinkerFlavor::Gcc,
20 vec![
21 //"-lwinstorecompat".to_string(),
22 //"-lmingwex".to_string(),
23 //"-lwinstorecompat".to_string(),
24 "-lwinstorecompat".to_string(),
25 "-lruntimeobject".to_string(),
26 "-lsynchronization".to_string(),
27 "-lvcruntime140_app".to_string(),
28 "-lucrt".to_string(),
29 "-lwindowsapp".to_string(),
30 "-lmingwex".to_string(),
31 "-lmingw32".to_string(),
32 ],
33 );
34
35 TargetOptions {
36 // FIXME(#13846) this should be enabled for windows
37 function_sections: false,
38 linker: Some("gcc".to_string()),
39 dynamic_linking: true,
40 executables: false,
41 dll_prefix: String::new(),
42 dll_suffix: ".dll".to_string(),
43 exe_suffix: ".exe".to_string(),
44 staticlib_prefix: "lib".to_string(),
45 staticlib_suffix: ".a".to_string(),
46 no_default_libraries: true,
47 target_family: Some("windows".to_string()),
48 is_like_windows: true,
49 allows_weak_linkage: false,
50 pre_link_args,
51 pre_link_objects_exe: vec![
52 "rsbegin.o".to_string(), // Rust compiler runtime initialization, see rsbegin.rs
53 ],
54 pre_link_objects_dll: vec!["rsbegin.o".to_string()],
55 late_link_args,
56 post_link_objects: vec!["rsend.o".to_string()],
57 custom_unwind_resume: true,
58 abi_return_struct_as_int: true,
59 emit_debug_gdb_scripts: false,
60 requires_uwtable: true,
61 limit_rdylib_exports: false,
62
63 ..Default::default()
64 }
65 }