Skip to content

Commit 6c0d50f

Browse files
committed
Auto merge of #45224 - malbarbo:x32, r=alexcrichton
Add x86_64-unknown-linux-gnux32 target This adds X32 ABI support for Linux on X86_64. Let's package and dist it so we can star testing libc, libstd, etc. Fixes rust-lang/rfcs#1339
2 parents f5eb33f + 7199fee commit 6c0d50f

File tree

13 files changed

+65
-26
lines changed

13 files changed

+65
-26
lines changed

src/Cargo.lock

+18-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bootstrap/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ cmake = "0.1.23"
3434
filetime = "0.1"
3535
num_cpus = "1.0"
3636
getopts = "0.2"
37-
cc = "1.0"
37+
cc = "1.0.1"
3838
libc = "0.2"
3939
serde = "1.0.8"
4040
serde_derive = "1.0.8"

src/ci/docker/cross2/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ RUN sh /scripts/cross-apt-packages.sh
55

66
RUN apt-get build-dep -y clang llvm && apt-get install -y --no-install-recommends \
77
build-essential \
8+
gcc-multilib \
89
libedit-dev \
910
libgmp-dev \
1011
libisl-dev \
@@ -47,6 +48,7 @@ ENV TARGETS=x86_64-unknown-fuchsia
4748
ENV TARGETS=$TARGETS,aarch64-unknown-fuchsia
4849
ENV TARGETS=$TARGETS,sparcv9-sun-solaris
4950
ENV TARGETS=$TARGETS,x86_64-sun-solaris
51+
ENV TARGETS=$TARGETS,x86_64-unknown-linux-gnux32
5052

5153
ENV RUST_CONFIGURE_ARGS --target=$TARGETS --enable-extended
5254
ENV SCRIPT python2.7 ../x.py dist --target $TARGETS

src/liballoc_jemalloc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ libc = { path = "../rustc/libc_shim" }
1919

2020
[build-dependencies]
2121
build_helper = { path = "../build_helper" }
22-
cc = "1.0"
22+
cc = "1.0.1"
2323

2424
[features]
2525
debug = []

src/libprofiler_builtins/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ doc = false
1515
core = { path = "../libcore" }
1616

1717
[build-dependencies]
18-
cc = "1.0"
18+
cc = "1.0.1"

src/librustc_back/target/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ macro_rules! supported_targets {
135135

136136
supported_targets! {
137137
("x86_64-unknown-linux-gnu", x86_64_unknown_linux_gnu),
138+
("x86_64-unknown-linux-gnux32", x86_64_unknown_linux_gnux32),
138139
("i686-unknown-linux-gnu", i686_unknown_linux_gnu),
139140
("i586-unknown-linux-gnu", i586_unknown_linux_gnu),
140141
("mips-unknown-linux-gnu", mips_unknown_linux_gnu),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright 2017 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 LinkerFlavor;
12+
use target::{Target, TargetResult};
13+
14+
pub fn target() -> TargetResult {
15+
let mut base = super::linux_base::opts();
16+
base.cpu = "x86-64".to_string();
17+
base.max_atomic_width = Some(64);
18+
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-mx32".to_string());
19+
base.stack_probes = true;
20+
base.has_elf_tls = false;
21+
22+
Ok(Target {
23+
llvm_target: "x86_64-unknown-linux-gnux32".to_string(),
24+
target_endian: "little".to_string(),
25+
target_pointer_width: "32".to_string(),
26+
target_c_int_width: "32".to_string(),
27+
data_layout: "e-m:e-p:32:32-i64:64-f80:128-n8:16:32:64-S128".to_string(),
28+
arch: "x86_64".to_string(),
29+
target_os: "linux".to_string(),
30+
target_env: "gnu".to_string(),
31+
target_vendor: "unknown".to_string(),
32+
linker_flavor: LinkerFlavor::Gcc,
33+
options: base,
34+
})
35+
}

src/librustc_llvm/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ rustc_cratesio_shim = { path = "../librustc_cratesio_shim" }
1818

1919
[build-dependencies]
2020
build_helper = { path = "../build_helper" }
21-
cc = "1.0"
21+
cc = "1.0.1"

src/librustc_trans/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ syntax = { path = "../libsyntax" }
3232
syntax_pos = { path = "../libsyntax_pos" }
3333

3434
[target."cfg(windows)".dependencies]
35-
cc = "1.0"
35+
cc = "1.0.1"

src/librustdoc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ html-diff = "0.0.4"
1818

1919
[build-dependencies]
2020
build_helper = { path = "../build_helper" }
21-
cc = "1.0"
21+
cc = "1.0.1"

src/libstd/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ rustc_tsan = { path = "../librustc_tsan" }
3636

3737
[build-dependencies]
3838
build_helper = { path = "../build_helper" }
39-
cc = "1.0"
39+
cc = "1.0.1"
4040

4141
[features]
4242
backtrace = []

src/rustc/compiler_builtins_shim/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ doctest = false
3030
core = { path = "../../libcore" }
3131

3232
[build-dependencies]
33-
cc = "1.0"
33+
cc = "1.0.1"
3434

3535
[features]
3636
c = []

src/tools/build-manifest/src/main.rs

+1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ static TARGETS: &'static [&'static str] = &[
9595
"x86_64-unknown-freebsd",
9696
"x86_64-unknown-fuchsia",
9797
"x86_64-unknown-linux-gnu",
98+
"x86_64-unknown-linux-gnux32",
9899
"x86_64-unknown-linux-musl",
99100
"x86_64-unknown-netbsd",
100101
"x86_64-unknown-redox",

0 commit comments

Comments
 (0)