Skip to content

Add support for aarch64-unknown-linux-musl #782

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ Tested:
* [`x86_64-unknown-linux-musl`](https://doc.rust-lang.org/libc/x86_64-unknown-linux-musl/libc/)
(Linux MUSL)
* [`aarch64-unknown-linux-gnu`](https://doc.rust-lang.org/libc/aarch64-unknown-linux-gnu/libc/)
(Linux)
* [`aarch64-unknown-linux-musl`](https://doc.rust-lang.org/libc/aarch64-unknown-linux-musl/libc/)
(Linux MUSL)
* [`mips-unknown-linux-gnu`](https://doc.rust-lang.org/libc/mips-unknown-linux-gnu/libc/)
* [`arm-unknown-linux-gnueabihf`](https://doc.rust-lang.org/libc/arm-unknown-linux-gnueabihf/libc/)
* [`arm-linux-androideabi`](https://doc.rust-lang.org/libc/arm-linux-androideabi/libc/)
Expand Down
2 changes: 1 addition & 1 deletion ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ running tests. The triples tested are:
* `{i686,x86_64}-pc-windows-{msvc,gnu}`
* Travis
* `{i686,x86_64,mips,aarch64}-unknown-linux-gnu`
* `x86_64-unknown-linux-musl`
* `{x86_64,aarch64}-unknown-linux-musl`
* `arm-unknown-linux-gnueabihf`
* `arm-linux-androideabi`
* `{i686,x86_64}-apple-{darwin,ios}`
Expand Down
24 changes: 24 additions & 0 deletions ci/docker/aarch64-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM ubuntu:17.10

RUN apt-get update && apt-get install -y --no-install-recommends \
gcc make libc6-dev git curl ca-certificates \
gcc-aarch64-linux-gnu qemu-user
RUN curl https://www.musl-libc.org/releases/musl-1.1.16.tar.gz | \
tar xzf - && \
cd musl-1.1.16 && \
CC=aarch64-linux-gnu-gcc \
./configure --prefix=/musl-aarch64 --enable-wrapper=yes && \
make install -j4 && \
cd .. && \
rm -rf musl-1.1.16 && \
# Install linux kernel headers sanitized for use with musl
curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-5.tar.gz | \
tar xzf - && \
cd kernel-headers-3.12.6-5 && \
make ARCH=arm64 prefix=/musl-aarch64 install -j4 && \
cd .. && \
rm -rf kernel-headers-3.12.6-5
ENV PATH=$PATH:/musl-aarch64/bin:/rust/bin \
CC_aarch64_unknown_linux_musl=musl-gcc \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUNNER="qemu-aarch64 -L /musl-aarch64"
5 changes: 5 additions & 0 deletions src/unix/notbsd/linux/mips/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,11 @@ pub const EHWPOISON: ::c_int = 168;
pub const SIGEV_THREAD_ID: ::c_int = 4;
pub const EPOLLWAKEUP: ::c_int = 0x20000000;

#[doc(hidden)]
pub const AF_MAX: ::c_int = 42;
#[doc(hidden)]
pub const PF_MAX: ::c_int = AF_MAX;

#[link(name = "util")]
extern {
pub fn sysctl(name: *mut ::c_int,
Expand Down
10 changes: 5 additions & 5 deletions src/unix/notbsd/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,12 @@ s! {
__align: [::c_int; 0],
#[cfg(not(any(target_arch = "x86_64", target_arch = "powerpc64",
target_arch = "mips64", target_arch = "s390x",
target_arch = "sparc64")))]
target_arch = "sparc64", target_arch = "aarch64")))]
__align: [::c_long; 0],
#[cfg(all(target_arch = "aarch64", target_env = "gnu"))]
__align: [::c_long; 0],
#[cfg(all(target_arch = "aarch64", target_env = "musl"))]
__align: [::c_int; 0],
size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
}

Expand Down Expand Up @@ -737,14 +741,10 @@ pub const AF_IB: ::c_int = 27;
pub const AF_MPLS: ::c_int = 28;
pub const AF_NFC: ::c_int = 39;
pub const AF_VSOCK: ::c_int = 40;
#[doc(hidden)]
pub const AF_MAX: ::c_int = 42;
pub const PF_IB: ::c_int = AF_IB;
pub const PF_MPLS: ::c_int = AF_MPLS;
pub const PF_NFC: ::c_int = AF_NFC;
pub const PF_VSOCK: ::c_int = AF_VSOCK;
#[doc(hidden)]
pub const PF_MAX: ::c_int = AF_MAX;

// System V IPC
pub const IPC_PRIVATE: ::key_t = 0;
Expand Down
21 changes: 21 additions & 0 deletions src/unix/notbsd/linux/musl/b32/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pub type c_long = i32;
pub type c_ulong = u32;
pub type nlink_t = u32;
pub type blksize_t = ::c_long;
pub type __u64 = ::c_ulonglong;

s! {
Expand Down Expand Up @@ -31,11 +32,31 @@ s! {
pub struct sem_t {
__val: [::c_int; 4],
}

pub struct ipc_perm {
pub __ipc_perm_key: ::key_t,
pub uid: ::uid_t,
pub gid: ::gid_t,
pub cuid: ::uid_t,
pub cgid: ::gid_t,
pub mode: ::mode_t,
pub __seq: ::c_int,
__unused1: ::c_long,
__unused2: ::c_long
}
}

pub const SIGSTKSZ: ::size_t = 8192;
pub const MINSIGSTKSZ: ::size_t = 2048;

pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;

#[doc(hidden)]
pub const AF_MAX: ::c_int = 42;
#[doc(hidden)]
pub const PF_MAX: ::c_int = AF_MAX;

cfg_if! {
if #[cfg(any(target_arch = "x86"))] {
mod x86;
Expand Down
74 changes: 74 additions & 0 deletions src/unix/notbsd/linux/musl/b64/aarch64.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,81 @@
pub type c_char = u8;
pub type __u64 = ::c_ulonglong;
pub type wchar_t = u32;
pub type nlink_t = u32;
pub type blksize_t = ::c_int;

s! {
pub struct stat {
pub st_dev: ::dev_t,
pub st_ino: ::ino_t,
pub st_mode: ::mode_t,
pub st_nlink: ::nlink_t,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
pub st_rdev: ::dev_t,
__pad0: ::c_ulong,
pub st_size: ::off_t,
pub st_blksize: ::blksize_t,
__pad1: ::c_int,
pub st_blocks: ::blkcnt_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
__unused: [::c_uint; 2],
}

pub struct stat64 {
pub st_dev: ::dev_t,
pub st_ino: ::ino_t,
pub st_mode: ::mode_t,
pub st_nlink: ::nlink_t,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
pub st_rdev: ::dev_t,
__pad0: ::c_ulong,
pub st_size: ::off_t,
pub st_blksize: ::blksize_t,
__pad1: ::c_int,
pub st_blocks: ::blkcnt_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
__unused: [::c_uint; 2],
}

pub struct ipc_perm {
pub __ipc_perm_key: ::key_t,
pub uid: ::uid_t,
pub gid: ::gid_t,
pub cuid: ::uid_t,
pub cgid: ::gid_t,
pub mode: ::mode_t,
pub __seq: ::c_ushort,
__unused1: ::c_ulong,
__unused2: ::c_ulong,
}
}

pub const SYS_pivot_root: ::c_long = 41;
pub const SYS_gettid: ::c_long = 178;
pub const SYS_perf_event_open: ::c_long = 241;
pub const SYS_memfd_create: ::c_long = 279;

pub const O_DIRECT: ::c_int = 0x10000;
pub const O_DIRECTORY: ::c_int = 0x4000;
pub const O_LARGEFILE: ::c_int = 0x20000;
pub const O_NOFOLLOW: ::c_int = 0x8000;

pub const MINSIGSTKSZ: ::size_t = 6144;
pub const SIGSTKSZ: ::size_t = 12288;

#[doc(hidden)]
pub const PF_MAX: ::c_int = 43;
#[doc(hidden)]
pub const AF_MAX: ::c_int = PF_MAX;
49 changes: 0 additions & 49 deletions src/unix/notbsd/linux/musl/b64/mod.rs
Original file line number Diff line number Diff line change
@@ -1,51 +1,7 @@
pub type wchar_t = i32;
pub type c_long = i64;
pub type c_ulong = u64;
pub type nlink_t = u64;

s! {
pub struct stat {
pub st_dev: ::dev_t,
pub st_ino: ::ino_t,
pub st_nlink: ::nlink_t,
pub st_mode: ::mode_t,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
__pad0: ::c_int,
pub st_rdev: ::dev_t,
pub st_size: ::off_t,
pub st_blksize: ::blksize_t,
pub st_blocks: ::blkcnt_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
__unused: [::c_long; 3],
}

pub struct stat64 {
pub st_dev: ::dev_t,
pub st_ino: ::ino64_t,
pub st_nlink: ::nlink_t,
pub st_mode: ::mode_t,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
__pad0: ::c_int,
pub st_rdev: ::dev_t,
pub st_size: ::off_t,
pub st_blksize: ::blksize_t,
pub st_blocks: ::blkcnt64_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
__reserved: [::c_long; 3],
}

pub struct statfs64 {
pub f_type: ::c_ulong,
pub f_bsize: ::c_ulong,
Expand Down Expand Up @@ -167,11 +123,7 @@ s! {
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;

pub const O_DIRECT: ::c_int = 0x4000;
pub const O_DIRECTORY: ::c_int = 0x10000;
pub const O_NOFOLLOW: ::c_int = 0x20000;
pub const O_ASYNC: ::c_int = 0x2000;
pub const O_LARGEFILE: ::c_int = 0;

pub const FIOCLEX: ::c_int = 0x5451;
pub const FIONBIO: ::c_int = 0x5421;
Expand Down Expand Up @@ -202,7 +154,6 @@ pub const MAP_NORESERVE: ::c_int = 0x04000;
pub const MAP_POPULATE: ::c_int = 0x08000;
pub const MAP_NONBLOCK: ::c_int = 0x010000;
pub const MAP_STACK: ::c_int = 0x020000;
pub const MAP_32BIT: ::c_int = 0x0040;

pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
Expand Down
73 changes: 73 additions & 0 deletions src/unix/notbsd/linux/musl/b64/powerpc64.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,80 @@
pub type c_char = u8;
pub type wchar_t = i32;
pub type __u64 = ::c_ulong;
pub type nlink_t = u64;
pub type blksize_t = ::c_long;

s! {
pub struct stat {
pub st_dev: ::dev_t,
pub st_ino: ::ino_t,
pub st_nlink: ::nlink_t,
pub st_mode: ::mode_t,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
__pad0: ::c_int,
pub st_rdev: ::dev_t,
pub st_size: ::off_t,
pub st_blksize: ::blksize_t,
pub st_blocks: ::blkcnt_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
__unused: [::c_long; 3],
}

pub struct stat64 {
pub st_dev: ::dev_t,
pub st_ino: ::ino64_t,
pub st_nlink: ::nlink_t,
pub st_mode: ::mode_t,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
__pad0: ::c_int,
pub st_rdev: ::dev_t,
pub st_size: ::off_t,
pub st_blksize: ::blksize_t,
pub st_blocks: ::blkcnt64_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
__reserved: [::c_long; 3],
}

pub struct ipc_perm {
pub __ipc_perm_key: ::key_t,
pub uid: ::uid_t,
pub gid: ::gid_t,
pub cuid: ::uid_t,
pub cgid: ::gid_t,
pub mode: ::mode_t,
pub __seq: ::c_int,
__unused1: ::c_long,
__unused2: ::c_long
}
}

pub const SYS_pivot_root: ::c_long = 203;
pub const SYS_gettid: ::c_long = 207;
pub const SYS_perf_event_open: ::c_long = 319;
pub const SYS_memfd_create: ::c_long = 360;

pub const MAP_32BIT: ::c_int = 0x0040;
pub const O_DIRECT: ::c_int = 0x4000;
pub const O_DIRECTORY: ::c_int = 0x10000;
pub const O_LARGEFILE: ::c_int = 0;
pub const O_NOFOLLOW: ::c_int = 0x20000;

pub const SIGSTKSZ: ::size_t = 8192;
pub const MINSIGSTKSZ: ::size_t = 2048;

#[doc(hidden)]
pub const AF_MAX: ::c_int = 42;
#[doc(hidden)]
pub const PF_MAX: ::c_int = AF_MAX;
Loading