Skip to content

Commit

Permalink
Auto merge of #45224 - malbarbo:x32, r=alexcrichton
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Oct 15, 2017
2 parents f5eb33f + 7199fee commit 6c0d50f
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 26 deletions.
36 changes: 18 additions & 18 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/bootstrap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ cmake = "0.1.23"
filetime = "0.1"
num_cpus = "1.0"
getopts = "0.2"
cc = "1.0"
cc = "1.0.1"
libc = "0.2"
serde = "1.0.8"
serde_derive = "1.0.8"
Expand Down
2 changes: 2 additions & 0 deletions src/ci/docker/cross2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ RUN sh /scripts/cross-apt-packages.sh

RUN apt-get build-dep -y clang llvm && apt-get install -y --no-install-recommends \
build-essential \
gcc-multilib \
libedit-dev \
libgmp-dev \
libisl-dev \
Expand Down Expand Up @@ -47,6 +48,7 @@ ENV TARGETS=x86_64-unknown-fuchsia
ENV TARGETS=$TARGETS,aarch64-unknown-fuchsia
ENV TARGETS=$TARGETS,sparcv9-sun-solaris
ENV TARGETS=$TARGETS,x86_64-sun-solaris
ENV TARGETS=$TARGETS,x86_64-unknown-linux-gnux32

ENV RUST_CONFIGURE_ARGS --target=$TARGETS --enable-extended
ENV SCRIPT python2.7 ../x.py dist --target $TARGETS
2 changes: 1 addition & 1 deletion src/liballoc_jemalloc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ libc = { path = "../rustc/libc_shim" }

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

[features]
debug = []
2 changes: 1 addition & 1 deletion src/libprofiler_builtins/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ doc = false
core = { path = "../libcore" }

[build-dependencies]
cc = "1.0"
cc = "1.0.1"
1 change: 1 addition & 0 deletions src/librustc_back/target/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ macro_rules! supported_targets {

supported_targets! {
("x86_64-unknown-linux-gnu", x86_64_unknown_linux_gnu),
("x86_64-unknown-linux-gnux32", x86_64_unknown_linux_gnux32),
("i686-unknown-linux-gnu", i686_unknown_linux_gnu),
("i586-unknown-linux-gnu", i586_unknown_linux_gnu),
("mips-unknown-linux-gnu", mips_unknown_linux_gnu),
Expand Down
35 changes: 35 additions & 0 deletions src/librustc_back/target/x86_64_unknown_linux_gnux32.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use LinkerFlavor;
use target::{Target, TargetResult};

pub fn target() -> TargetResult {
let mut base = super::linux_base::opts();
base.cpu = "x86-64".to_string();
base.max_atomic_width = Some(64);
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-mx32".to_string());
base.stack_probes = true;
base.has_elf_tls = false;

Ok(Target {
llvm_target: "x86_64-unknown-linux-gnux32".to_string(),
target_endian: "little".to_string(),
target_pointer_width: "32".to_string(),
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-i64:64-f80:128-n8:16:32:64-S128".to_string(),
arch: "x86_64".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: base,
})
}
2 changes: 1 addition & 1 deletion src/librustc_llvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ rustc_cratesio_shim = { path = "../librustc_cratesio_shim" }

[build-dependencies]
build_helper = { path = "../build_helper" }
cc = "1.0"
cc = "1.0.1"
2 changes: 1 addition & 1 deletion src/librustc_trans/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" }

[target."cfg(windows)".dependencies]
cc = "1.0"
cc = "1.0.1"
2 changes: 1 addition & 1 deletion src/librustdoc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ html-diff = "0.0.4"

[build-dependencies]
build_helper = { path = "../build_helper" }
cc = "1.0"
cc = "1.0.1"
2 changes: 1 addition & 1 deletion src/libstd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ rustc_tsan = { path = "../librustc_tsan" }

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

[features]
backtrace = []
Expand Down
2 changes: 1 addition & 1 deletion src/rustc/compiler_builtins_shim/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ doctest = false
core = { path = "../../libcore" }

[build-dependencies]
cc = "1.0"
cc = "1.0.1"

[features]
c = []
Expand Down
1 change: 1 addition & 0 deletions src/tools/build-manifest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ static TARGETS: &'static [&'static str] = &[
"x86_64-unknown-freebsd",
"x86_64-unknown-fuchsia",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-gnux32",
"x86_64-unknown-linux-musl",
"x86_64-unknown-netbsd",
"x86_64-unknown-redox",
Expand Down

0 comments on commit 6c0d50f

Please sign in to comment.