Skip to content
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 .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ matrix:
stage: tier2
- env: TARGET=x86_64-unknown-linux-musl
stage: tier2
- env: TARGET=wasm32-unknown-wasi
rust: nightly
stage: tier2

allow_failures:
# FIXME: android build bots time out irregularly
Expand Down
13 changes: 7 additions & 6 deletions ci/docker/wasm32-unknown-wasi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
RUN git clone https://github.com/CraneStation/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

# This is a small wrapper script which executes the actual clang binary in
Expand Down Expand Up @@ -58,9 +58,9 @@ RUN curl -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH=/root/.cargo/bin:$PATH

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 && \
git reset --hard 4fe2d6084e5b5cc74e69a26860f12750df51d339
git reset --hard a1c123c3dd8f9766990efe0f1734a646f61ba8a0
RUN cargo build --release --manifest-path wasmtime/Cargo.toml

# And finally in the last image we're going to assemble everything together.
Expand All @@ -72,12 +72,13 @@ RUN apt-get update && \
apt-get install -y --no-install-recommends \
gcc \
libc6-dev \
libxml2
libxml2 \
ca-certificates

# 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 ...
COPY --from=reference-sysroot /wasi-sysroot/ /wasi-sysroot/
COPY --from=wasi-sysroot /wasi-sysroot/ /wasi-sysroot/
# ... and finally wasmtime to actually execute binaries
COPY --from=wasmtime /wasmtime/target/release/wasmtime /usr/bin/

Expand Down
1 change: 1 addition & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1890,6 +1890,7 @@ fn test_wasi(target: &str) {
"unistd.h",
"wasi/core.h",
"wasi/libc.h",
"wasi/libc-find-relpath.h",
"wchar.h",
}

Expand Down
19 changes: 14 additions & 5 deletions src/wasi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,11 +388,14 @@ pub const __WASI_WHENCE_CUR: u8 = 0;
pub const __WASI_WHENCE_END: u8 = 1;
pub const __WASI_WHENCE_SET: u8 = 2;

#[cfg_attr(feature = "rustc-dep-of-std",
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", kind = "static", cfg(target_feature = "crt-static"))
)]
#[cfg_attr(
feature = "rustc-dep-of-std",
link(name = "c", cfg(not(target_feature = "crt-static")))
)]
extern {
pub fn _Exit(code: c_int) -> !;
pub fn _exit(code: c_int) -> !;
Expand Down Expand Up @@ -494,6 +497,12 @@ extern {
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_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_buf(a: *mut c_void, b: size_t);
Expand Down