]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_target/src/spec/windows_gnullvm_base.rs
Auto merge of #104138 - Dylan-DPC:rollup-m3ojpjg, r=Dylan-DPC
[rust.git] / compiler / rustc_target / src / spec / windows_gnullvm_base.rs
1 use crate::spec::{cvs, Cc, DebuginfoKind, LinkerFlavor, Lld, SplitDebuginfo, TargetOptions};
2 use std::borrow::Cow;
3
4 pub fn opts() -> TargetOptions {
5     // We cannot use `-nodefaultlibs` because compiler-rt has to be passed
6     // as a path since it's not added to linker search path by the default.
7     // There were attempts to make it behave like libgcc (so one can just use -l<name>)
8     // but LLVM maintainers rejected it: https://reviews.llvm.org/D51440
9     let pre_link_args = TargetOptions::link_args(
10         LinkerFlavor::Gnu(Cc::Yes, Lld::No),
11         &["-nolibc", "--unwindlib=none"],
12     );
13     // Order of `late_link_args*` does not matter with LLD.
14     let late_link_args = TargetOptions::link_args(
15         LinkerFlavor::Gnu(Cc::Yes, Lld::No),
16         &["-lmingw32", "-lmingwex", "-lmsvcrt", "-lkernel32", "-luser32"],
17     );
18
19     TargetOptions {
20         os: "windows".into(),
21         env: "gnu".into(),
22         vendor: "pc".into(),
23         abi: "llvm".into(),
24         linker: Some("clang".into()),
25         dynamic_linking: true,
26         dll_prefix: "".into(),
27         dll_suffix: ".dll".into(),
28         exe_suffix: ".exe".into(),
29         families: cvs!["windows"],
30         is_like_windows: true,
31         allows_weak_linkage: false,
32         pre_link_args,
33         late_link_args,
34         abi_return_struct_as_int: true,
35         emit_debug_gdb_scripts: false,
36         requires_uwtable: true,
37         eh_frame_header: false,
38         no_default_libraries: false,
39         has_thread_local: true,
40         // FIXME(davidtwco): Support Split DWARF on Windows GNU - may require LLVM changes to
41         // output DWO, despite using DWARF, doesn't use ELF..
42         debuginfo_kind: DebuginfoKind::Pdb,
43         supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
44         ..Default::default()
45     }
46 }