1 use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, TargetOptions};
2 use std::default::Default;
4 pub fn opts() -> TargetOptions {
5 let pre_link_args_msvc = vec!["/NOLOGO".to_string(), "/NXCOMPAT".to_string()];
6 let mut pre_link_args = LinkArgs::new();
7 pre_link_args.insert(LinkerFlavor::Msvc, pre_link_args_msvc.clone());
8 pre_link_args.insert(LinkerFlavor::Lld(LldFlavor::Link), pre_link_args_msvc);
11 function_sections: true,
12 dynamic_linking: true,
14 dll_prefix: String::new(),
15 dll_suffix: ".dll".to_string(),
16 exe_suffix: ".exe".to_string(),
17 staticlib_prefix: String::new(),
18 staticlib_suffix: ".lib".to_string(),
19 target_family: Some("windows".to_string()),
20 is_like_windows: true,
22 // set VSLANG to 1033 can prevent link.exe from using
23 // language packs, and avoid generating Non-UTF-8 error
24 // messages if a link error occurred.
25 link_env: vec![("VSLANG".to_string(), "1033".to_string())],
26 lld_flavor: LldFlavor::Link,
28 crt_static_allows_dylibs: true,
29 crt_static_respected: true,
30 abi_return_struct_as_int: true,
31 emit_debug_gdb_scripts: false,
32 requires_uwtable: true,
33 // Currently we don't pass the /NODEFAULTLIB flag to the linker on MSVC
34 // as there's been trouble in the past of linking the C++ standard
35 // library required by LLVM. This likely needs to happen one day, but
36 // in general Windows is also a more controlled environment than
37 // Unix, so it's not necessarily as critical that this be implemented.
39 // Note that there are also some licensing worries about statically
40 // linking some libraries which require a specific agreement, so it may
41 // not ever be possible for us to pass this flag.
42 no_default_libraries: false,