Skip to content

Commit 363ba93

Browse files
committed
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!
2 parents 5b989db + cc03101 commit 363ba93

File tree

4 files changed

+25
-11
lines changed

4 files changed

+25
-11
lines changed

.travis.yml

+3
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ matrix:
204204
stage: tier2
205205
- env: TARGET=x86_64-unknown-linux-musl
206206
stage: tier2
207+
- env: TARGET=wasm32-unknown-wasi
208+
rust: nightly
209+
stage: tier2
207210

208211
allow_failures:
209212
# FIXME: android build bots time out irregularly

ci/docker/wasm32-unknown-wasi/Dockerfile

+7-6
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ RUN mv /clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-18.04 /wasmcc
2828
# those breaking changes on `libc`'s own CI
2929
RUN git clone https://github.com/CraneStation/wasi-sysroot && \
3030
cd wasi-sysroot && \
31-
git reset --hard 320054e84f8f2440def3b1c8700cedb8fd697bf8
31+
git reset --hard e5f14be38362f1ab83302895a6e74b2ffd0e2302
3232
RUN make -C wasi-sysroot install -j $(nproc) WASM_CC=/wasmcc/bin/clang INSTALL_DIR=/wasi-sysroot
3333

3434
# 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
5858
ENV PATH=/root/.cargo/bin:$PATH
5959

6060
RUN apt-get install -y --no-install-recommends python
61-
RUN git clone https://github.com/CraneStation/wasmtime-wasi wasmtime && \
61+
RUN git clone https://github.com/CraneStation/wasmtime wasmtime && \
6262
cd wasmtime && \
63-
git reset --hard 4fe2d6084e5b5cc74e69a26860f12750df51d339
63+
git reset --hard a1c123c3dd8f9766990efe0f1734a646f61ba8a0
6464
RUN cargo build --release --manifest-path wasmtime/Cargo.toml
6565

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

7778
# Copy over clang we downloaded to link executables ...
78-
COPY --from=reference-sysroot /wasmcc /wasmcc/
79+
COPY --from=wasi-sysroot /wasmcc /wasmcc/
7980
# ... and the sysroot we built to link executables against ...
80-
COPY --from=reference-sysroot /wasi-sysroot/ /wasi-sysroot/
81+
COPY --from=wasi-sysroot /wasi-sysroot/ /wasi-sysroot/
8182
# ... and finally wasmtime to actually execute binaries
8283
COPY --from=wasmtime /wasmtime/target/release/wasmtime /usr/bin/
8384

libc-test/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1890,6 +1890,7 @@ fn test_wasi(target: &str) {
18901890
"unistd.h",
18911891
"wasi/core.h",
18921892
"wasi/libc.h",
1893+
"wasi/libc-find-relpath.h",
18931894
"wchar.h",
18941895
}
18951896

src/wasi.rs

+14-5
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,14 @@ pub const __WASI_WHENCE_CUR: u8 = 0;
388388
pub const __WASI_WHENCE_END: u8 = 1;
389389
pub const __WASI_WHENCE_SET: u8 = 2;
390390

391-
#[cfg_attr(feature = "rustc-dep-of-std",
392-
link(name = "c", kind = "static",
393-
cfg(target_feature = "crt-static")))]
394-
#[cfg_attr(feature = "rustc-dep-of-std",
395-
link(name = "c", cfg(not(target_feature = "crt-static"))))]
391+
#[cfg_attr(
392+
feature = "rustc-dep-of-std",
393+
link(name = "c", kind = "static", cfg(target_feature = "crt-static"))
394+
)]
395+
#[cfg_attr(
396+
feature = "rustc-dep-of-std",
397+
link(name = "c", cfg(not(target_feature = "crt-static")))
398+
)]
396399
extern {
397400
pub fn _Exit(code: c_int) -> !;
398401
pub fn _exit(code: c_int) -> !;
@@ -494,6 +497,12 @@ extern {
494497
pub fn __wasilibc_rmfileat(fd: c_int, path: *const c_char) -> c_int;
495498
pub fn __wasilibc_rmdirat(fd: c_int, path: *const c_char) -> c_int;
496499
pub fn __wasilibc_init_preopen();
500+
pub fn __wasilibc_find_relpath(
501+
path: *const c_char,
502+
rights_base: __wasi_rights_t,
503+
rights_inheriting: __wasi_rights_t,
504+
relative_path: *mut *const c_char,
505+
) -> c_int;
497506

498507
pub fn arc4random() -> u32;
499508
pub fn arc4random_buf(a: *mut c_void, b: size_t);

0 commit comments

Comments
 (0)