From 1860efbfc62465ca096e67ee64ba9b2f71c5e1a8 Mon Sep 17 00:00:00 2001 From: Vadim Chugunov Date: Mon, 19 Aug 2013 15:53:07 -0700 Subject: [PATCH] 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. --- src/librustc/back/link.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index b1ce2137148b..c66cc2bf991b 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" } };