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