Skip to content

Commit 7208d25

Browse files
committed
Rollup merge of rust-lang#30776 - antonblanchard:powerpc64_merge, r=alexcrichton
This adds support for big endian and little endian PowerPC64. make check runs clean apart from one big endian backtrace issue.
2 parents ad83ea6 + 12aec07 commit 7208d25

26 files changed

+440
-34
lines changed

configure

+9-4
Original file line numberDiff line numberDiff line change
@@ -499,13 +499,18 @@ case $CFG_CPUTYPE in
499499
CFG_CPUTYPE=aarch64
500500
;;
501501

502-
# At some point, when ppc64[le] support happens, this will need to do
503-
# something clever. For now it's safe to assume that we're only ever
504-
# interested in building 32 bit.
505-
powerpc | ppc | ppc64)
502+
powerpc | ppc)
506503
CFG_CPUTYPE=powerpc
507504
;;
508505

506+
powerpc64 | ppc64)
507+
CFG_CPUTYPE=powerpc64
508+
;;
509+
510+
powerpc64le | ppc64le)
511+
CFG_CPUTYPE=powerpc64le
512+
;;
513+
509514
x86_64 | x86-64 | x64 | amd64)
510515
CFG_CPUTYPE=x86_64
511516
;;

mk/cfg/powerpc64-unknown-linux-gnu.mk

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# powerpc64-unknown-linux-gnu configuration
2+
CROSS_PREFIX_powerpc64-unknown-linux-gnu=powerpc64-linux-gnu-
3+
CC_powerpc64-unknown-linux-gnu=$(CC)
4+
CXX_powerpc64-unknown-linux-gnu=$(CXX)
5+
CPP_powerpc64-unknown-linux-gnu=$(CPP)
6+
AR_powerpc64-unknown-linux-gnu=$(AR)
7+
CFG_LIB_NAME_powerpc64-unknown-linux-gnu=lib$(1).so
8+
CFG_STATIC_LIB_NAME_powerpc64-unknown-linux-gnu=lib$(1).a
9+
CFG_LIB_GLOB_powerpc64-unknown-linux-gnu=lib$(1)-*.so
10+
CFG_LIB_DSYM_GLOB_powerpc64-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
11+
CFG_CFLAGS_powerpc64-unknown-linux-gnu := -m64 $(CFLAGS)
12+
CFG_GCCISH_CFLAGS_powerpc64-unknown-linux-gnu := -Wall -Werror -g -fPIC -m64 $(CFLAGS)
13+
CFG_GCCISH_CXXFLAGS_powerpc64-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
14+
CFG_GCCISH_LINK_FLAGS_powerpc64-unknown-linux-gnu := -shared -fPIC -ldl -pthread -lrt -g -m64
15+
CFG_GCCISH_DEF_FLAG_powerpc64-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
16+
CFG_LLC_FLAGS_powerpc64-unknown-linux-gnu :=
17+
CFG_INSTALL_NAME_powerpc64-unknown-linux-gnu =
18+
CFG_EXE_SUFFIX_powerpc64-unknown-linux-gnu =
19+
CFG_WINDOWSY_powerpc64-unknown-linux-gnu :=
20+
CFG_UNIXY_powerpc64-unknown-linux-gnu := 1
21+
CFG_LDPATH_powerpc64-unknown-linux-gnu :=
22+
CFG_RUN_powerpc64-unknown-linux-gnu=$(2)
23+
CFG_RUN_TARG_powerpc64-unknown-linux-gnu=$(call CFG_RUN_powerpc64-unknown-linux-gnu,,$(2))
24+
CFG_GNU_TRIPLE_powerpc64-unknown-linux-gnu := powerpc64-unknown-linux-gnu
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# powerpc64le-unknown-linux-gnu configuration
2+
CROSS_PREFIX_powerpc64le-unknown-linux-gnu=powerpc64le-linux-gnu-
3+
CC_powerpc64le-unknown-linux-gnu=$(CC)
4+
CXX_powerpc64le-unknown-linux-gnu=$(CXX)
5+
CPP_powerpc64le-unknown-linux-gnu=$(CPP)
6+
AR_powerpc64le-unknown-linux-gnu=$(AR)
7+
CFG_LIB_NAME_powerpc64le-unknown-linux-gnu=lib$(1).so
8+
CFG_STATIC_LIB_NAME_powerpc64le-unknown-linux-gnu=lib$(1).a
9+
CFG_LIB_GLOB_powerpc64le-unknown-linux-gnu=lib$(1)-*.so
10+
CFG_LIB_DSYM_GLOB_powerpc64le-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
11+
CFG_CFLAGS_powerpc64le-unknown-linux-gnu := -m64 $(CFLAGS)
12+
CFG_GCCISH_CFLAGS_powerpc64le-unknown-linux-gnu := -Wall -Werror -g -fPIC -m64 $(CFLAGS)
13+
CFG_GCCISH_CXXFLAGS_powerpc64le-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
14+
CFG_GCCISH_LINK_FLAGS_powerpc64le-unknown-linux-gnu := -shared -fPIC -ldl -pthread -lrt -g -m64
15+
CFG_GCCISH_DEF_FLAG_powerpc64le-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
16+
CFG_LLC_FLAGS_powerpc64le-unknown-linux-gnu :=
17+
CFG_INSTALL_NAME_powerpc64le-unknown-linux-gnu =
18+
CFG_EXE_SUFFIX_powerpc64le-unknown-linux-gnu =
19+
CFG_WINDOWSY_powerpc64le-unknown-linux-gnu :=
20+
CFG_UNIXY_powerpc64le-unknown-linux-gnu := 1
21+
CFG_LDPATH_powerpc64le-unknown-linux-gnu :=
22+
CFG_RUN_powerpc64le-unknown-linux-gnu=$(2)
23+
CFG_RUN_TARG_powerpc64le-unknown-linux-gnu=$(call CFG_RUN_powerpc64le-unknown-linux-gnu,,$(2))
24+
CFG_GNU_TRIPLE_powerpc64le-unknown-linux-gnu := powerpc64le-unknown-linux-gnu

src/compiletest/util.rs

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ const ARCH_TABLE: &'static [(&'static str, &'static str)] = &[
3838
("mips", "mips"),
3939
("msp430", "msp430"),
4040
("powerpc", "powerpc"),
41+
("powerpc64", "powerpc64"),
42+
("powerpc64le", "powerpc64le"),
4143
("s390x", "systemz"),
4244
("sparc", "sparc"),
4345
("x86_64", "x86_64"),

src/doc/reference.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2044,7 +2044,7 @@ The following configurations must be defined by the implementation:
20442044
production. For example, it controls the behavior of the standard library's
20452045
`debug_assert!` macro.
20462046
* `target_arch = "..."` - Target CPU architecture, such as `"x86"`, `"x86_64"`
2047-
`"mips"`, `"powerpc"`, `"arm"`, or `"aarch64"`.
2047+
`"mips"`, `"powerpc"`, `"powerpc64"`, `"powerpc64le"`, `"arm"`, or `"aarch64"`.
20482048
* `target_endian = "..."` - Endianness of the target CPU, either `"little"` or
20492049
`"big"`.
20502050
* `target_env = ".."` - An option provided by the compiler by default

src/liballoc_jemalloc/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ extern "C" {
5555
const MIN_ALIGN: usize = 8;
5656
#[cfg(all(any(target_arch = "x86",
5757
target_arch = "x86_64",
58-
target_arch = "aarch64")))]
58+
target_arch = "aarch64",
59+
target_arch = "powerpc64",
60+
target_arch = "powerpc64le")))]
5961
const MIN_ALIGN: usize = 16;
6062

6163
// MALLOCX_ALIGN(a) macro

src/liballoc_system/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ extern crate libc;
2929
target_arch = "arm",
3030
target_arch = "mips",
3131
target_arch = "mipsel",
32-
target_arch = "powerpc")))]
32+
target_arch = "powerpc",
33+
target_arch = "powerpc64",
34+
target_arch = "powerpc64le")))]
3335
const MIN_ALIGN: usize = 8;
3436
#[cfg(all(any(target_arch = "x86_64",
3537
target_arch = "aarch64")))]

src/librustc_back/target/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub struct Target {
8080
/// Vendor name to use for conditional compilation.
8181
pub target_vendor: String,
8282
/// Architecture to use for ABI considerations. Valid options: "x86", "x86_64", "arm",
83-
/// "aarch64", "mips", and "powerpc". "mips" includes "mipsel".
83+
/// "aarch64", "mips", "powerpc", "powerpc64" and "powerpc64le". "mips" includes "mipsel".
8484
pub arch: String,
8585
/// Optional settings with defaults.
8686
pub options: TargetOptions,
@@ -413,6 +413,8 @@ impl Target {
413413
mips_unknown_linux_gnu,
414414
mipsel_unknown_linux_gnu,
415415
powerpc_unknown_linux_gnu,
416+
powerpc64_unknown_linux_gnu,
417+
powerpc64le_unknown_linux_gnu,
416418
arm_unknown_linux_gnueabi,
417419
arm_unknown_linux_gnueabihf,
418420
aarch64_unknown_linux_gnu,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2012-2016 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::linux_base::opts();
15+
base.pre_link_args.push("-m64".to_string());
16+
17+
Target {
18+
llvm_target: "powerpc64-unknown-linux-gnu".to_string(),
19+
target_endian: "big".to_string(),
20+
target_pointer_width: "64".to_string(),
21+
arch: "powerpc64".to_string(),
22+
target_os: "linux".to_string(),
23+
target_env: "gnu".to_string(),
24+
target_vendor: "unknown".to_string(),
25+
options: base,
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2012-2016 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::linux_base::opts();
15+
base.pre_link_args.push("-m64".to_string());
16+
17+
Target {
18+
llvm_target: "powerpc64le-unknown-linux-gnu".to_string(),
19+
target_endian: "little".to_string(),
20+
target_pointer_width: "64".to_string(),
21+
arch: "powerpc64le".to_string(),
22+
target_os: "linux".to_string(),
23+
target_env: "gnu".to_string(),
24+
target_vendor: "unknown".to_string(),
25+
options: base,
26+
}
27+
}

src/librustc_trans/trans/cabi.rs

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use trans::cabi_x86_win64;
1919
use trans::cabi_arm;
2020
use trans::cabi_aarch64;
2121
use trans::cabi_powerpc;
22+
use trans::cabi_powerpc64;
2223
use trans::cabi_mips;
2324
use trans::type_::Type;
2425

@@ -127,6 +128,7 @@ pub fn compute_abi_info(ccx: &CrateContext,
127128
},
128129
"mips" => cabi_mips::compute_abi_info(ccx, atys, rty, ret_def),
129130
"powerpc" => cabi_powerpc::compute_abi_info(ccx, atys, rty, ret_def),
131+
"powerpc64" | "powerpc64le" => cabi_powerpc64::compute_abi_info(ccx, atys, rty, ret_def),
130132
a => ccx.sess().fatal(&format!("unrecognized arch \"{}\" in target specification", a)
131133
),
132134
}

0 commit comments

Comments
 (0)