about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc/back/link.rs13
-rw-r--r--src/librustrt/libunwind.rs1
2 files changed, 9 insertions, 5 deletions
diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs
index d31e19b4467..e6e9448fa56 100644
--- a/src/librustc/back/link.rs
+++ b/src/librustc/back/link.rs
@@ -991,10 +991,15 @@ fn link_args(cmd: &mut Command,
     }
 
     if sess.targ_cfg.os == abi::OsWindows {
-        // Make sure that we link to the dynamic libgcc, otherwise cross-module
-        // DWARF stack unwinding will not work.
-        // This behavior may be overridden by --link-args "-static-libgcc"
-        cmd.arg("-shared-libgcc");
+        if sess.targ_cfg.arch == abi::X86 {
+            // Make sure that we link to the dynamic libgcc, otherwise cross-module
+            // DWARF stack unwinding will not work.
+            // This behavior may be overridden by -Clink-args="-static-libgcc"
+            cmd.arg("-shared-libgcc");
+        } else {
+            // On Win64 unwinding is handled by the OS, so we can link libgcc statically.
+            cmd.arg("-static-libgcc");
+        }
 
         // And here, we see obscure linker flags #45. On windows, it has been
         // found to be necessary to have this flag to compile liblibc.
diff --git a/src/librustrt/libunwind.rs b/src/librustrt/libunwind.rs
index 69df8a7fd66..aab75d7f774 100644
--- a/src/librustrt/libunwind.rs
+++ b/src/librustrt/libunwind.rs
@@ -87,7 +87,6 @@ pub type _Unwind_Exception_Cleanup_Fn =
 
 #[cfg(target_os = "linux")]
 #[cfg(target_os = "freebsd")]
-#[cfg(target_os = "windows")]
 #[link(name = "gcc_s")]
 extern {}