From 1da127bbd318abb2120339760bbfa4fd78d7889f Mon Sep 17 00:00:00 2001 From: Oliver Middleton Date: Wed, 3 Feb 2016 13:28:18 +0000 Subject: [PATCH 1/2] Enable /LARGEADDRESSAWARE for i686-pc-windows-msvc It's already enabled for i686-pc-windows-gnu. --- src/librustc_back/target/i686_pc_windows_msvc.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/librustc_back/target/i686_pc_windows_msvc.rs b/src/librustc_back/target/i686_pc_windows_msvc.rs index 96b2d37ab2088..7079df1ab3b8e 100644 --- a/src/librustc_back/target/i686_pc_windows_msvc.rs +++ b/src/librustc_back/target/i686_pc_windows_msvc.rs @@ -14,6 +14,10 @@ pub fn target() -> Target { let mut base = super::windows_msvc_base::opts(); base.cpu = "pentium4".to_string(); + // Mark all dynamic libraries and executables as compatible with the larger 4GiB address + // space available to x86 Windows binaries on x86_64. + base.pre_link_args.push("/LARGEADDRESSAWARE".to_string()); + Target { llvm_target: "i686-pc-windows-msvc".to_string(), target_endian: "little".to_string(), From c3320c04986cc3dcb6b0c6ab9e1b896bda493c61 Mon Sep 17 00:00:00 2001 From: Oliver Middleton Date: Tue, 9 Feb 2016 17:20:32 +0000 Subject: [PATCH 2/2] Enable /SAFESEH for i686-pc-windows-msvc --- src/librustc_back/target/i686_pc_windows_msvc.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/librustc_back/target/i686_pc_windows_msvc.rs b/src/librustc_back/target/i686_pc_windows_msvc.rs index 7079df1ab3b8e..7fe6590618941 100644 --- a/src/librustc_back/target/i686_pc_windows_msvc.rs +++ b/src/librustc_back/target/i686_pc_windows_msvc.rs @@ -18,6 +18,11 @@ pub fn target() -> Target { // space available to x86 Windows binaries on x86_64. base.pre_link_args.push("/LARGEADDRESSAWARE".to_string()); + // Ensure the linker will only produce an image if it can also produce a table of + // the image's safe exception handlers. + // https://msdn.microsoft.com/en-us/library/9a89h429.aspx + base.pre_link_args.push("/SAFESEH".to_string()); + Target { llvm_target: "i686-pc-windows-msvc".to_string(), target_endian: "little".to_string(),