Skip to content

Commit

Permalink
Auto merge of #824 - malbarbo:x32-1, r=alexcrichton
Browse files Browse the repository at this point in the history
Fixes and test for x86_64-unknown-linux-gnux32

This fixes all libc tests and almost all rustc tests (3 libstd tests and one run-pass test fails).

Fixes #816
  • Loading branch information
bors committed Oct 28, 2017
2 parents 25fb72e + e63f46a commit 10ac3df
Show file tree
Hide file tree
Showing 19 changed files with 788 additions and 364 deletions.
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ services:
install:
- if [ -z "$NO_ADD" ]; then rustup target add $TARGET; fi
script:
- cargo build
- cargo build --no-default-features
- cargo build $OPT
- cargo build $OPT --no-default-features
- cargo generate-lockfile --manifest-path libc-test/Cargo.toml
- if [[ $TRAVIS_OS_NAME = "linux" ]]; then
sh ci/run-docker.sh $TARGET;
Expand Down Expand Up @@ -97,6 +97,11 @@ matrix:
env: TARGET=x86_64-apple-darwin NO_ADD=1
osx_image: xcode8.3
rust: nightly
# not available on stable
# without --release the build fails
# see https://github.com/rust-lang/rust/issues/45417
- env: TARGET=x86_64-unknown-linux-gnux32 OPT="--release"
rust: nightly

# QEMU based targets that compile in an emulator
- env: TARGET=x86_64-unknown-freebsd
Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock

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

5 changes: 5 additions & 0 deletions ci/docker/x86_64-unknown-linux-gnux32/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM ubuntu:17.04
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
gcc-multilib libc6-dev ca-certificates
ENV PATH=$PATH:/rust/bin
9 changes: 8 additions & 1 deletion ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,11 @@ if [ "$QEMU" != "" ]; then
exec grep "^PASSED .* tests" $CARGO_TARGET_DIR/out.log
fi

exec cargo test --manifest-path libc-test/Cargo.toml --target $TARGET
# FIXME: x86_64-unknown-linux-gnux32 fail to compile wihout --release
# See https://github.com/rust-lang/rust/issues/45417
opt=
if [ "$TARGET" = "x86_64-unknown-linux-gnux32" ]; then
opt="--release"
fi

exec cargo test $opt --manifest-path libc-test/Cargo.toml --target $TARGET
2 changes: 1 addition & 1 deletion libc-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ build = "build.rs"
libc = { path = ".." }

[build-dependencies]
ctest = "0.1.6"
ctest = { git = "https://github.com/alexcrichton/ctest" }

[[test]]
name = "main"
Expand Down
28 changes: 28 additions & 0 deletions src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,47 @@ s! {
pub ru_utime: timeval,
pub ru_stime: timeval,
pub ru_maxrss: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad1: u32,
pub ru_ixrss: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad2: u32,
pub ru_idrss: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad3: u32,
pub ru_isrss: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad4: u32,
pub ru_minflt: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad5: u32,
pub ru_majflt: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad6: u32,
pub ru_nswap: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad7: u32,
pub ru_inblock: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad8: u32,
pub ru_oublock: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad9: u32,
pub ru_msgsnd: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad10: u32,
pub ru_msgrcv: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad11: u32,
pub ru_nsignals: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad12: u32,
pub ru_nvcsw: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad13: u32,
pub ru_nivcsw: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad14: u32,

#[cfg(any(target_env = "musl", target_os = "emscripten"))]
__reserved: [c_long; 16],
Expand Down
3 changes: 3 additions & 0 deletions src/unix/notbsd/linux/mips/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
pub type shmatt_t = ::c_ulong;
pub type msgqnum_t = ::c_ulong;
pub type msglen_t = ::c_ulong;
pub type fsblkcnt_t = ::c_ulong;
pub type fsfilcnt_t = ::c_ulong;
pub type rlim_t = c_ulong;
Expand Down
39 changes: 25 additions & 14 deletions src/unix/notbsd/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ pub type ino64_t = u64;
pub type off64_t = i64;
pub type blkcnt64_t = i64;
pub type rlim64_t = u64;
pub type shmatt_t = ::c_ulong;
pub type mqd_t = ::c_int;
pub type msgqnum_t = ::c_ulong;
pub type msglen_t = ::c_ulong;
pub type nfds_t = ::c_ulong;
pub type nl_item = ::c_int;
pub type idtype_t = ::c_uint;
Expand Down Expand Up @@ -74,21 +71,33 @@ s! {
}

pub struct pthread_mutex_t {
#[cfg(any(target_arch = "mips", target_arch = "arm",
target_arch = "powerpc"))]
#[cfg(any(target_arch = "mips",
target_arch = "arm",
target_arch = "powerpc",
all(target_arch = "x86_64",
target_pointer_width = "32")))]
__align: [::c_long; 0],
#[cfg(not(any(target_arch = "mips", target_arch = "arm",
target_arch = "powerpc")))]
#[cfg(not(any(target_arch = "mips",
target_arch = "arm",
target_arch = "powerpc",
all(target_arch = "x86_64",
target_pointer_width = "32"))))]
__align: [::c_longlong; 0],
size: [u8; __SIZEOF_PTHREAD_MUTEX_T],
}

pub struct pthread_rwlock_t {
#[cfg(any(target_arch = "mips", target_arch = "arm",
target_arch = "powerpc"))]
#[cfg(any(target_arch = "mips",
target_arch = "arm",
target_arch = "powerpc",
all(target_arch = "x86_64",
target_pointer_width = "32")))]
__align: [::c_long; 0],
#[cfg(not(any(target_arch = "mips", target_arch = "arm",
target_arch = "powerpc")))]
#[cfg(not(any(target_arch = "mips",
target_arch = "arm",
target_arch = "powerpc",
all(target_arch = "x86_64",
target_pointer_width = "32"))))]
__align: [::c_longlong; 0],
size: [u8; __SIZEOF_PTHREAD_RWLOCK_T],
}
Expand Down Expand Up @@ -163,7 +172,7 @@ s! {
pub f_favail: ::fsfilcnt_t,
#[cfg(target_endian = "little")]
pub f_fsid: ::c_ulong,
#[cfg(target_pointer_width = "32")]
#[cfg(all(target_pointer_width = "32", not(target_arch = "x86_64")))]
__f_unused: ::c_int,
#[cfg(target_endian = "big")]
pub f_fsid: ::c_ulong,
Expand Down Expand Up @@ -240,9 +249,11 @@ s! {
}

pub struct cpu_set_t {
#[cfg(target_pointer_width = "32")]
#[cfg(all(target_pointer_width = "32",
not(target_arch = "x86_64")))]
bits: [u32; 32],
#[cfg(target_pointer_width = "64")]
#[cfg(not(all(target_pointer_width = "32",
not(target_arch = "x86_64"))))]
bits: [u64; 16],
}

Expand Down
3 changes: 3 additions & 0 deletions src/unix/notbsd/linux/musl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ pub type ino_t = u64;
pub type off_t = i64;
pub type blkcnt_t = i64;

pub type shmatt_t = ::c_ulong;
pub type msgqnum_t = ::c_ulong;
pub type msglen_t = ::c_ulong;
pub type fsblkcnt_t = ::c_ulonglong;
pub type fsfilcnt_t = ::c_ulonglong;
pub type rlim_t = ::c_ulonglong;
Expand Down
6 changes: 6 additions & 0 deletions src/unix/notbsd/linux/other/b32/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ pub type off_t = i32;
pub type blkcnt_t = i32;
pub type __fsword_t = i32;

pub type fsblkcnt_t = ::c_ulong;
pub type fsfilcnt_t = ::c_ulong;
pub type rlim_t = c_ulong;
pub type shmatt_t = ::c_ulong;
pub type msgqnum_t = ::c_ulong;
pub type msglen_t = ::c_ulong;
pub type blksize_t = i32;
pub type nlink_t = u32;
pub type __u64 = ::c_ulonglong;
Expand Down
2 changes: 2 additions & 0 deletions src/unix/notbsd/linux/other/b64/aarch64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ s! {
}
}

pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;

pub const TIOCGSOFTCAR: ::c_ulong = 0x5419;
pub const TIOCSSOFTCAR: ::c_ulong = 0x541A;

Expand Down
20 changes: 14 additions & 6 deletions src/unix/notbsd/linux/other/b64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,20 @@ pub type time_t = i64;
pub type ino_t = u64;
pub type off_t = i64;
pub type blkcnt_t = i64;
pub type __fsword_t = ::c_long;
pub type __fsword_t = i64;
pub type shmatt_t = u64;
pub type msgqnum_t = u64;
pub type msglen_t = u64;
pub type fsblkcnt_t = u64;
pub type fsfilcnt_t = u64;
pub type rlim_t = u64;

s! {
pub struct sigset_t {
__val: [::c_ulong; 16],
#[cfg(target_pointer_width = "32")]
__val: [u32; 32],
#[cfg(target_pointer_width = "64")]
__val: [u64; 16],
}

pub struct sysinfo {
Expand All @@ -34,17 +43,16 @@ s! {
pub msg_stime: ::time_t,
pub msg_rtime: ::time_t,
pub msg_ctime: ::time_t,
__msg_cbytes: ::c_ulong,
__msg_cbytes: u64,
pub msg_qnum: ::msgqnum_t,
pub msg_qbytes: ::msglen_t,
pub msg_lspid: ::pid_t,
pub msg_lrpid: ::pid_t,
__glibc_reserved4: ::c_ulong,
__glibc_reserved5: ::c_ulong,
__glibc_reserved4: u64,
__glibc_reserved5: u64,
}
}

pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;

pub const O_LARGEFILE: ::c_int = 0;
Expand Down
Loading

0 comments on commit 10ac3df

Please sign in to comment.