Skip to content

Commit 1860efb

Browse files
committed
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.
1 parent f113249 commit 1860efb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/librustc/back/link.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -822,9 +822,10 @@ pub fn link_binary(sess: Session,
822822
// In the future, FreeBSD will use clang as default compiler.
823823
// It would be flexible to use cc (system's default C compiler)
824824
// instead of hard-coded gcc.
825-
// For win32, there is no cc command,
826-
// so we add a condition to make it use gcc.
827-
let cc_prog: ~str = match sess.opts.linker {
825+
// For win32, there is no cc command, so we add a condition to make it use g++.
826+
// We use g++ rather than gcc because it automatically adds linker options required
827+
// for generation of dll modules that correctly register stack unwind tables.
828+
match sess.opts.linker {
828829
Some(ref linker) => linker.to_str(),
829830
None => match sess.targ_cfg.os {
830831
session::os_android =>
@@ -837,7 +838,7 @@ pub fn link_binary(sess: Session,
837838
(--android-cross-path)")
838839
}
839840
},
840-
session::os_win32 => ~"gcc",
841+
session::os_win32 => ~"g++",
841842
_ => ~"cc"
842843
}
843844
};

0 commit comments

Comments
 (0)