| 
 | 1 | +use std::borrow::Cow;  | 
 | 2 | + | 
 | 3 | +use crate::spec::{Cc, DebuginfoKind, LinkerFlavor, Lld, SplitDebuginfo, TargetOptions, cvs};  | 
 | 4 | + | 
 | 5 | +pub(crate) fn opts() -> TargetOptions {  | 
 | 6 | +    let mut pre_link_args = TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), &[  | 
 | 7 | +        "--disable-dynamicbase",  | 
 | 8 | +        "--enable-auto-image-base",  | 
 | 9 | +    ]);  | 
 | 10 | +    crate::spec::add_link_args(&mut pre_link_args, LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[  | 
 | 11 | +        "-Wl,--disable-dynamicbase",  | 
 | 12 | +        "-Wl,--enable-auto-image-base",  | 
 | 13 | +    ]);  | 
 | 14 | +    let cygwin_libs = &["-lcygwin", "-lgcc", "-lcygwin", "-luser32", "-lkernel32", "-lgcc_s"];  | 
 | 15 | +    let mut late_link_args =  | 
 | 16 | +        TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), cygwin_libs);  | 
 | 17 | +    crate::spec::add_link_args(  | 
 | 18 | +        &mut late_link_args,  | 
 | 19 | +        LinkerFlavor::Gnu(Cc::Yes, Lld::No),  | 
 | 20 | +        cygwin_libs,  | 
 | 21 | +    );  | 
 | 22 | +    TargetOptions {  | 
 | 23 | +        os: "cygwin".into(),  | 
 | 24 | +        vendor: "pc".into(),  | 
 | 25 | +        // FIXME(#13846) this should be enabled for cygwin  | 
 | 26 | +        function_sections: false,  | 
 | 27 | +        linker: Some("gcc".into()),  | 
 | 28 | +        dynamic_linking: true,  | 
 | 29 | +        dll_prefix: "".into(),  | 
 | 30 | +        dll_suffix: ".dll".into(),  | 
 | 31 | +        exe_suffix: ".exe".into(),  | 
 | 32 | +        families: cvs!["unix"],  | 
 | 33 | +        is_like_windows: true,  | 
 | 34 | +        allows_weak_linkage: false,  | 
 | 35 | +        pre_link_args,  | 
 | 36 | +        late_link_args,  | 
 | 37 | +        abi_return_struct_as_int: true,  | 
 | 38 | +        emit_debug_gdb_scripts: false,  | 
 | 39 | +        requires_uwtable: true,  | 
 | 40 | +        eh_frame_header: false,  | 
 | 41 | +        debuginfo_kind: DebuginfoKind::Dwarf,  | 
 | 42 | +        supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),  | 
 | 43 | +        ..Default::default()  | 
 | 44 | +    }  | 
 | 45 | +}  | 
0 commit comments