Skip to content

Commit ba68019

Browse files
committed
Fix linking on mingw
1 parent a2a7188 commit ba68019

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/libpanic_unwind/gcc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ unsafe fn find_eh_action(
324324
// See docs in the `unwind` module. This needs to be implemented in assembly
325325
// because _Unwind_Resume expects to be called directly from the landing pad.
326326
// This means that we need to force a tail call here.
327-
#[cfg(all(
327+
/*#[cfg(all(
328328
not(bootstrap),
329329
target_os = "windows",
330330
any(target_arch = "x86", target_arch = "x86_64"),
@@ -343,7 +343,7 @@ _rust_eh_unwind_resume:
343343
jmp __Unwind_Resume
344344
.cfi_endproc
345345
"#
346-
}
346+
}*/
347347
#[cfg(all(
348348
bootstrap,
349349
target_os = "windows",

src/librustc_codegen_ssa/back/link.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,8 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>(
490490
info!("preparing {:?} to {:?}", crate_type, out_filename);
491491
let (linker, flavor) = linker_and_flavor(sess);
492492

493-
let any_dynamic_crate =
494-
codegen_results.crate_info.dependency_formats.iter().any(|(ty, list)| {
493+
let any_dynamic_crate = crate_type == config::CrateType::Dylib
494+
|| codegen_results.crate_info.dependency_formats.iter().any(|(ty, list)| {
495495
*ty == crate_type && list.iter().any(|&linkage| linkage == Linkage::Dynamic)
496496
});
497497

src/librustc_target/spec/windows_base.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ pub fn opts() -> TargetOptions {
4646
// unwinding across DLL boundaries.
4747
"-lgcc_s".to_string(),
4848
"-lgcc".to_string(),
49+
"-lkernel32".to_string(),
4950
],
5051
);
5152
late_link_args_static.insert(
@@ -59,6 +60,7 @@ pub fn opts() -> TargetOptions {
5960
"-lgcc".to_string(),
6061
"-lgcc_eh".to_string(),
6162
"-lpthread".to_string(),
63+
"-lkernel32".to_string(),
6264
],
6365
);
6466

0 commit comments

Comments
 (0)