]> git.lizzy.rs Git - rust.git/commitdiff
Link libgcc statically on Win64.
authorVadim Chugunov <vadimcn@gmail.com>
Mon, 22 Sep 2014 23:33:18 +0000 (16:33 -0700)
committerVadim Chugunov <vadimcn@gmail.com>
Mon, 22 Sep 2014 23:33:18 +0000 (16:33 -0700)
Allow linking it statically on Win32 with an override.

src/librustc/back/link.rs
src/librustrt/libunwind.rs

index d31e19b4467f87d966b0aaedf270ae014a22d691..e6e9448fa563e6ee8029826ead282c9489643da3 100644 (file)
@@ -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.
index 69df8a7fd66e316f696068313972d952246c1c5f..aab75d7f7746d7b6126f2c01595627e7078e7838 100644 (file)
@@ -87,7 +87,6 @@ pub enum _Unwind_Context {}
 
 #[cfg(target_os = "linux")]
 #[cfg(target_os = "freebsd")]
-#[cfg(target_os = "windows")]
 #[link(name = "gcc_s")]
 extern {}