Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link libgcc statically on Win64. #17471

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/librustc/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion src/librustrt/libunwind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}

Expand Down