Skip to content

Commit 40c85cd

Browse files
committed
Auto merge of #32034 - alexcrichton:old-x86-msvc, r=aturon
rustc: Add an i586-pc-windows-msvc target Similarly to #31629 where an i586-unknown-linux-gnu target was added, there is sometimes a desire to compile for x86 Windows as well where SSE2 is disabled. This commit mirrors the i586-unknown-linux-gnu target and simply adds a variant for Windows as well. This is motivated by a recent [Gecko bug][ff] where crashes were seen on 32-bit Windows due to users having CPUs that don't support SSE2 instructions. It was requested that we could have non-SSE2 builds of the standard library available so they could continue to use vanilla releases and nightlies. [ff]: https://bugzilla.mozilla.org/show_bug.cgi?id=1253202
2 parents 2b9438a + 01a2a7f commit 40c85cd

File tree

4 files changed

+51
-14
lines changed

4 files changed

+51
-14
lines changed

mk/cfg/i586-pc-windows-msvc.mk

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# i586-pc-windows-msvc configuration
2+
CC_i586-pc-windows-msvc="$(CFG_MSVC_CL_i386)" -nologo
3+
LINK_i586-pc-windows-msvc="$(CFG_MSVC_LINK_i386)" -nologo
4+
CXX_i586-pc-windows-msvc="$(CFG_MSVC_CL_i386)" -nologo
5+
CPP_i586-pc-windows-msvc="$(CFG_MSVC_CL_i386)" -nologo
6+
AR_i586-pc-windows-msvc="$(CFG_MSVC_LIB_i386)" -nologo
7+
CFG_LIB_NAME_i586-pc-windows-msvc=$(1).dll
8+
CFG_STATIC_LIB_NAME_i586-pc-windows-msvc=$(1).lib
9+
CFG_LIB_GLOB_i586-pc-windows-msvc=$(1)-*.{dll,lib}
10+
CFG_LIB_DSYM_GLOB_i586-pc-windows-msvc=$(1)-*.dylib.dSYM
11+
CFG_JEMALLOC_CFLAGS_i586-pc-windows-msvc :=
12+
CFG_GCCISH_CFLAGS_i586-pc-windows-msvc := -MD -arch:IA32
13+
CFG_GCCISH_CXXFLAGS_i586-pc-windows-msvc := -MD -arch:IA32
14+
CFG_GCCISH_LINK_FLAGS_i586-pc-windows-msvc :=
15+
CFG_GCCISH_DEF_FLAG_i586-pc-windows-msvc :=
16+
CFG_LLC_FLAGS_i586-pc-windows-msvc :=
17+
CFG_INSTALL_NAME_i586-pc-windows-msvc =
18+
CFG_EXE_SUFFIX_i586-pc-windows-msvc := .exe
19+
CFG_WINDOWSY_i586-pc-windows-msvc := 1
20+
CFG_UNIXY_i586-pc-windows-msvc :=
21+
CFG_LDPATH_i586-pc-windows-msvc :=
22+
CFG_RUN_i586-pc-windows-msvc=$(2)
23+
CFG_RUN_TARG_i586-pc-windows-msvc=$(call CFG_RUN_i586-pc-windows-msvc,,$(2))
24+
CFG_GNU_TRIPLE_i586-pc-windows-msvc := i586-pc-win32
25+
26+
# Currently the build system is not configured to build jemalloc
27+
# with MSVC, so we omit this optional dependency.
28+
CFG_DISABLE_JEMALLOC_i586-pc-windows-msvc := 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use target::Target;
12+
13+
pub fn target() -> Target {
14+
let mut base = super::i686_pc_windows_msvc::target();
15+
base.options.cpu = "pentium".to_string();
16+
base.llvm_target = "i586-pc-windows-msvc".to_string();
17+
return base
18+
}

src/librustc_back/target/i586_unknown_linux_gnu.rs

+4-14
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,8 @@
1111
use target::Target;
1212

1313
pub fn target() -> Target {
14-
let mut base = super::linux_base::opts();
15-
base.cpu = "pentium".to_string();
16-
base.pre_link_args.push("-m32".to_string());
17-
18-
Target {
19-
llvm_target: "i586-unknown-linux-gnu".to_string(),
20-
target_endian: "little".to_string(),
21-
target_pointer_width: "32".to_string(),
22-
arch: "x86".to_string(),
23-
target_os: "linux".to_string(),
24-
target_env: "gnu".to_string(),
25-
target_vendor: "unknown".to_string(),
26-
options: base,
27-
}
14+
let mut base = super::i686_unknown_linux_gnu::target();
15+
base.options.cpu = "pentium".to_string();
16+
base.llvm_target = "i586-unknown-linux-gnu".to_string();
17+
return base
2818
}

src/librustc_back/target/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ supported_targets! {
136136

137137
("x86_64-pc-windows-msvc", x86_64_pc_windows_msvc),
138138
("i686-pc-windows-msvc", i686_pc_windows_msvc),
139+
("i586-pc-windows-msvc", i586_pc_windows_msvc),
139140

140141
("le32-unknown-nacl", le32_unknown_nacl),
141142
("asmjs-unknown-emscripten", asmjs_unknown_emscripten)

0 commit comments

Comments
 (0)