Skip to content

Commit 8cad720

Browse files
committed
auto merge of #17471 : vadimcn/rust/link-libgcc, r=alexcrichton
Closes #17271 Closes #15420
2 parents d853666 + a468659 commit 8cad720

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/librustc/back/link.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -991,10 +991,15 @@ fn link_args(cmd: &mut Command,
991991
}
992992

993993
if sess.targ_cfg.os == abi::OsWindows {
994-
// Make sure that we link to the dynamic libgcc, otherwise cross-module
995-
// DWARF stack unwinding will not work.
996-
// This behavior may be overridden by --link-args "-static-libgcc"
997-
cmd.arg("-shared-libgcc");
994+
if sess.targ_cfg.arch == abi::X86 {
995+
// Make sure that we link to the dynamic libgcc, otherwise cross-module
996+
// DWARF stack unwinding will not work.
997+
// This behavior may be overridden by -Clink-args="-static-libgcc"
998+
cmd.arg("-shared-libgcc");
999+
} else {
1000+
// On Win64 unwinding is handled by the OS, so we can link libgcc statically.
1001+
cmd.arg("-static-libgcc");
1002+
}
9981003

9991004
// And here, we see obscure linker flags #45. On windows, it has been
10001005
// found to be necessary to have this flag to compile liblibc.

src/librustrt/libunwind.rs

-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ pub type _Unwind_Exception_Cleanup_Fn =
8787

8888
#[cfg(target_os = "linux")]
8989
#[cfg(target_os = "freebsd")]
90-
#[cfg(target_os = "windows")]
9190
#[link(name = "gcc_s")]
9291
extern {}
9392

0 commit comments

Comments
 (0)