Skip to content

Commit cc03101

Browse files
committed
Add binding for new __wasilibc_find_relpath API
Added recently and will be used in libstd!
1 parent 3f1e8b9 commit cc03101

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

ci/docker/wasm32-unknown-wasi/Dockerfile

+3-2
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 3ca44511c298cbbc99e690b761310070b3527fe8
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
@@ -72,7 +72,8 @@ 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 ...
7879
COPY --from=wasi-sysroot /wasmcc /wasmcc/

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

+10-4
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ pub const __WASI_WHENCE_SET: u8 = 2;
396396
feature = "rustc-dep-of-std",
397397
link(name = "c", cfg(not(target_feature = "crt-static")))
398398
)]
399-
extern "C" {
399+
extern {
400400
pub fn _Exit(code: c_int) -> !;
401401
pub fn _exit(code: c_int) -> !;
402402
pub fn abort() -> !;
@@ -455,8 +455,8 @@ extern "C" {
455455
pub fn puts(a: *const c_char) -> c_int;
456456
pub fn perror(a: *const c_char);
457457
pub fn srand(a: c_uint);
458-
pub fn atexit(a: extern "C" fn()) -> c_int;
459-
pub fn at_quick_exit(a: extern "C" fn()) -> c_int;
458+
pub fn atexit(a: extern fn()) -> c_int;
459+
pub fn at_quick_exit(a: extern fn()) -> c_int;
460460
pub fn quick_exit(a: c_int) -> !;
461461
pub fn posix_memalign(a: *mut *mut c_void, b: size_t, c: size_t) -> c_int;
462462
pub fn rand_r(a: *mut c_uint) -> c_int;
@@ -497,14 +497,20 @@ extern "C" {
497497
pub fn __wasilibc_rmfileat(fd: c_int, path: *const c_char) -> c_int;
498498
pub fn __wasilibc_rmdirat(fd: c_int, path: *const c_char) -> c_int;
499499
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;
500506

501507
pub fn arc4random() -> u32;
502508
pub fn arc4random_buf(a: *mut c_void, b: size_t);
503509
pub fn arc4random_uniform(a: u32) -> u32;
504510
}
505511

506512
#[link(wasm_import_module = "wasi_unstable")]
507-
extern "C" {
513+
extern {
508514
#[link_name = "clock_res_get"]
509515
pub fn __wasi_clock_res_get(
510516
clock_id: __wasi_clockid_t,

0 commit comments

Comments
 (0)