Support Android

I'll send a PR after https://github.com/rust-lang/libc/pull/1622 is merged and released
This commit is contained in:
Yuji Yamamoto 2019-12-19 11:08:43 +09:00 committed by YAMAMOTO Yuji
parent 704c34283f
commit 0df0a1cccb
No known key found for this signature in database
GPG Key ID: 8FB2636E95126D30
7 changed files with 36 additions and 9 deletions

View File

@ -78,7 +78,7 @@ pub extern "C" fn nearbyintf64(x: f64) -> f64 {
// FIXME: Is there a replacement on AArch64?
#[cfg(all(
any(target_os = "freebsd", target_os = "linux"),
any(target_os = "freebsd", target_os = "linux", target_os = "android"),
target_arch = "aarch64"
))]
#[no_mangle]

View File

@ -229,7 +229,10 @@ unsafe fn get_faulting_addr_and_ip(
(si_addr, rip as _)
}
#[cfg(all(target_os = "linux", target_arch = "aarch64"))]
#[cfg(all(
any(target_os = "linux", target_os = "android"),
target_arch = "aarch64"
))]
unsafe fn get_faulting_addr_and_ip(
_siginfo: *const c_void,
_ucontext: *const c_void,
@ -237,7 +240,10 @@ unsafe fn get_faulting_addr_and_ip(
(::std::ptr::null(), ::std::ptr::null())
}
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
#[cfg(all(
any(target_os = "linux", target_os = "android"),
target_arch = "x86_64"
))]
unsafe fn get_faulting_addr_and_ip(
siginfo: *const c_void,
ucontext: *const c_void,
@ -332,5 +338,7 @@ unsafe fn get_faulting_addr_and_ip(
all(target_os = "macos", target_arch = "x86_64"),
all(target_os = "linux", target_arch = "x86_64"),
all(target_os = "linux", target_arch = "aarch64"),
all(target_os = "android", target_arch = "x86_64"),
all(target_os = "android", target_arch = "aarch64"),
)))]
compile_error!("This crate doesn't yet support compiling on operating systems other than linux and macos and architectures other than x86_64");

View File

@ -16,7 +16,8 @@ wasmparser = "0.51.3"
parking_lot = "0.10.0"
lazy_static = "1.4"
errno = "0.2"
libc = "0.2.60"
#libc = "0.2.60"
libc = { path = "../../../libc", version = "0.2.65" }
hex = "0.4"
smallvec = "0.6"
bincode = "1.1"

View File

@ -37,7 +37,7 @@ fn main() {
.file("image-loading-freebsd-x86-64.s")
.compile("image-loading");
}
("linux", "x86_64") => {
("linux", "x86_64") | ("android", "x86_64") => {
cc::Build::new()
.file("image-loading-linux-x86-64.s")
.compile("image-loading");

View File

@ -743,7 +743,10 @@ pub unsafe fn get_fault_info(siginfo: *const c_void, ucontext: *mut c_void) -> F
}
}
#[cfg(all(target_os = "linux", target_arch = "aarch64"))]
#[cfg(all(
any(target_os = "linux", target_os = "android"),
target_arch = "aarch64"
))]
/// Get fault info from siginfo and ucontext.
pub unsafe fn get_fault_info(siginfo: *const c_void, ucontext: *mut c_void) -> FaultInfo {
#[allow(dead_code)]
@ -810,7 +813,10 @@ pub unsafe fn get_fault_info(siginfo: *const c_void, ucontext: *mut c_void) -> F
}
}
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
#[cfg(all(
any(target_os = "linux", target_os = "android"),
target_arch = "x86_64"
))]
/// Get fault info from siginfo and ucontext.
pub unsafe fn get_fault_info(siginfo: *const c_void, ucontext: *mut c_void) -> FaultInfo {
use libc::{

View File

@ -17,6 +17,8 @@
all(target_os = "macos", target_arch = "x86_64"),
all(target_os = "linux", target_arch = "x86_64"),
all(target_os = "linux", target_arch = "aarch64"),
all(target_os = "android", target_arch = "x86_64"),
all(target_os = "android", target_arch = "aarch64"),
)))]
compile_error!("This crate doesn't yet support compiling on operating systems other than FreeBSD, linux and macos and architectures other than x86_64");

View File

@ -1,6 +1,11 @@
#![allow(unused, clippy::too_many_arguments)]
pub mod types;
#[cfg(any(target_os = "freebsd", target_os = "linux", target_os = "macos"))]
#[cfg(any(
target_os = "freebsd",
target_os = "linux",
target_os = "android",
target_os = "macos"
))]
pub mod unix;
#[cfg(any(target_os = "windows"))]
pub mod windows;
@ -23,7 +28,12 @@ use std::convert::{Infallible, TryInto};
use std::io::{self, Read, Seek, Write};
use wasmer_runtime_core::{memory::Memory, vm::Ctx};
#[cfg(any(target_os = "freebsd", target_os = "linux", target_os = "macos"))]
#[cfg(any(
target_os = "freebsd",
target_os = "linux",
target_os = "android",
target_os = "macos"
))]
pub use unix::*;
#[cfg(any(target_os = "windows"))]