about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVadim Chugunov <vadimcn@gmail.com>2013-08-19 15:53:07 -0700
committerVadim Chugunov <vadimcn@gmail.com>2013-08-22 00:12:42 -0700
commit1860efbfc62465ca096e67ee64ba9b2f71c5e1a8 (patch)
treedd995aa3559b9b6c027de729844f3aed6b962c10
parentf1132496dddbdd88f321a7919eec3d65136b3f75 (diff)
downloadrust-1860efbfc62465ca096e67ee64ba9b2f71c5e1a8.tar.gz
rust-1860efbfc62465ca096e67ee64ba9b2f71c5e1a8.zip
On Windows, use g++ for linking, instead of gcc.
This is required in order to produce linked modules that perform correct registration of unwind tables.
-rw-r--r--src/librustc/back/link.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs
index b1ce2137148..c66cc2bf991 100644
--- a/src/librustc/back/link.rs
+++ b/src/librustc/back/link.rs
@@ -822,9 +822,10 @@ pub fn link_binary(sess: Session,
     // In the future, FreeBSD will use clang as default compiler.
     // It would be flexible to use cc (system's default C compiler)
     // instead of hard-coded gcc.
-    // For win32, there is no cc command,
-    // so we add a condition to make it use gcc.
-    let cc_prog: ~str = match sess.opts.linker {
+    // For win32, there is no cc command, so we add a condition to make it use g++.
+    // We use g++ rather than gcc because it automatically adds linker options required
+    // for generation of dll modules that correctly register stack unwind tables.
+    match sess.opts.linker {
         Some(ref linker) => linker.to_str(),
         None => match sess.targ_cfg.os {
             session::os_android =>
@@ -837,7 +838,7 @@ pub fn link_binary(sess: Session,
                                     (--android-cross-path)")
                     }
                 },
-            session::os_win32 => ~"gcc",
+            session::os_win32 => ~"g++",
             _ => ~"cc"
         }
     };