@@ -16,34 +16,13 @@ pub fn opts() -> TargetOptions {
16
16
] ,
17
17
) ;
18
18
19
- let mut late_link_args = LinkArgs :: new ( ) ;
20
19
let mut late_link_args_dynamic = LinkArgs :: new ( ) ;
21
20
let mut late_link_args_static = LinkArgs :: new ( ) ;
22
- // Order of `late_link_args*` was found through trial and error to work with various
23
- // mingw-w64 versions (not tested on the CI). It's expected to change from time to time.
24
- let mingw_libs = vec ! [
25
- "-lmsvcrt" . to_string( ) ,
26
- "-lmingwex" . to_string( ) ,
27
- "-lmingw32" . to_string( ) ,
28
- "-lgcc" . to_string( ) , // alas, mingw* libraries above depend on libgcc
29
- // mingw's msvcrt is a weird hybrid import library and static library.
30
- // And it seems that the linker fails to use import symbols from msvcrt
31
- // that are required from functions in msvcrt in certain cases. For example
32
- // `_fmode` that is used by an implementation of `__p__fmode` in x86_64.
33
- // The library is purposely listed twice to fix that.
34
- //
35
- // See https://github.com/rust-lang/rust/pull/47483 for some more details.
36
- "-lmsvcrt" . to_string( ) ,
37
- "-luser32" . to_string( ) ,
38
- "-lkernel32" . to_string( ) ,
39
- ] ;
40
- late_link_args. insert ( LinkerFlavor :: Gcc , mingw_libs. clone ( ) ) ;
41
- late_link_args. insert ( LinkerFlavor :: Lld ( LldFlavor :: Ld ) , mingw_libs) ;
42
21
let dynamic_unwind_libs = vec ! [
43
22
// If any of our crates are dynamically linked then we need to use
44
23
// the shared libgcc_s-dw2-1.dll. This is required to support
45
24
// unwinding across DLL boundaries.
46
- "-lgcc_s " . to_string( ) ,
25
+ "-l:libunwind.dll.a " . to_string( ) ,
47
26
] ;
48
27
late_link_args_dynamic. insert ( LinkerFlavor :: Gcc , dynamic_unwind_libs. clone ( ) ) ;
49
28
late_link_args_dynamic. insert ( LinkerFlavor :: Lld ( LldFlavor :: Ld ) , dynamic_unwind_libs) ;
@@ -53,8 +32,7 @@ pub fn opts() -> TargetOptions {
53
32
// binaries to be redistributed without the libgcc_s-dw2-1.dll
54
33
// dependency, but unfortunately break unwinding across DLL
55
34
// boundaries when unwinding across FFI boundaries.
56
- "-lgcc_eh" . to_string( ) ,
57
- "-l:libpthread.a" . to_string( ) ,
35
+ "-l:libunwind.a" . to_string( ) ,
58
36
] ;
59
37
late_link_args_static. insert ( LinkerFlavor :: Gcc , static_unwind_libs. clone ( ) ) ;
60
38
late_link_args_static. insert ( LinkerFlavor :: Lld ( LldFlavor :: Ld ) , static_unwind_libs) ;
@@ -64,7 +42,8 @@ pub fn opts() -> TargetOptions {
64
42
env : "gnu" . to_string ( ) ,
65
43
vendor : "pc" . to_string ( ) ,
66
44
// FIXME(#13846) this should be enabled for windows
67
- function_sections : false ,
45
+ function_sections : true ,
46
+ no_default_libraries : false ,
68
47
linker : Some ( "gcc" . to_string ( ) ) ,
69
48
dynamic_linking : true ,
70
49
executables : true ,
@@ -80,7 +59,6 @@ pub fn opts() -> TargetOptions {
80
59
pre_link_objects_fallback : crt_objects:: pre_mingw_fallback ( ) ,
81
60
post_link_objects_fallback : crt_objects:: post_mingw_fallback ( ) ,
82
61
crt_objects_fallback : Some ( CrtObjectsFallback :: Mingw ) ,
83
- late_link_args,
84
62
late_link_args_dynamic,
85
63
late_link_args_static,
86
64
abi_return_struct_as_int : true ,
0 commit comments