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();
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(),
17 let mut late_link_args = LinkArgs::new();
18 late_link_args.insert(
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(),
29 "-lwindowsapp".to_string(),
30 "-lmingwex".to_string(),
31 "-lmingw32".to_string(),
36 // FIXME(#13846) this should be enabled for windows
37 function_sections: false,
38 linker: Some("gcc".to_string()),
39 dynamic_linking: true,
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,
51 pre_link_objects_exe: vec![
52 "rsbegin.o".to_string(), // Rust compiler runtime initialization, see rsbegin.rs
54 pre_link_objects_dll: vec!["rsbegin.o".to_string()],
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,