Skip to content

Commit 4ca5795

Browse files
committed
Add linker arguments from i686-pc-windows-msvc to LLD too
1 parent 3761dcd commit 4ca5795

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/librustc_target/spec/i686_pc_windows_msvc.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
1-
use crate::spec::{LinkerFlavor, Target, TargetResult};
1+
use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetResult};
22

33
pub fn target() -> TargetResult {
44
let mut base = super::windows_msvc_base::opts();
55
base.cpu = "pentium4".to_string();
66
base.max_atomic_width = Some(64);
77

8-
// Mark all dynamic libraries and executables as compatible with the larger 4GiB address
9-
// space available to x86 Windows binaries on x86_64.
10-
base.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap().push("/LARGEADDRESSAWARE".to_string());
8+
let pre_link_args = vec![
9+
// Mark all dynamic libraries and executables as compatible with the larger 4GiB address
10+
// space available to x86 Windows binaries on x86_64.
11+
"/LARGEADDRESSAWARE".to_string(),
12+
// Ensure the linker will only produce an image if it can also produce a table of
13+
// the image's safe exception handlers.
14+
// https://docs.microsoft.com/en-us/cpp/build/reference/safeseh-image-has-safe-exception-handlers
15+
"/SAFESEH".to_string(),
16+
];
1117

12-
// Ensure the linker will only produce an image if it can also produce a table of
13-
// the image's safe exception handlers.
14-
// https://docs.microsoft.com/en-us/cpp/build/reference/safeseh-image-has-safe-exception-handlers
15-
base.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap().push("/SAFESEH".to_string());
18+
base.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap().extend_from_slice(&pre_link_args);
19+
base.pre_link_args
20+
.get_mut(&LinkerFlavor::Lld(LldFlavor::Link))
21+
.unwrap()
22+
.extend_from_slice(&pre_link_args);
1623

1724
Ok(Target {
1825
llvm_target: "i686-pc-windows-msvc".to_string(),

0 commit comments

Comments
 (0)