From 952f20b27d922e0d0aa5b1f16d5e1ef17a3db12e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 23 Aug 2020 20:20:19 -0400 Subject: [PATCH 1/2] Point wasi-libc submodule to new location. --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 857acaf46d..4b18287060 100644 --- a/.gitmodules +++ b/.gitmodules @@ -12,7 +12,7 @@ url = https://github.com/tinygo-org/cmsis-svd [submodule "lib/wasi-libc"] path = lib/wasi-libc - url = https://github.com/CraneStation/wasi-libc + url = https://github.com/WebAssembly/wasi-libc [submodule "lib/picolibc"] path = lib/picolibc url = https://github.com/keith-packard/picolibc.git From 9076f97602628d7c0cf2f41eebc2e4c09773e15b Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 23 Sep 2023 04:02:54 -0400 Subject: [PATCH 2/2] Bump wasi-libc to SDK 20 The version 17 SDK adds `getpagesize`, so use it instead of hardcoding a number (even if their implementation is _also_ a hardcoded number.) --- .circleci/config.yml | 4 ++-- .github/workflows/build-macos.yml | 2 +- .github/workflows/linux.yml | 4 ++-- .github/workflows/windows.yml | 2 +- lib/wasi-libc | 2 +- src/syscall/syscall_libc_wasi.go | 8 ++++++-- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1dff3ba719..46d7108117 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -75,10 +75,10 @@ commands: - run: go install -tags=llvm<> . - restore_cache: keys: - - wasi-libc-sysroot-systemclang-v6 + - wasi-libc-sysroot-systemclang-v7 - run: make wasi-libc - save_cache: - key: wasi-libc-sysroot-systemclang-v6 + key: wasi-libc-sysroot-systemclang-v7 paths: - lib/wasi-libc/sysroot - when: diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 1284a4edd3..a97c470f5c 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -82,7 +82,7 @@ jobs: uses: actions/cache@v3 id: cache-wasi-libc with: - key: wasi-libc-sysroot-v4 + key: wasi-libc-sysroot-v5 path: lib/wasi-libc/sysroot - name: Build wasi-libc if: steps.cache-wasi-libc.outputs.cache-hit != 'true' diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 0ef57bf4ad..57f51d72a6 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -103,7 +103,7 @@ jobs: uses: actions/cache@v3 id: cache-wasi-libc with: - key: wasi-libc-sysroot-linux-alpine-v1 + key: wasi-libc-sysroot-linux-alpine-v2 path: lib/wasi-libc/sysroot - name: Build wasi-libc if: steps.cache-wasi-libc.outputs.cache-hit != 'true' @@ -250,7 +250,7 @@ jobs: uses: actions/cache@v3 id: cache-wasi-libc with: - key: wasi-libc-sysroot-linux-asserts-v5 + key: wasi-libc-sysroot-linux-asserts-v6 path: lib/wasi-libc/sysroot - name: Build wasi-libc if: steps.cache-wasi-libc.outputs.cache-hit != 'true' diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 390672fa3d..1d18facddb 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -89,7 +89,7 @@ jobs: uses: actions/cache@v3 id: cache-wasi-libc with: - key: wasi-libc-sysroot-v4 + key: wasi-libc-sysroot-v5 path: lib/wasi-libc/sysroot - name: Build wasi-libc if: steps.cache-wasi-libc.outputs.cache-hit != 'true' diff --git a/lib/wasi-libc b/lib/wasi-libc index 30094b6ed0..1dfe5c302d 160000 --- a/lib/wasi-libc +++ b/lib/wasi-libc @@ -1 +1 @@ -Subproject commit 30094b6ed05f19cee102115215863d185f2db4f0 +Subproject commit 1dfe5c302d1c5ab621f7abf04620fae92700fd22 diff --git a/src/syscall/syscall_libc_wasi.go b/src/syscall/syscall_libc_wasi.go index 5e6a231dff..29d79b50c1 100644 --- a/src/syscall/syscall_libc_wasi.go +++ b/src/syscall/syscall_libc_wasi.go @@ -398,8 +398,7 @@ func Chmod(path string, mode uint32) (err error) { } func Getpagesize() int { - // per upstream - return 65536 + return libc_getpagesize() } type Utsname struct { @@ -428,6 +427,11 @@ func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) // This is a stub, it is not functional. func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) +// int getpagesize(void); +// +//export getpagesize +func libc_getpagesize() int + // int stat(const char *path, struct stat * buf); // //export stat