Skip to content

Commit

Permalink
Auto merge of #1296 - gnzlbg:build_uclib, r=gnzlbg
Browse files Browse the repository at this point in the history
Check that more targets build
  • Loading branch information
bors committed Mar 3, 2019
2 parents 8d94e00 + 183c51b commit 83d97c2
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 106 deletions.
16 changes: 12 additions & 4 deletions ci/build.sh
Expand Up @@ -167,11 +167,11 @@ done
# FIXME: https://github.com/rust-lang/rust/issues/58564
# sparc-unknown-linux-gnu
RUST_LINUX_NO_CORE_TARGETS="\
x86_64-unknown-hermit \
x86_64-unknown-dragonfly \
aarch64-unknown-hermit \
aarch64-pc-windows-msvc \
aarch64-unknown-cloudabi \
aarch64-unknown-hermit \
aarch64-unknown-netbsd \
aarch64-unknown-openbsd \
armebv7r-none-eabi \
armebv7r-none-eabihf \
armv7-unknown-cloudabi-eabihf \
Expand All @@ -182,8 +182,12 @@ i686-pc-windows-msvc \
i686-unknown-cloudabi \
i686-unknown-haiku \
i686-unknown-netbsd \
i686-unknown-openbsd \
mips-unknown-linux-uclibc \
mipsel-unknown-linux-uclibc \
nvptx64-nvidia-cuda \
powerpc-unknown-linux-gnuspe \
powerpc-unknown-netbsd \
riscv32imac-unknown-none-elf \
riscv32imc-unknown-none-elf \
sparc64-unknown-netbsd \
Expand All @@ -196,8 +200,12 @@ thumbv7neon-unknown-linux-gnueabihf \
thumbv8m.main-none-eabi \
x86_64-pc-windows-msvc
x86_64-unknown-bitrig \
x86_64-unknown-dragonfly \
x86_64-unknown-dragonfly \
x86_64-unknown-haiku \
x86_64-unknown-openbsd
x86_64-unknown-hermit \
x86_64-unknown-l4re-uclibc \
x86_64-unknown-openbsd \
"

if [ "${RUST}" = "nightly" ] && [ "${OS}" = "linux" ]; then
Expand Down
61 changes: 33 additions & 28 deletions src/unix/uclibc/align.rs
@@ -1,6 +1,37 @@
macro_rules! expand_align {
() => {
s! {
#[cfg_attr(any(target_pointer_width = "32",
target_arch = "x86_64",
target_arch = "powerpc64",
target_arch = "mips64",
target_arch = "s390x",
target_arch = "sparc64"),
repr(align(4)))]
#[cfg_attr(not(any(target_pointer_width = "32",
target_arch = "x86_64",
target_arch = "powerpc64",
target_arch = "mips64",
target_arch = "s390x",
target_arch = "sparc64")),
repr(align(8)))]
pub struct pthread_mutexattr_t {
size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T],
}

#[repr(align(4))]
pub struct pthread_condattr_t {
size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T],
}
}

s_no_extra_traits! {
#[repr(align(8))]
#[allow(missing_debug_implementations)]
pub struct pthread_cond_t {
size: [u8; ::__SIZEOF_PTHREAD_COND_T],
}

#[cfg_attr(all(target_pointer_width = "32",
any(target_arch = "mips",
target_arch = "arm",
Expand All @@ -11,6 +42,7 @@ macro_rules! expand_align {
target_arch = "arm",
target_arch = "powerpc"))),
repr(align(8)))]
#[allow(missing_debug_implementations)]
pub struct pthread_mutex_t {
size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T],
}
Expand All @@ -25,37 +57,10 @@ macro_rules! expand_align {
target_arch = "arm",
target_arch = "powerpc"))),
repr(align(8)))]
#[allow(missing_debug_implementations)]
pub struct pthread_rwlock_t {
size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T],
}

#[cfg_attr(any(target_pointer_width = "32",
target_arch = "x86_64",
target_arch = "powerpc64",
target_arch = "mips64",
target_arch = "s390x",
target_arch = "sparc64"),
repr(align(4)))]
#[cfg_attr(not(any(target_pointer_width = "32",
target_arch = "x86_64",
target_arch = "powerpc64",
target_arch = "mips64",
target_arch = "s390x",
target_arch = "sparc64")),
repr(align(8)))]
pub struct pthread_mutexattr_t {
size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T],
}

#[repr(align(8))]
pub struct pthread_cond_t {
size: [u8; ::__SIZEOF_PTHREAD_COND_T],
}

#[repr(align(4))]
pub struct pthread_condattr_t {
size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T],
}
}
}
}
84 changes: 45 additions & 39 deletions src/unix/uclibc/mod.rs
Expand Up @@ -66,20 +66,6 @@ s! {
pub sin6_scope_id: u32,
}

pub struct sockaddr_un {
pub sun_family: sa_family_t,
pub sun_path: [::c_char; 108]
}

pub struct sockaddr_storage {
pub ss_family: sa_family_t,
__ss_align: ::size_t,
#[cfg(target_pointer_width = "32")]
__ss_pad2: [u8; 128 - 2 * 4],
#[cfg(target_pointer_width = "64")]
__ss_pad2: [u8; 128 - 2 * 8],
}

pub struct addrinfo {
pub ai_flags: ::c_int,
pub ai_family: ::c_int,
Expand Down Expand Up @@ -140,15 +126,6 @@ s! {
pub dli_saddr: *mut ::c_void,
}

pub struct utsname {
pub sysname: [::c_char; 65],
pub nodename: [::c_char; 65],
pub release: [::c_char; 65],
pub version: [::c_char; 65],
pub machine: [::c_char; 65],
pub domainname: [::c_char; 65]
}

pub struct lconv {
pub decimal_point: *mut ::c_char,
pub thousands_sep: *mut ::c_char,
Expand Down Expand Up @@ -189,22 +166,6 @@ s! {
__unused1: [::c_int; 12]
}

pub struct dirent {
pub d_ino: ::ino_t,
pub d_off: ::off_t,
pub d_reclen: ::c_ushort,
pub d_type: ::c_uchar,
pub d_name: [::c_char; 256],
}

pub struct dirent64 {
pub d_ino: ::ino64_t,
pub d_off: ::off64_t,
pub d_reclen: ::c_ushort,
pub d_type: ::c_uchar,
pub d_name: [::c_char; 256],
}

pub struct rlimit64 {
pub rlim_cur: rlim64_t,
pub rlim_max: rlim64_t,
Expand Down Expand Up @@ -358,10 +319,55 @@ s_no_extra_traits! {
any(target_arch = "x86", target_arch = "x86_64"),
repr(packed)
)]
#[allow(missing_debug_implementations)]
pub struct epoll_event {
pub events: ::uint32_t,
pub u64: ::uint64_t,
}

#[allow(missing_debug_implementations)]
pub struct sockaddr_un {
pub sun_family: sa_family_t,
pub sun_path: [::c_char; 108]
}

#[allow(missing_debug_implementations)]
pub struct sockaddr_storage {
pub ss_family: sa_family_t,
__ss_align: ::size_t,
#[cfg(target_pointer_width = "32")]
__ss_pad2: [u8; 128 - 2 * 4],
#[cfg(target_pointer_width = "64")]
__ss_pad2: [u8; 128 - 2 * 8],
}

#[allow(missing_debug_implementations)]
pub struct utsname {
pub sysname: [::c_char; 65],
pub nodename: [::c_char; 65],
pub release: [::c_char; 65],
pub version: [::c_char; 65],
pub machine: [::c_char; 65],
pub domainname: [::c_char; 65]
}

#[allow(missing_debug_implementations)]
pub struct dirent {
pub d_ino: ::ino_t,
pub d_off: ::off_t,
pub d_reclen: ::c_ushort,
pub d_type: ::c_uchar,
pub d_name: [::c_char; 256],
}

#[allow(missing_debug_implementations)]
pub struct dirent64 {
pub d_ino: ::ino64_t,
pub d_off: ::off64_t,
pub d_reclen: ::c_ushort,
pub d_type: ::c_uchar,
pub d_name: [::c_char; 256],
}
}

// intentionally not public, only used for fd_set
Expand Down
43 changes: 24 additions & 19 deletions src/unix/uclibc/x86_64/align.rs
Expand Up @@ -12,20 +12,6 @@ macro_rules! expand_align {
__size: [::c_char; 32],
}

#[cfg_attr(all(target_pointer_width = "32",
any(target_arch = "mips",
target_arch = "arm",
target_arch = "powerpc")),
repr(align(4)))]
#[cfg_attr(all(any(target_pointer_width = "64",
not(any(target_arch = "mips",
target_arch = "arm",
target_arch = "powerpc")))),
repr(align(8)))]
pub struct pthread_mutex_t { // ToDo
size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T],
}

#[cfg_attr(any(target_pointer_width = "32",
target_arch = "x86_64",
target_arch = "powerpc64",
Expand All @@ -44,15 +30,33 @@ macro_rules! expand_align {
size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T],
}

#[repr(align(8))]
pub struct pthread_cond_t { // ToDo
size: [u8; ::__SIZEOF_PTHREAD_COND_T],
}

#[repr(align(4))]
pub struct pthread_condattr_t { // ToDo
size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T],
}
}

s_no_extra_traits! {
#[cfg_attr(all(target_pointer_width = "32",
any(target_arch = "mips",
target_arch = "arm",
target_arch = "powerpc")),
repr(align(4)))]
#[cfg_attr(all(any(target_pointer_width = "64",
not(any(target_arch = "mips",
target_arch = "arm",
target_arch = "powerpc")))),
repr(align(8)))]
#[allow(missing_debug_implementations)]
pub struct pthread_mutex_t { // ToDo
size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T],
}

#[repr(align(8))]
#[allow(missing_debug_implementations)]
pub struct pthread_cond_t { // ToDo
size: [u8; ::__SIZEOF_PTHREAD_COND_T],
}

#[cfg_attr(all(target_pointer_width = "32",
any(target_arch = "mips",
Expand All @@ -64,6 +68,7 @@ macro_rules! expand_align {
target_arch = "arm",
target_arch = "powerpc"))),
repr(align(8)))]
#[allow(missing_debug_implementations)]
pub struct pthread_rwlock_t { // ToDo
size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T],
}
Expand Down
1 change: 1 addition & 0 deletions src/unix/uclibc/x86_64/l4re.rs
Expand Up @@ -27,6 +27,7 @@ s! {
}

#[cfg(target_os = "l4re")]
#[allow(missing_debug_implementations)]
pub struct pthread_attr_t {
pub __detachstate: ::c_int,
pub __schedpolicy: ::c_int,
Expand Down
35 changes: 19 additions & 16 deletions src/unix/uclibc/x86_64/mod.rs
Expand Up @@ -20,22 +20,6 @@ pub type time_t = ::c_int;
pub type wchar_t = ::c_int;

s! {
pub struct dirent {
pub d_ino: ::ino64_t,
pub d_off: ::off64_t,
pub d_reclen: u16,
pub d_type: u8,
pub d_name: [::c_char; 256],
}

pub struct dirent64 {
pub d_ino: ::ino64_t,
pub d_off: ::off64_t,
pub d_reclen: u16,
pub d_type: u8,
pub d_name: [::c_char; 256],
}

pub struct ipc_perm {
pub __key: ::key_t,
pub uid: ::uid_t,
Expand Down Expand Up @@ -252,6 +236,25 @@ s! {
}
}

s_no_extra_traits! {
#[allow(missing_debug_implementations)]
pub struct dirent {
pub d_ino: ::ino64_t,
pub d_off: ::off64_t,
pub d_reclen: u16,
pub d_type: u8,
pub d_name: [::c_char; 256],
}
#[allow(missing_debug_implementations)]
pub struct dirent64 {
pub d_ino: ::ino64_t,
pub d_off: ::off64_t,
pub d_reclen: u16,
pub d_type: u8,
pub d_name: [::c_char; 256],
}
}

// constants
pub const EADDRINUSE: ::c_int = 98; // Address already in use
pub const EADDRNOTAVAIL: ::c_int = 99; // Cannot assign requested address
Expand Down

0 comments on commit 83d97c2

Please sign in to comment.