Skip to content

Commit 10ac3df

Browse files
committed
Auto merge of #824 - malbarbo:x32-1, r=alexcrichton
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
2 parents 25fb72e + e63f46a commit 10ac3df

File tree

19 files changed

+788
-364
lines changed

19 files changed

+788
-364
lines changed

.travis.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ services:
77
install:
88
- if [ -z "$NO_ADD" ]; then rustup target add $TARGET; fi
99
script:
10-
- cargo build
11-
- cargo build --no-default-features
10+
- cargo build $OPT
11+
- cargo build $OPT --no-default-features
1212
- cargo generate-lockfile --manifest-path libc-test/Cargo.toml
1313
- if [[ $TRAVIS_OS_NAME = "linux" ]]; then
1414
sh ci/run-docker.sh $TARGET;
@@ -97,6 +97,11 @@ matrix:
9797
env: TARGET=x86_64-apple-darwin NO_ADD=1
9898
osx_image: xcode8.3
9999
rust: nightly
100+
# not available on stable
101+
# without --release the build fails
102+
# see https://github.com/rust-lang/rust/issues/45417
103+
- env: TARGET=x86_64-unknown-linux-gnux32 OPT="--release"
104+
rust: nightly
100105

101106
# QEMU based targets that compile in an emulator
102107
- env: TARGET=x86_64-unknown-freebsd

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM ubuntu:17.04
2+
RUN apt-get update
3+
RUN apt-get install -y --no-install-recommends \
4+
gcc-multilib libc6-dev ca-certificates
5+
ENV PATH=$PATH:/rust/bin

ci/run.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,11 @@ if [ "$QEMU" != "" ]; then
6868
exec grep "^PASSED .* tests" $CARGO_TARGET_DIR/out.log
6969
fi
7070

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

libc-test/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ build = "build.rs"
88
libc = { path = ".." }
99

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

1313
[[test]]
1414
name = "main"

src/unix/mod.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,47 @@ s! {
5353
pub ru_utime: timeval,
5454
pub ru_stime: timeval,
5555
pub ru_maxrss: c_long,
56+
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
57+
__pad1: u32,
5658
pub ru_ixrss: c_long,
59+
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
60+
__pad2: u32,
5761
pub ru_idrss: c_long,
62+
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
63+
__pad3: u32,
5864
pub ru_isrss: c_long,
65+
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
66+
__pad4: u32,
5967
pub ru_minflt: c_long,
68+
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
69+
__pad5: u32,
6070
pub ru_majflt: c_long,
71+
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
72+
__pad6: u32,
6173
pub ru_nswap: c_long,
74+
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
75+
__pad7: u32,
6276
pub ru_inblock: c_long,
77+
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
78+
__pad8: u32,
6379
pub ru_oublock: c_long,
80+
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
81+
__pad9: u32,
6482
pub ru_msgsnd: c_long,
83+
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
84+
__pad10: u32,
6585
pub ru_msgrcv: c_long,
86+
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
87+
__pad11: u32,
6688
pub ru_nsignals: c_long,
89+
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
90+
__pad12: u32,
6791
pub ru_nvcsw: c_long,
92+
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
93+
__pad13: u32,
6894
pub ru_nivcsw: c_long,
95+
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
96+
__pad14: u32,
6997

7098
#[cfg(any(target_env = "musl", target_os = "emscripten"))]
7199
__reserved: [c_long; 16],

src/unix/notbsd/linux/mips/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
pub type shmatt_t = ::c_ulong;
2+
pub type msgqnum_t = ::c_ulong;
3+
pub type msglen_t = ::c_ulong;
14
pub type fsblkcnt_t = ::c_ulong;
25
pub type fsfilcnt_t = ::c_ulong;
36
pub type rlim_t = c_ulong;

src/unix/notbsd/linux/mod.rs

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ pub type ino64_t = u64;
1111
pub type off64_t = i64;
1212
pub type blkcnt64_t = i64;
1313
pub type rlim64_t = u64;
14-
pub type shmatt_t = ::c_ulong;
1514
pub type mqd_t = ::c_int;
16-
pub type msgqnum_t = ::c_ulong;
17-
pub type msglen_t = ::c_ulong;
1815
pub type nfds_t = ::c_ulong;
1916
pub type nl_item = ::c_int;
2017
pub type idtype_t = ::c_uint;
@@ -74,21 +71,33 @@ s! {
7471
}
7572

7673
pub struct pthread_mutex_t {
77-
#[cfg(any(target_arch = "mips", target_arch = "arm",
78-
target_arch = "powerpc"))]
74+
#[cfg(any(target_arch = "mips",
75+
target_arch = "arm",
76+
target_arch = "powerpc",
77+
all(target_arch = "x86_64",
78+
target_pointer_width = "32")))]
7979
__align: [::c_long; 0],
80-
#[cfg(not(any(target_arch = "mips", target_arch = "arm",
81-
target_arch = "powerpc")))]
80+
#[cfg(not(any(target_arch = "mips",
81+
target_arch = "arm",
82+
target_arch = "powerpc",
83+
all(target_arch = "x86_64",
84+
target_pointer_width = "32"))))]
8285
__align: [::c_longlong; 0],
8386
size: [u8; __SIZEOF_PTHREAD_MUTEX_T],
8487
}
8588

8689
pub struct pthread_rwlock_t {
87-
#[cfg(any(target_arch = "mips", target_arch = "arm",
88-
target_arch = "powerpc"))]
90+
#[cfg(any(target_arch = "mips",
91+
target_arch = "arm",
92+
target_arch = "powerpc",
93+
all(target_arch = "x86_64",
94+
target_pointer_width = "32")))]
8995
__align: [::c_long; 0],
90-
#[cfg(not(any(target_arch = "mips", target_arch = "arm",
91-
target_arch = "powerpc")))]
96+
#[cfg(not(any(target_arch = "mips",
97+
target_arch = "arm",
98+
target_arch = "powerpc",
99+
all(target_arch = "x86_64",
100+
target_pointer_width = "32"))))]
92101
__align: [::c_longlong; 0],
93102
size: [u8; __SIZEOF_PTHREAD_RWLOCK_T],
94103
}
@@ -163,7 +172,7 @@ s! {
163172
pub f_favail: ::fsfilcnt_t,
164173
#[cfg(target_endian = "little")]
165174
pub f_fsid: ::c_ulong,
166-
#[cfg(target_pointer_width = "32")]
175+
#[cfg(all(target_pointer_width = "32", not(target_arch = "x86_64")))]
167176
__f_unused: ::c_int,
168177
#[cfg(target_endian = "big")]
169178
pub f_fsid: ::c_ulong,
@@ -240,9 +249,11 @@ s! {
240249
}
241250

242251
pub struct cpu_set_t {
243-
#[cfg(target_pointer_width = "32")]
252+
#[cfg(all(target_pointer_width = "32",
253+
not(target_arch = "x86_64")))]
244254
bits: [u32; 32],
245-
#[cfg(target_pointer_width = "64")]
255+
#[cfg(not(all(target_pointer_width = "32",
256+
not(target_arch = "x86_64"))))]
246257
bits: [u64; 16],
247258
}
248259

src/unix/notbsd/linux/musl/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ pub type ino_t = u64;
55
pub type off_t = i64;
66
pub type blkcnt_t = i64;
77

8+
pub type shmatt_t = ::c_ulong;
9+
pub type msgqnum_t = ::c_ulong;
10+
pub type msglen_t = ::c_ulong;
811
pub type fsblkcnt_t = ::c_ulonglong;
912
pub type fsfilcnt_t = ::c_ulonglong;
1013
pub type rlim_t = ::c_ulonglong;

src/unix/notbsd/linux/other/b32/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ pub type off_t = i32;
1010
pub type blkcnt_t = i32;
1111
pub type __fsword_t = i32;
1212

13+
pub type fsblkcnt_t = ::c_ulong;
14+
pub type fsfilcnt_t = ::c_ulong;
15+
pub type rlim_t = c_ulong;
16+
pub type shmatt_t = ::c_ulong;
17+
pub type msgqnum_t = ::c_ulong;
18+
pub type msglen_t = ::c_ulong;
1319
pub type blksize_t = i32;
1420
pub type nlink_t = u32;
1521
pub type __u64 = ::c_ulonglong;

0 commit comments

Comments
 (0)