This adds support for building the Rust compiler and standard
library for s390x-linux, allowing a full cross-bootstrap sequence
to complete. This includes:
- Makefile/configure changes to allow native s390x builds
- Full Rust compiler support for the s390x C ABI
(only the non-vector ABI is supported at this point)
- Port of the standard library to s390x
- Update the liblibc submodule to a version including s390x support
- Testsuite fixes to allow clean "make check" on s390x
Caveats:
- Resets base cpu to "z10" to bring support in sync with the default
behaviour of other compilers on the platforms. (Usually, upstream
supports all older processors; a distribution build may then chose
to require a more recent base version.) (Also, using zEC12 causes
failures in the valgrind tests since valgrind doesn't fully support
this CPU yet.)
- z13 vector ABI is not yet supported. To ensure compatible code
generation, the -vector feature is passed to LLVM. Note that this
means that even when compiling for z13, no vector instructions
will be used. In the future, support for the vector ABI should be
added (this will require common code support for different ABIs
that need different data_layout strings on the same platform).
- Two test cases are (temporarily) ignored on s390x to allow passing
the test suite. The underlying issues still need to be fixed:
* debuginfo/simd.rs fails because of incorrect debug information.
This seems to be a LLVM bug (also seen with C code).
* run-pass/union/union-basic.rs simply seems to be incorrect for
all big-endian platforms.
Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
92 lines
4.1 KiB
Rust
92 lines
4.1 KiB
Rust
// Copyright 2015 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.
|
|
|
|
//! Raw OS-specific types for the current platform/architecture
|
|
|
|
#![stable(feature = "raw_os", since = "1.1.0")]
|
|
|
|
#[cfg(any(target_os = "android",
|
|
target_os = "emscripten",
|
|
all(target_os = "linux", any(target_arch = "aarch64",
|
|
target_arch = "arm",
|
|
target_arch = "powerpc",
|
|
target_arch = "powerpc64",
|
|
target_arch = "s390x"))))]
|
|
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = u8;
|
|
#[cfg(not(any(target_os = "android",
|
|
target_os = "emscripten",
|
|
all(target_os = "linux", any(target_arch = "aarch64",
|
|
target_arch = "arm",
|
|
target_arch = "powerpc",
|
|
target_arch = "powerpc64",
|
|
target_arch = "s390x")))))]
|
|
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = i8;
|
|
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_schar = i8;
|
|
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_uchar = u8;
|
|
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_short = i16;
|
|
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_ushort = u16;
|
|
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_int = i32;
|
|
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_uint = u32;
|
|
#[cfg(any(target_pointer_width = "32", windows))]
|
|
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_long = i32;
|
|
#[cfg(any(target_pointer_width = "32", windows))]
|
|
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_ulong = u32;
|
|
#[cfg(all(target_pointer_width = "64", not(windows)))]
|
|
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_long = i64;
|
|
#[cfg(all(target_pointer_width = "64", not(windows)))]
|
|
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_ulong = u64;
|
|
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_longlong = i64;
|
|
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_ulonglong = u64;
|
|
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_float = f32;
|
|
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_double = f64;
|
|
|
|
/// Type used to construct void pointers for use with C.
|
|
///
|
|
/// This type is only useful as a pointer target. Do not use it as a
|
|
/// return type for FFI functions which have the `void` return type in
|
|
/// C. Use the unit type `()` or omit the return type instead.
|
|
// NB: For LLVM to recognize the void pointer type and by extension
|
|
// functions like malloc(), we need to have it represented as i8* in
|
|
// LLVM bitcode. The enum used here ensures this and prevents misuse
|
|
// of the "raw" type by only having private variants.. We need two
|
|
// variants, because the compiler complains about the repr attribute
|
|
// otherwise.
|
|
#[repr(u8)]
|
|
#[stable(feature = "raw_os", since = "1.1.0")]
|
|
pub enum c_void {
|
|
#[unstable(feature = "c_void_variant", reason = "should not have to exist",
|
|
issue = "0")]
|
|
#[doc(hidden)] __variant1,
|
|
#[unstable(feature = "c_void_variant", reason = "should not have to exist",
|
|
issue = "0")]
|
|
#[doc(hidden)] __variant2,
|
|
}
|
|
|
|
#[cfg(test)]
|
|
#[allow(unused_imports)]
|
|
mod tests {
|
|
use any::TypeId;
|
|
use libc;
|
|
use mem;
|
|
|
|
macro_rules! ok {
|
|
($($t:ident)*) => {$(
|
|
assert!(TypeId::of::<libc::$t>() == TypeId::of::<raw::$t>(),
|
|
"{} is wrong", stringify!($t));
|
|
)*}
|
|
}
|
|
|
|
#[test]
|
|
fn same() {
|
|
use os::raw;
|
|
ok!(c_char c_schar c_uchar c_short c_ushort c_int c_uint c_long c_ulong
|
|
c_longlong c_ulonglong c_float c_double);
|
|
}
|
|
}
|