Skip to content

Commit

Permalink
Update to NDK r15b (with unified headers) and add missing symbols nee…
Browse files Browse the repository at this point in the history
…ded by nix crate
  • Loading branch information
ndusart committed Jul 1, 2017
1 parent a38631f commit 0299161
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 18 deletions.
9 changes: 5 additions & 4 deletions ci/android-install-ndk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

set -ex

curl -O https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip
unzip -q android-ndk-r13b-linux-x86_64.zip
curl -O https://dl.google.com/android/repository/android-ndk-r15b-linux-x86_64.zip
unzip -q android-ndk-r15b-linux-x86_64.zip

case "$1" in
aarch64)
Expand All @@ -28,9 +28,10 @@ case "$1" in
;;
esac;

android-ndk-r13b/build/tools/make_standalone_toolchain.py \
android-ndk-r15b/build/tools/make_standalone_toolchain.py \
--unified-headers \
--install-dir /android/ndk-$1 \
--arch $arch \
--api 24

rm -rf ./android-ndk-r13b-linux-x86_64.zip ./android-ndk-r13b
rm -rf ./android-ndk-r15b-linux-x86_64.zip ./android-ndk-r15b
Empty file modified ci/run-docker.sh
100644 → 100755
Empty file.
14 changes: 13 additions & 1 deletion libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ fn main() {
cfg.header("sys/shm.h");
cfg.header("sys/user.h");
cfg.header("sys/fsuid.h");
cfg.header("pty.h");
cfg.header("shadow.h");
cfg.header("linux/input.h");
if x86_64 {
Expand All @@ -200,6 +199,7 @@ fn main() {
cfg.header("sys/syscall.h");
cfg.header("sys/personality.h");
cfg.header("sys/swap.h");
cfg.header("pty.h");
if !uclibc {
cfg.header("sys/sysinfo.h");
}
Expand Down Expand Up @@ -337,6 +337,11 @@ fn main() {
// definition. Because it's tested on other Linux targets, skip it.
"input_mask" if musl => true,

// These structs have changed since unified headers in NDK r14b.
// `st_atime` and `st_atime_nsec` have changed sign.
// FIXME: unskip it for next major release
"stat" | "stat64" if android => true,

_ => false
}
});
Expand Down Expand Up @@ -534,6 +539,13 @@ fn main() {
// On Mac we don't use the default `close()`, instead using their $NOCANCEL variants.
"close" if apple => true,

// Definition of those functions as changed since unified headers from NDK r14b
// These changes imply some API breaking changes but are still ABI compatible.
// We can wait for the next major release to be compliant with the new API.
// FIXME: unskip these for next major release
"strerror_r" | "madvise" | "msync" | "mprotect" | "recvfrom" | "getpriority" |
"setpriority" | "personality" if android => true,

_ => false,
}
});
Expand Down
6 changes: 5 additions & 1 deletion src/unix/notbsd/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ pub const SA_NOCLDSTOP: ::c_int = 0x00000001;

pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
pub const EPOLLONESHOT: ::c_int = 0x40000000;
pub const EPOLLRDHUP: ::c_int = 0x00002000;
pub const EPOLLWAKEUP: ::c_int = 0x20000000;

pub const EFD_CLOEXEC: ::c_int = 0x80000;

Expand Down Expand Up @@ -428,7 +430,7 @@ pub const SOL_NETROM: ::c_int = 259;
pub const SOL_ROSE: ::c_int = 260;

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

Expand Down Expand Up @@ -458,6 +460,7 @@ pub const O_NONBLOCK: ::c_int = 2048;
pub const O_SYNC: ::c_int = 0x101000;
pub const O_ASYNC: ::c_int = 0x2000;
pub const O_NDELAY: ::c_int = 0x800;
pub const O_DSYNC: ::c_int = 4096;

pub const NI_MAXHOST: ::size_t = 1025;

Expand Down Expand Up @@ -562,6 +565,7 @@ pub const TIOCMBIC: ::c_int = 0x5417;
pub const TIOCMSET: ::c_int = 0x5418;
pub const FIONREAD: ::c_int = 0x541B;
pub const TIOCCONS: ::c_int = 0x541D;
pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;

pub const RTLD_NOLOAD: ::c_int = 0x4;

Expand Down
12 changes: 0 additions & 12 deletions src/unix/notbsd/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,6 @@ extern {
timeout: ::c_int,
sigmask: *const ::sigset_t) -> ::c_int;
pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int;
pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
pub fn mkostemps(template: *mut ::c_char,
suffixlen: ::c_int,
Expand All @@ -1023,15 +1022,6 @@ extern {
timeout: *const ::timespec) -> ::c_int;
pub fn sigwaitinfo(set: *const sigset_t,
info: *mut siginfo_t) -> ::c_int;
pub fn openpty(amaster: *mut ::c_int,
aslave: *mut ::c_int,
name: *mut ::c_char,
termp: *const termios,
winp: *const ::winsize) -> ::c_int;
pub fn forkpty(amaster: *mut ::c_int,
name: *mut ::c_char,
termp: *const termios,
winp: *const ::winsize) -> ::pid_t;
pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
pub fn getnameinfo(sa: *const ::sockaddr,
salen: ::socklen_t,
Expand Down Expand Up @@ -1064,8 +1054,6 @@ extern {
pub fn reboot(how_to: ::c_int) -> ::c_int;
pub fn setfsgid(gid: ::gid_t) -> ::c_int;
pub fn setfsuid(uid: ::uid_t) -> ::c_int;
pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;

// Not available now on Android
pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
Expand Down
12 changes: 12 additions & 0 deletions src/unix/notbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1007,8 +1007,20 @@ extern {
pub fn brk(addr: *mut ::c_void) -> ::c_int;
pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void;
pub fn vfork() -> ::pid_t;
pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
pub fn wait4(pid: ::pid_t, status: *mut ::c_int, options: ::c_int,
rusage: *mut ::rusage) -> ::pid_t;
pub fn openpty(amaster: *mut ::c_int,
aslave: *mut ::c_int,
name: *mut ::c_char,
termp: *const termios,
winp: *const ::winsize) -> ::c_int;
pub fn forkpty(amaster: *mut ::c_int,
name: *mut ::c_char,
termp: *const termios,
winp: *const ::winsize) -> ::pid_t;
}

cfg_if! {
Expand Down

0 comments on commit 0299161

Please sign in to comment.