|
1 | | -use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, TargetOptions}; |
| 1 | +use crate::spec::{LinkerFlavor, LldFlavor, TargetOptions}; |
2 | 2 |
|
3 | 3 | pub fn opts() -> TargetOptions { |
4 | | - let pre_link_args_msvc = vec![ |
5 | | - "/NOLOGO".to_string(), |
6 | | - "/NXCOMPAT".to_string(), |
7 | | - "/APPCONTAINER".to_string(), |
8 | | - "mincore.lib".to_string(), |
9 | | - ]; |
10 | | - let mut pre_link_args = LinkArgs::new(); |
11 | | - pre_link_args.insert(LinkerFlavor::Msvc, pre_link_args_msvc.clone()); |
12 | | - pre_link_args.insert(LinkerFlavor::Lld(LldFlavor::Link), pre_link_args_msvc); |
| 4 | + let mut opts = super::windows_msvc_base::opts(); |
13 | 5 |
|
14 | | - TargetOptions { |
15 | | - function_sections: true, |
16 | | - dynamic_linking: true, |
17 | | - executables: true, |
18 | | - dll_prefix: String::new(), |
19 | | - dll_suffix: ".dll".to_string(), |
20 | | - exe_suffix: ".exe".to_string(), |
21 | | - staticlib_prefix: String::new(), |
22 | | - staticlib_suffix: ".lib".to_string(), |
23 | | - target_family: Some("windows".to_string()), |
24 | | - is_like_windows: true, |
25 | | - is_like_msvc: true, |
26 | | - pre_link_args, |
27 | | - crt_static_allows_dylibs: true, |
28 | | - crt_static_respected: true, |
29 | | - abi_return_struct_as_int: true, |
30 | | - emit_debug_gdb_scripts: false, |
31 | | - requires_uwtable: true, |
32 | | - lld_flavor: LldFlavor::Link, |
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. |
38 | | - // |
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, |
| 6 | + let pre_link_args_msvc = vec!["/APPCONTAINER".to_string(), "mincore.lib".to_string()]; |
| 7 | + opts.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap().extend(pre_link_args_msvc.clone()); |
| 8 | + opts.pre_link_args |
| 9 | + .get_mut(&LinkerFlavor::Lld(LldFlavor::Link)) |
| 10 | + .unwrap() |
| 11 | + .extend(pre_link_args_msvc); |
43 | 12 |
|
44 | | - ..Default::default() |
45 | | - } |
| 13 | + opts |
46 | 14 | } |
0 commit comments