aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRandy Reddig <[email protected]>2024-03-04 10:26:41 -0800
committerRon Evans <[email protected]>2024-03-27 16:01:40 +0100
commit8e8ad9004f165716e64676ec534def097594484a (patch)
treedc2c799469dad10a48bdb12de056387d6d52709a /src
parent62d8cdb218ff4ff37998ad91f9f9e9e146f70271 (diff)
downloadtinygo-8e8ad9004f165716e64676ec534def097594484a.tar.gz
tinygo-8e8ad9004f165716e64676ec534def097594484a.zip
all: replace target=wasi with target=wasip1
This eliminates the 'wasi' build tag in favor of 'GOOS=wasip1', introduced in Go 1.21. For backwards compatablity, -target=wasi is a synonym for -target=wasip1.
Diffstat (limited to 'src')
-rw-r--r--src/crypto/rand/rand_urandom.go2
-rw-r--r--src/os/dir_test.go2
-rw-r--r--src/os/dir_unix.go2
-rw-r--r--src/os/dir_wasip1.go (renamed from src/os/dir_wasi.go)4
-rw-r--r--src/os/dirent_linux.go2
-rw-r--r--src/os/file_other.go2
-rw-r--r--src/os/is_wasi_no_test.go2
-rw-r--r--src/os/is_wasi_test.go2
-rw-r--r--src/os/os_chmod_test.go2
-rw-r--r--src/os/os_symlink_test.go2
-rw-r--r--src/os/read_test.go2
-rw-r--r--src/os/removeall_noat.go2
-rw-r--r--src/os/stat_other.go2
-rw-r--r--src/os/tempfile_test.go2
-rw-r--r--src/runtime/memhash_fnv.go2
-rw-r--r--src/runtime/memhash_leveldb.go2
-rw-r--r--src/runtime/os_linux.go2
-rw-r--r--src/runtime/runtime_unix.go2
-rw-r--r--src/runtime/runtime_wasip1.go (renamed from src/runtime/runtime_wasm_wasi.go)2
-rw-r--r--src/runtime/runtime_wasm_js.go2
-rw-r--r--src/syscall/errno_other.go2
-rw-r--r--src/syscall/syscall_libc_wasip1.go (renamed from src/syscall/syscall_libc_wasi.go)12
-rw-r--r--src/testing/is_wasi_no_test.go2
-rw-r--r--src/testing/is_wasi_test.go2
24 files changed, 34 insertions, 26 deletions
diff --git a/src/crypto/rand/rand_urandom.go b/src/crypto/rand/rand_urandom.go
index 2a55a0ea5..e9a8d485e 100644
--- a/src/crypto/rand/rand_urandom.go
+++ b/src/crypto/rand/rand_urandom.go
@@ -1,4 +1,4 @@
-//go:build linux && !baremetal && !wasi
+//go:build linux && !baremetal && !wasip1
// This implementation of crypto/rand uses the /dev/urandom pseudo-file to
// generate random numbers.
diff --git a/src/os/dir_test.go b/src/os/dir_test.go
index c09067df1..d661c98b4 100644
--- a/src/os/dir_test.go
+++ b/src/os/dir_test.go
@@ -1,4 +1,4 @@
-//go:build darwin || (linux && !baremetal && !js && !wasi && !386 && !arm)
+//go:build darwin || (linux && !baremetal && !js && !wasip1 && !386 && !arm)
package os_test
diff --git a/src/os/dir_unix.go b/src/os/dir_unix.go
index baacdd68d..a531e0a63 100644
--- a/src/os/dir_unix.go
+++ b/src/os/dir_unix.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build linux && !baremetal && !wasi && !wasip1
+//go:build linux && !baremetal && !wasip1
package os
diff --git a/src/os/dir_wasi.go b/src/os/dir_wasip1.go
index 23be3950e..0be0da4d6 100644
--- a/src/os/dir_wasi.go
+++ b/src/os/dir_wasip1.go
@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// This file was derived from src/os/dir_darwin.go since the logic for wasi is
+// This file was derived from src/os/dir_darwin.go since the logic for WASI is
// fairly similar: we use fdopendir, fdclosedir, and readdir from wasi-libc in
// a similar way that the darwin code uses functions from libc.
-//go:build wasi || wasip1
+//go:build wasip1
package os
diff --git a/src/os/dirent_linux.go b/src/os/dirent_linux.go
index 2527182fb..90f7086db 100644
--- a/src/os/dirent_linux.go
+++ b/src/os/dirent_linux.go
@@ -1,4 +1,4 @@
-//go:build !baremetal && !js && !wasi
+//go:build !baremetal && !js && !wasip1
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/src/os/file_other.go b/src/os/file_other.go
index 0ceee0020..e7fabddca 100644
--- a/src/os/file_other.go
+++ b/src/os/file_other.go
@@ -1,4 +1,4 @@
-//go:build baremetal || (wasm && !wasi && !wasip1)
+//go:build baremetal || (wasm && !wasip1)
package os
diff --git a/src/os/is_wasi_no_test.go b/src/os/is_wasi_no_test.go
index aa7745085..f98070cdc 100644
--- a/src/os/is_wasi_no_test.go
+++ b/src/os/is_wasi_no_test.go
@@ -1,4 +1,4 @@
-//go:build !wasi && !wasip1
+//go:build !wasip1
package os_test
diff --git a/src/os/is_wasi_test.go b/src/os/is_wasi_test.go
index 619b1cb64..1e9ad898c 100644
--- a/src/os/is_wasi_test.go
+++ b/src/os/is_wasi_test.go
@@ -1,4 +1,4 @@
-//go:build wasi || wasip1
+//go:build wasip1
package os_test
diff --git a/src/os/os_chmod_test.go b/src/os/os_chmod_test.go
index 911438d95..b8f7d354f 100644
--- a/src/os/os_chmod_test.go
+++ b/src/os/os_chmod_test.go
@@ -1,4 +1,4 @@
-//go:build !baremetal && !js && !wasi && !wasip1
+//go:build !baremetal && !js && !wasip1
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/src/os/os_symlink_test.go b/src/os/os_symlink_test.go
index f252116f5..f885dd32c 100644
--- a/src/os/os_symlink_test.go
+++ b/src/os/os_symlink_test.go
@@ -1,4 +1,4 @@
-//go:build !windows && !baremetal && !js && !wasi && !wasip1
+//go:build !windows && !baremetal && !js && !wasip1
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/src/os/read_test.go b/src/os/read_test.go
index e037b2349..679d96113 100644
--- a/src/os/read_test.go
+++ b/src/os/read_test.go
@@ -1,4 +1,4 @@
-//go:build !baremetal && !js && !wasi && !wasip1
+//go:build !baremetal && !js && !wasip1
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/src/os/removeall_noat.go b/src/os/removeall_noat.go
index ae945c249..8b03756e3 100644
--- a/src/os/removeall_noat.go
+++ b/src/os/removeall_noat.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build !baremetal && !js && !wasi && !wasip1
+//go:build !baremetal && !js && !wasip1
package os
diff --git a/src/os/stat_other.go b/src/os/stat_other.go
index ff1bc3774..7340fbb57 100644
--- a/src/os/stat_other.go
+++ b/src/os/stat_other.go
@@ -1,4 +1,4 @@
-//go:build baremetal || (wasm && !wasi && !wasip1)
+//go:build baremetal || (wasm && !wasip1)
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/src/os/tempfile_test.go b/src/os/tempfile_test.go
index 4b7416f4e..cf3fd46d7 100644
--- a/src/os/tempfile_test.go
+++ b/src/os/tempfile_test.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build !baremetal && !js && !wasi && !wasip1
+//go:build !baremetal && !js && !wasip1
package os_test
diff --git a/src/runtime/memhash_fnv.go b/src/runtime/memhash_fnv.go
index 4d82971d0..69802e053 100644
--- a/src/runtime/memhash_fnv.go
+++ b/src/runtime/memhash_fnv.go
@@ -1,4 +1,4 @@
-//go:build (!wasi && !runtime_memhash_tsip && !runtime_memhash_leveldb) || (wasi && runtime_memhash_fnv)
+//go:build (!wasip1 && !runtime_memhash_tsip && !runtime_memhash_leveldb) || (wasip1 && runtime_memhash_fnv)
// This is the default for all targets except WASI, unless a more specific build
// tag is set.
diff --git a/src/runtime/memhash_leveldb.go b/src/runtime/memhash_leveldb.go
index 22ff829e4..f57c9cf93 100644
--- a/src/runtime/memhash_leveldb.go
+++ b/src/runtime/memhash_leveldb.go
@@ -1,4 +1,4 @@
-//go:build runtime_memhash_leveldb || (wasi && !runtime_memhash_fnv && !runtime_memhash_tsip)
+//go:build runtime_memhash_leveldb || (wasip1 && !runtime_memhash_fnv && !runtime_memhash_tsip)
// This is the default for WASI, but can also be used on other targets with the
// right build tag.
diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go
index 3f27dfd16..9780e5401 100644
--- a/src/runtime/os_linux.go
+++ b/src/runtime/os_linux.go
@@ -1,4 +1,4 @@
-//go:build linux && !baremetal && !nintendoswitch && !wasi && !wasm_unknown
+//go:build linux && !baremetal && !nintendoswitch && !wasip1 && !wasm_unknown
package runtime
diff --git a/src/runtime/runtime_unix.go b/src/runtime/runtime_unix.go
index f1f1c4df7..323c8909a 100644
--- a/src/runtime/runtime_unix.go
+++ b/src/runtime/runtime_unix.go
@@ -1,4 +1,4 @@
-//go:build (darwin || (linux && !baremetal && !wasi && !wasm_unknown)) && !nintendoswitch
+//go:build (darwin || (linux && !baremetal && !wasip1 && !wasm_unknown)) && !nintendoswitch
package runtime
diff --git a/src/runtime/runtime_wasm_wasi.go b/src/runtime/runtime_wasip1.go
index f258039ae..595cab9bf 100644
--- a/src/runtime/runtime_wasm_wasi.go
+++ b/src/runtime/runtime_wasip1.go
@@ -1,4 +1,4 @@
-//go:build tinygo.wasm && (wasi || wasip1)
+//go:build wasip1
package runtime
diff --git a/src/runtime/runtime_wasm_js.go b/src/runtime/runtime_wasm_js.go
index 18ca44abe..96e923c89 100644
--- a/src/runtime/runtime_wasm_js.go
+++ b/src/runtime/runtime_wasm_js.go
@@ -1,4 +1,4 @@
-//go:build wasm && !wasi && !wasip1
+//go:build wasm && !wasip1
package runtime
diff --git a/src/syscall/errno_other.go b/src/syscall/errno_other.go
index a00109652..839b5f435 100644
--- a/src/syscall/errno_other.go
+++ b/src/syscall/errno_other.go
@@ -1,4 +1,4 @@
-//go:build !wasi && !wasip1 && !darwin
+//go:build !wasip1 && !darwin
package syscall
diff --git a/src/syscall/syscall_libc_wasi.go b/src/syscall/syscall_libc_wasip1.go
index 29d79b50c..eff7d5a5f 100644
--- a/src/syscall/syscall_libc_wasi.go
+++ b/src/syscall/syscall_libc_wasip1.go
@@ -1,4 +1,4 @@
-//go:build wasi || wasip1
+//go:build wasip1
package syscall
@@ -397,8 +397,16 @@ func Chmod(path string, mode uint32) (err error) {
return Lstat(path, &stat)
}
+// wasmPageSize is the size of a page in WebAssembly's 32-bit memory. This
+// is also its only unit of change.
+//
+// See https://www.w3.org/TR/wasm-core-1/#page-size
+//
+// FIXME: this is also defined in package runtime.
+const wasmPageSize = 64 * 1024
+
func Getpagesize() int {
- return libc_getpagesize()
+ return wasmPageSize
}
type Utsname struct {
diff --git a/src/testing/is_wasi_no_test.go b/src/testing/is_wasi_no_test.go
index 630467ec0..08b6d56c5 100644
--- a/src/testing/is_wasi_no_test.go
+++ b/src/testing/is_wasi_no_test.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
-//go:build !wasi && !wasip1
+//go:build !wasip1
package testing_test
diff --git a/src/testing/is_wasi_test.go b/src/testing/is_wasi_test.go
index e20e15fc0..d39b6c867 100644
--- a/src/testing/is_wasi_test.go
+++ b/src/testing/is_wasi_test.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
-//go:build wasi || wasip1
+//go:build wasip1
package testing_test