Auto merge of #1314 - alexcrichton:wasi-ci, r=gnzlbg
Add binding for new `__wasilibc_find_relpath` API This'll be used in libstd upstream, and this also enables wasi on CI!
This commit is contained in:
commit
363ba93ac4
|
@ -204,6 +204,9 @@ matrix:
|
||||||
stage: tier2
|
stage: tier2
|
||||||
- env: TARGET=x86_64-unknown-linux-musl
|
- env: TARGET=x86_64-unknown-linux-musl
|
||||||
stage: tier2
|
stage: tier2
|
||||||
|
- env: TARGET=wasm32-unknown-wasi
|
||||||
|
rust: nightly
|
||||||
|
stage: tier2
|
||||||
|
|
||||||
allow_failures:
|
allow_failures:
|
||||||
# FIXME: android build bots time out irregularly
|
# FIXME: android build bots time out irregularly
|
||||||
|
|
|
@ -28,7 +28,7 @@ RUN mv /clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-18.04 /wasmcc
|
||||||
# those breaking changes on `libc`'s own CI
|
# those breaking changes on `libc`'s own CI
|
||||||
RUN git clone https://github.com/CraneStation/wasi-sysroot && \
|
RUN git clone https://github.com/CraneStation/wasi-sysroot && \
|
||||||
cd wasi-sysroot && \
|
cd wasi-sysroot && \
|
||||||
git reset --hard 320054e84f8f2440def3b1c8700cedb8fd697bf8
|
git reset --hard e5f14be38362f1ab83302895a6e74b2ffd0e2302
|
||||||
RUN make -C wasi-sysroot install -j $(nproc) WASM_CC=/wasmcc/bin/clang INSTALL_DIR=/wasi-sysroot
|
RUN make -C wasi-sysroot install -j $(nproc) WASM_CC=/wasmcc/bin/clang INSTALL_DIR=/wasi-sysroot
|
||||||
|
|
||||||
# This is a small wrapper script which executes the actual clang binary in
|
# This is a small wrapper script which executes the actual clang binary in
|
||||||
|
@ -58,9 +58,9 @@ RUN curl -sSf https://sh.rustup.rs | sh -s -- -y
|
||||||
ENV PATH=/root/.cargo/bin:$PATH
|
ENV PATH=/root/.cargo/bin:$PATH
|
||||||
|
|
||||||
RUN apt-get install -y --no-install-recommends python
|
RUN apt-get install -y --no-install-recommends python
|
||||||
RUN git clone https://github.com/CraneStation/wasmtime-wasi wasmtime && \
|
RUN git clone https://github.com/CraneStation/wasmtime wasmtime && \
|
||||||
cd wasmtime && \
|
cd wasmtime && \
|
||||||
git reset --hard 4fe2d6084e5b5cc74e69a26860f12750df51d339
|
git reset --hard a1c123c3dd8f9766990efe0f1734a646f61ba8a0
|
||||||
RUN cargo build --release --manifest-path wasmtime/Cargo.toml
|
RUN cargo build --release --manifest-path wasmtime/Cargo.toml
|
||||||
|
|
||||||
# And finally in the last image we're going to assemble everything together.
|
# And finally in the last image we're going to assemble everything together.
|
||||||
|
@ -72,12 +72,13 @@ RUN apt-get update && \
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
gcc \
|
gcc \
|
||||||
libc6-dev \
|
libc6-dev \
|
||||||
libxml2
|
libxml2 \
|
||||||
|
ca-certificates
|
||||||
|
|
||||||
# Copy over clang we downloaded to link executables ...
|
# Copy over clang we downloaded to link executables ...
|
||||||
COPY --from=reference-sysroot /wasmcc /wasmcc/
|
COPY --from=wasi-sysroot /wasmcc /wasmcc/
|
||||||
# ... and the sysroot we built to link executables against ...
|
# ... and the sysroot we built to link executables against ...
|
||||||
COPY --from=reference-sysroot /wasi-sysroot/ /wasi-sysroot/
|
COPY --from=wasi-sysroot /wasi-sysroot/ /wasi-sysroot/
|
||||||
# ... and finally wasmtime to actually execute binaries
|
# ... and finally wasmtime to actually execute binaries
|
||||||
COPY --from=wasmtime /wasmtime/target/release/wasmtime /usr/bin/
|
COPY --from=wasmtime /wasmtime/target/release/wasmtime /usr/bin/
|
||||||
|
|
||||||
|
|
|
@ -1890,6 +1890,7 @@ fn test_wasi(target: &str) {
|
||||||
"unistd.h",
|
"unistd.h",
|
||||||
"wasi/core.h",
|
"wasi/core.h",
|
||||||
"wasi/libc.h",
|
"wasi/libc.h",
|
||||||
|
"wasi/libc-find-relpath.h",
|
||||||
"wchar.h",
|
"wchar.h",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
19
src/wasi.rs
19
src/wasi.rs
|
@ -388,11 +388,14 @@ pub const __WASI_WHENCE_CUR: u8 = 0;
|
||||||
pub const __WASI_WHENCE_END: u8 = 1;
|
pub const __WASI_WHENCE_END: u8 = 1;
|
||||||
pub const __WASI_WHENCE_SET: u8 = 2;
|
pub const __WASI_WHENCE_SET: u8 = 2;
|
||||||
|
|
||||||
#[cfg_attr(feature = "rustc-dep-of-std",
|
#[cfg_attr(
|
||||||
link(name = "c", kind = "static",
|
feature = "rustc-dep-of-std",
|
||||||
cfg(target_feature = "crt-static")))]
|
link(name = "c", kind = "static", cfg(target_feature = "crt-static"))
|
||||||
#[cfg_attr(feature = "rustc-dep-of-std",
|
)]
|
||||||
link(name = "c", cfg(not(target_feature = "crt-static"))))]
|
#[cfg_attr(
|
||||||
|
feature = "rustc-dep-of-std",
|
||||||
|
link(name = "c", cfg(not(target_feature = "crt-static")))
|
||||||
|
)]
|
||||||
extern {
|
extern {
|
||||||
pub fn _Exit(code: c_int) -> !;
|
pub fn _Exit(code: c_int) -> !;
|
||||||
pub fn _exit(code: c_int) -> !;
|
pub fn _exit(code: c_int) -> !;
|
||||||
|
@ -494,6 +497,12 @@ extern {
|
||||||
pub fn __wasilibc_rmfileat(fd: c_int, path: *const c_char) -> c_int;
|
pub fn __wasilibc_rmfileat(fd: c_int, path: *const c_char) -> c_int;
|
||||||
pub fn __wasilibc_rmdirat(fd: c_int, path: *const c_char) -> c_int;
|
pub fn __wasilibc_rmdirat(fd: c_int, path: *const c_char) -> c_int;
|
||||||
pub fn __wasilibc_init_preopen();
|
pub fn __wasilibc_init_preopen();
|
||||||
|
pub fn __wasilibc_find_relpath(
|
||||||
|
path: *const c_char,
|
||||||
|
rights_base: __wasi_rights_t,
|
||||||
|
rights_inheriting: __wasi_rights_t,
|
||||||
|
relative_path: *mut *const c_char,
|
||||||
|
) -> c_int;
|
||||||
|
|
||||||
pub fn arc4random() -> u32;
|
pub fn arc4random() -> u32;
|
||||||
pub fn arc4random_buf(a: *mut c_void, b: size_t);
|
pub fn arc4random_buf(a: *mut c_void, b: size_t);
|
||||||
|
|
Loading…
Reference in New Issue