Commit 19e48c05b8 for golang
commit 19e48c05b8b99cf72c19e2f83e26f2fe3b65a9c8
Author: Zxilly <zhouxinyu1001@gmail.com>
Date: Mon Sep 7 20:00:47 2026 +0800
all: enable the wasip1/wasm32 port
Enable GOOS=wasip1 GOARCH=wasm32 in the build and test tools. Support
GOWASM options and use internal linking for -buildmode=c-shared WASI
reactors. Reuse the existing WASI execution wrapper.
Document the new port and extend compiler and WASI tests to wasm32.
Keep wasm32 caller-PC assembly checks with port enablement so earlier
changes remain independently testable.
Rebased and reviewed and uploaded by drchase@google.com .
Updates #63131
Cq-Include-Trybots: luci.golang.try:gotip-darwin-arm64-longtest,gotip-linux-amd64-longtest,gotip-linux-amd64-longtest-race,gotip-wasip1-wasm_wazero
Change-Id: I5c536a5712a66c53c5e582f4e1660a5570e4990d
Reviewed-on: https://go-review.googlesource.com/c/go/+/836657
Reviewed-by: Carlos Amedee <carlos@golang.org>
TryBot-Bypass: David Chase <drchase@google.com>
diff --git a/lib/wasm/go_wasip1_wasm32_exec b/lib/wasm/go_wasip1_wasm32_exec
new file mode 100755
index 0000000000..b3bb1e13e4
--- /dev/null
+++ b/lib/wasm/go_wasip1_wasm32_exec
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+# Copyright 2026 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+
+SOURCE="${BASH_SOURCE[0]}"
+while [ -h "$SOURCE" ]; do
+ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+ SOURCE="$(readlink "$SOURCE")"
+ [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
+done
+DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+exec "$DIR/go_wasip1_wasm_exec" "$@"
diff --git a/src/cmd/compile/doc.go b/src/cmd/compile/doc.go
index b12453ff25..1a1c7c363a 100644
--- a/src/cmd/compile/doc.go
+++ b/src/cmd/compile/doc.go
@@ -319,7 +319,7 @@ the function is accessed from outside the package.
//go:wasmimport importmodule importname
-The //go:wasmimport directive is wasm-only and must be followed by a
+The //go:wasmimport directive is WebAssembly-only and must be followed by a
function declaration with no body.
It specifies that the function is provided by a wasm module identified
by ``importmodule'' and ``importname''. For example,
@@ -331,7 +331,7 @@ causes g to refer to the WebAssembly function f from module a_module.
//go:wasmexport exportname
-The //go:wasmexport directive is wasm-only and must be followed by a
+The //go:wasmexport directive is WebAssembly-only and must be followed by a
function definition.
It specifies that the function is exported to the wasm host as ``exportname''.
For example,
@@ -362,5 +362,9 @@ int32, uint32, int64, uint64, float32, float64, an array whose element type is
a permitted pointer element type, or a struct, which, if non-empty, embeds
[structs.HostLayout], and contains only fields whose types are permitted pointer
element types.
+
+On GOARCH=wasm32, a permitted pointer element may itself be a pointer or
+unsafe.Pointer because Go and the WebAssembly host use the same 32-bit pointer
+width. These nested pointer element types remain disallowed on GOARCH=wasm.
*/
package main
diff --git a/src/cmd/compile/internal/logopt/logopt_test.go b/src/cmd/compile/internal/logopt/logopt_test.go
index 1edabf9fb7..8dbbd09baa 100644
--- a/src/cmd/compile/internal/logopt/logopt_test.go
+++ b/src/cmd/compile/internal/logopt/logopt_test.go
@@ -146,8 +146,8 @@ func s15a8(x *[15]int64) [15]int64 {
// On not-amd64, test the host architecture and os
arches := []string{runtime.GOARCH}
goos0 := runtime.GOOS
- if runtime.GOARCH == "amd64" { // Test many things with "linux" (wasm will get "js")
- arches = []string{"arm", "arm64", "386", "amd64", "mips", "mips64", "loong64", "ppc64le", "riscv64", "s390x", "wasm"}
+ if runtime.GOARCH == "amd64" { // Test many things with "linux" (wasm will get "js", wasm32 will get "wasip1")
+ arches = []string{"arm", "arm64", "386", "amd64", "mips", "mips64", "loong64", "ppc64le", "riscv64", "s390x", "wasm", "wasm32"}
goos0 = "linux"
}
@@ -156,6 +156,8 @@ func s15a8(x *[15]int64) [15]int64 {
goos := goos0
if arch == "wasm" {
goos = "js"
+ } else if arch == "wasm32" {
+ goos = "wasip1"
}
_, err := testCopy(t, dir, arch, goos, copy, outcopy)
if err != nil {
diff --git a/src/cmd/compile/internal/ssa/debug_lines_test.go b/src/cmd/compile/internal/ssa/debug_lines_test.go
index d89e684f0f..540daa1be3 100644
--- a/src/cmd/compile/internal/ssa/debug_lines_test.go
+++ b/src/cmd/compile/internal/ssa/debug_lines_test.go
@@ -208,6 +208,8 @@ func compileAndDump(t *testing.T, file, function, moreGCFlags string) []byte {
testGoos := "linux" // default to linux
if testGoArch() == "wasm" {
testGoos = "js"
+ } else if testGoArch() == "wasm32" {
+ testGoos = "wasip1"
}
cmd.Env = replaceEnv(cmd.Env, "GOOS", testGoos)
cmd.Env = replaceEnv(cmd.Env, "GOARCH", testGoArch())
diff --git a/src/cmd/compile/internal/test/inl_test.go b/src/cmd/compile/internal/test/inl_test.go
index fd9b67c03c..539fb5d764 100644
--- a/src/cmd/compile/internal/test/inl_test.go
+++ b/src/cmd/compile/internal/test/inl_test.go
@@ -293,7 +293,7 @@ func TestIntendedInlining(t *testing.T) {
}
switch runtime.GOARCH {
- case "386", "wasm", "arm":
+ case "386", "wasm", "wasm32", "arm":
default:
// TODO(mvdan): As explained in /test/inline_sync.go, some
// architectures don't have atomic intrinsics, so these go over
@@ -308,7 +308,7 @@ func TestIntendedInlining(t *testing.T) {
}
}
- if runtime.GOARCH != "wasm" {
+ if runtime.GOARCH != "wasm" && runtime.GOARCH != "wasm32" {
// mutex implementation for multi-threaded GOARCHes
want["runtime"] = append(want["runtime"],
// in the fast paths of lock2 and unlock2
diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
index ae97882d57..99eb9e0786 100644
--- a/src/cmd/dist/build.go
+++ b/src/cmd/dist/build.go
@@ -83,6 +83,7 @@ var okgoarch = []string{
"s390x",
"sparc64",
"wasm",
+ "wasm32",
}
// The known operating systems.
@@ -1317,6 +1318,7 @@ var cgoEnabled = map[string]bool{
"ios/amd64": true,
"js/wasm": false,
"wasip1/wasm": false,
+ "wasip1/wasm32": false,
"netbsd/386": true,
"netbsd/amd64": true,
"netbsd/arm": true,
diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go
index f3a3cb5a56..d1073de903 100644
--- a/src/cmd/dist/test.go
+++ b/src/cmd/dist/test.go
@@ -1930,7 +1930,7 @@ func buildModeSupported(compiler, buildmode, goos, goarch string) bool {
"freebsd/amd64",
"darwin/amd64", "darwin/arm64",
"windows/amd64", "windows/386", "windows/arm64",
- "wasip1/wasm":
+ "wasip1/wasm", "wasip1/wasm32":
return true
}
return false
diff --git a/src/cmd/distpack/test.go b/src/cmd/distpack/test.go
index 7fd2dad57b..3c231e0f47 100644
--- a/src/cmd/distpack/test.go
+++ b/src/cmd/distpack/test.go
@@ -79,6 +79,7 @@ var modRules = []testRule{
{name: "golang.org/toolchain@*/lib/wasm/go_js_wasm_exec"},
{name: "golang.org/toolchain@*/lib/wasm/go_wasip1_wasm_exec"},
+ {name: "golang.org/toolchain@*/lib/wasm/go_wasip1_wasm32_exec"},
{name: "golang.org/toolchain@*/lib/wasm/wasm_exec.js"},
{name: "golang.org/toolchain@*/lib/wasm/wasm_exec_node.js"},
diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go
index 63e650a10e..b6bda0bfba 100644
--- a/src/cmd/go/alldocs.go
+++ b/src/cmd/go/alldocs.go
@@ -2208,8 +2208,8 @@
// - For GOARCH=riscv64,
// GORISCV64=rva20u64, rva22u64 and rva23u64 correspond to the riscv64.rva20u64,
// riscv64.rva22u64 and riscv64.rva23u64 build tags.
-// - For GOARCH=wasm, GOWASM=satconv and signext
-// correspond to the wasm.satconv and wasm.signext feature build tags.
+// - For GOARCH=wasm or wasm32, GOWASM=satconv and signext
+// correspond to the GOARCH.satconv and GOARCH.signext feature build tags.
//
// For GOARCH=amd64, arm, ppc64, ppc64le, and riscv64, a particular feature level
// sets the feature build tags for all previous levels as well.
@@ -2605,7 +2605,7 @@
// See https://github.com/riscv/riscv-profiles/blob/main/src/profiles.adoc
// and https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc
// GOWASM
-// For GOARCH=wasm, comma-separated list of experimental WebAssembly features to use.
+// For GOARCH=wasm or wasm32, comma-separated list of experimental WebAssembly features to use.
// Valid values are satconv, signext.
//
// Environment variables for use with code coverage:
diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go
index b3de11588d..9616894646 100644
--- a/src/cmd/go/internal/cfg/cfg.go
+++ b/src/cmd/go/internal/cfg/cfg.go
@@ -544,7 +544,7 @@ func GetArchEnv() (key, val string, changed bool) {
return "GOPPC64", GOPPC64, goPPC64Changed
case "riscv64":
return "GORISCV64", GORISCV64, goRISCV64Changed
- case "wasm":
+ case "wasm", "wasm32":
return "GOWASM", GOWASM, goWASMChanged
}
return "", "", false
diff --git a/src/cmd/go/internal/help/helpdoc.go b/src/cmd/go/internal/help/helpdoc.go
index fa2da9425d..362d0af9dc 100644
--- a/src/cmd/go/internal/help/helpdoc.go
+++ b/src/cmd/go/internal/help/helpdoc.go
@@ -727,7 +727,7 @@ Architecture-specific environment variables:
See https://github.com/riscv/riscv-profiles/blob/main/src/profiles.adoc
and https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc
GOWASM
- For GOARCH=wasm, comma-separated list of experimental WebAssembly features to use.
+ For GOARCH=wasm or wasm32, comma-separated list of experimental WebAssembly features to use.
Valid values are satconv, signext.
Environment variables for use with code coverage:
@@ -1035,8 +1035,8 @@ The defined architecture feature build tags are:
- For GOARCH=riscv64,
GORISCV64=rva20u64, rva22u64 and rva23u64 correspond to the riscv64.rva20u64,
riscv64.rva22u64 and riscv64.rva23u64 build tags.
- - For GOARCH=wasm, GOWASM=satconv and signext
- correspond to the wasm.satconv and wasm.signext feature build tags.
+ - For GOARCH=wasm or wasm32, GOWASM=satconv and signext
+ correspond to the GOARCH.satconv and GOARCH.signext feature build tags.
For GOARCH=amd64, arm, ppc64, ppc64le, and riscv64, a particular feature level
sets the feature build tags for all previous levels as well.
diff --git a/src/cmd/go/internal/load/pkg.go b/src/cmd/go/internal/load/pkg.go
index 40be16f173..cea09bdb22 100644
--- a/src/cmd/go/internal/load/pkg.go
+++ b/src/cmd/go/internal/load/pkg.go
@@ -2731,7 +2731,7 @@ func externalLinkingReason(s *modload.Loader, p *Package) (what string) {
// Some build modes always require external linking.
switch cfg.BuildBuildmode {
case "c-shared":
- if cfg.BuildContext.GOARCH == "wasm" {
+ if cfg.BuildContext.GOARCH == "wasm" || cfg.BuildContext.GOARCH == "wasm32" {
break
}
fallthrough
diff --git a/src/cmd/go/internal/telemetrystats/telemetrystats.go b/src/cmd/go/internal/telemetrystats/telemetrystats.go
index b32f9e2d37..86f3fb0c88 100644
--- a/src/cmd/go/internal/telemetrystats/telemetrystats.go
+++ b/src/cmd/go/internal/telemetrystats/telemetrystats.go
@@ -56,7 +56,7 @@ func incrementConfig() {
counter.Inc("go/platform/target/goppc64:" + cfg.GOPPC64)
case "riscv64":
counter.Inc("go/platform/target/goriscv64:" + cfg.GORISCV64)
- case "wasm":
+ case "wasm", "wasm32":
counter.Inc("go/platform/target/gowasm:" + cfg.GOWASM)
}
diff --git a/src/cmd/go/internal/work/gc.go b/src/cmd/go/internal/work/gc.go
index 8f135a0999..86c7fa26c0 100644
--- a/src/cmd/go/internal/work/gc.go
+++ b/src/cmd/go/internal/work/gc.go
@@ -117,7 +117,7 @@ func (gcToolchain) gc(b *Builder, a *Action, export string, importcfg, embedcfg
if a.buildID != "" {
defaultGcFlags = append(defaultGcFlags, "-buildid", a.buildID)
}
- if p.Internal.OmitDebug || cfg.Goos == "plan9" || cfg.Goarch == "wasm" {
+ if p.Internal.OmitDebug || cfg.Goos == "plan9" || cfg.Goarch == "wasm" || cfg.Goarch == "wasm32" {
defaultGcFlags = append(defaultGcFlags, "-dwarf=false")
}
if strings.HasPrefix(ToolchainVersion, "go1") && !strings.Contains(os.Args[0], "go_bootstrap") {
@@ -847,7 +847,7 @@ func bindingNeedsExternalLink(ldBuildmode string) bool {
case "c-shared", "plugin", "shared":
// c-archive is not listed: the external linker for a c-archive
// is the host archiver, not the C compiler.
- return cfg.Goarch != "wasm"
+ return cfg.Goarch != "wasm" && cfg.Goarch != "wasm32"
case "pie":
return !platform.InternalLinkPIESupported(cfg.Goos, cfg.Goarch)
}
diff --git a/src/cmd/go/testdata/script/tooltags.txt b/src/cmd/go/testdata/script/tooltags.txt
index a69b7a5c37..a349c1d668 100644
--- a/src/cmd/go/testdata/script/tooltags.txt
+++ b/src/cmd/go/testdata/script/tooltags.txt
@@ -75,6 +75,22 @@ env GOWASM=satconv
go list -f '{{context.ToolTags}}'
stdout 'wasm.satconv'
+env GOARCH=wasm32
+env GOWASM=stackswitch
+go list -f '{{context.ToolTags}}'
+stdout 'wasm32.satconv wasm32.signext wasm32.stackswitch'
+
+env GOARCH=wasm32
+env GOWASM=bogus
+! go list -f '{{context.ToolTags}}'
+stderr 'invalid GOWASM: no such feature "bogus"'
+
+env GOARCH=wasm32
+env GOWASM=
+go list -f '{{context.ToolTags}}'
+stdout 'wasm32.satconv wasm32.signext'
+! stdout 'wasm32.stackswitch'
+
-- go.mod --
module m
diff --git a/src/cmd/internal/testdir/testdir_test.go b/src/cmd/internal/testdir/testdir_test.go
index 67a4799268..32f1bd8cd7 100644
--- a/src/cmd/internal/testdir/testdir_test.go
+++ b/src/cmd/internal/testdir/testdir_test.go
@@ -290,7 +290,7 @@ func (t test) expectFail() bool {
// Note: gccgo supports more 32-bit architectures than this, but
// hopefully the 32-bit failures are fixed before this matters.
switch goarch {
- case "386", "arm", "mips", "mipsle":
+ case "386", "arm", "mips", "mipsle", "wasm32":
failureSets = append(failureSets, types2Failures32Bit)
}
@@ -1669,6 +1669,8 @@ func (t test) wantedAsmOpcodes(fn string) asmChecks {
os, arch, subarch = "linux", archspec[0], ""
if arch == "wasm" {
os = "js"
+ } else if arch == "wasm32" {
+ os = "wasip1"
}
}
diff --git a/src/cmd/link/internal/ld/config.go b/src/cmd/link/internal/ld/config.go
index cc0cb7ff16..a7cf6bf4f5 100644
--- a/src/cmd/link/internal/ld/config.go
+++ b/src/cmd/link/internal/ld/config.go
@@ -159,7 +159,7 @@ func mustLinkExternal(ctxt *Link) (res bool, reason string) {
case BuildModeCArchive:
return true, "buildmode=c-archive"
case BuildModeCShared:
- if buildcfg.GOARCH == "wasm" {
+ if buildcfg.GOARCH == "wasm" || buildcfg.GOARCH == "wasm32" {
break
}
return true, "buildmode=c-shared"
diff --git a/src/cmd/link/internal/ld/execarchive.go b/src/cmd/link/internal/ld/execarchive.go
index 7a19567a6c..7e43d4b1c5 100644
--- a/src/cmd/link/internal/ld/execarchive.go
+++ b/src/cmd/link/internal/ld/execarchive.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 !wasm && !windows
+//go:build !wasm && !wasm32 && !windows
package ld
diff --git a/src/cmd/link/internal/ld/execarchive_noexec.go b/src/cmd/link/internal/ld/execarchive_noexec.go
index ada3e9f74a..4a76e14420 100644
--- a/src/cmd/link/internal/ld/execarchive_noexec.go
+++ b/src/cmd/link/internal/ld/execarchive_noexec.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 wasm || windows
+//go:build wasm || wasm32 || windows
package ld
diff --git a/src/internal/buildcfg/cfg.go b/src/internal/buildcfg/cfg.go
index 1ff0b792c9..db8663a945 100644
--- a/src/internal/buildcfg/cfg.go
+++ b/src/internal/buildcfg/cfg.go
@@ -430,7 +430,7 @@ func GOGOARCH() (name, value string) {
return "GOPPC64", fmt.Sprintf("power%d", GOPPC64)
case "riscv64":
return "GORISCV64", fmt.Sprintf("rva%du64", GORISCV64)
- case "wasm":
+ case "wasm", "wasm32":
return "GOWASM", GOWASM.String()
}
return "", ""
@@ -485,7 +485,7 @@ func gogoarchTags() []string {
list = append(list, GOARCH+"."+"rva23u64")
}
return list
- case "wasm":
+ case "wasm", "wasm32":
var list []string
// SatConv is always enabled
list = append(list, GOARCH+".satconv")
diff --git a/src/internal/platform/supported.go b/src/internal/platform/supported.go
index 17db4cb479..7d517095d0 100644
--- a/src/internal/platform/supported.go
+++ b/src/internal/platform/supported.go
@@ -199,7 +199,7 @@ func BuildModeSupported(compiler, buildmode, goos, goarch string) bool {
"freebsd/amd64",
"darwin/amd64", "darwin/arm64",
"windows/amd64", "windows/386", "windows/arm64",
- "wasip1/wasm":
+ "wasip1/wasm", "wasip1/wasm32":
return true
}
return false
diff --git a/src/internal/platform/zosarch.go b/src/internal/platform/zosarch.go
index ec6368e8b0..18938a1724 100644
--- a/src/internal/platform/zosarch.go
+++ b/src/internal/platform/zosarch.go
@@ -54,6 +54,7 @@ var List = []OSArch{
{"plan9", "arm"},
{"solaris", "amd64"},
{"wasip1", "wasm"},
+ {"wasip1", "wasm32"},
{"windows", "386"},
{"windows", "amd64"},
{"windows", "arm64"},
@@ -106,6 +107,7 @@ var distInfo = map[OSArch]osArchInfo{
{"plan9", "arm"}: {},
{"solaris", "amd64"}: {CgoSupported: true},
{"wasip1", "wasm"}: {},
+ {"wasip1", "wasm32"}: {},
{"windows", "386"}: {CgoSupported: true, FirstClass: true},
{"windows", "amd64"}: {CgoSupported: true, FirstClass: true},
{"windows", "arm64"}: {CgoSupported: true},
diff --git a/src/internal/runtime/wasitest/host_test.go b/src/internal/runtime/wasitest/host_test.go
index ca4ef8f4e8..56d9e18f09 100644
--- a/src/internal/runtime/wasitest/host_test.go
+++ b/src/internal/runtime/wasitest/host_test.go
@@ -4,7 +4,10 @@
package wasi_test
-import "flag"
+import (
+ "flag"
+ "strings"
+)
var target string
@@ -12,3 +15,12 @@ func init() {
// The dist test runner passes -target when running this as a host test.
flag.StringVar(&target, "target", "", "")
}
+
+func targetArch() (string, bool) {
+ const prefix = "wasip1/"
+ if !strings.HasPrefix(target, prefix) {
+ return "", false
+ }
+ arch := strings.TrimPrefix(target, prefix)
+ return arch, arch == "wasm" || arch == "wasm32"
+}
diff --git a/src/internal/runtime/wasitest/nonblock_test.go b/src/internal/runtime/wasitest/nonblock_test.go
index 4fd04cd2e7..db5869186a 100644
--- a/src/internal/runtime/wasitest/nonblock_test.go
+++ b/src/internal/runtime/wasitest/nonblock_test.go
@@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.
// Not all systems have syscall.Mkfifo.
-//go:build !aix && !plan9 && !solaris && !wasm&& !wasm32 && !windows
+//go:build !aix && !plan9 && !solaris && !wasm && !wasm32 && !windows
package wasi_test
@@ -33,7 +33,8 @@ type fifo struct {
}
func TestNonblock(t *testing.T) {
- if target != "wasip1/wasm" {
+ arch, ok := targetArch()
+ if !ok {
t.Skip()
}
@@ -72,7 +73,7 @@ func TestNonblock(t *testing.T) {
subProcess := exec.Command(testenv.GoToolPath(t), args...)
- subProcess.Env = append(os.Environ(), "GOOS=wasip1", "GOARCH=wasm")
+ subProcess.Env = append(os.Environ(), "GOOS=wasip1", "GOARCH="+arch)
pr, pw := io.Pipe()
defer pw.Close()
diff --git a/src/internal/runtime/wasitest/tcpecho_test.go b/src/internal/runtime/wasitest/tcpecho_test.go
index aa57d9e2e3..047666e63b 100644
--- a/src/internal/runtime/wasitest/tcpecho_test.go
+++ b/src/internal/runtime/wasitest/tcpecho_test.go
@@ -17,7 +17,8 @@ import (
)
func TestTCPEcho(t *testing.T) {
- if target != "wasip1/wasm" {
+ arch, ok := targetArch()
+ if !ok {
t.Skip()
}
@@ -49,7 +50,7 @@ func TestTCPEcho(t *testing.T) {
subProcess := exec.Command(testenv.GoToolPath(t), "run", "./testdata/tcpecho.go")
- subProcess.Env = append(os.Environ(), "GOOS=wasip1", "GOARCH=wasm")
+ subProcess.Env = append(os.Environ(), "GOOS=wasip1", "GOARCH="+arch)
switch os.Getenv("GOWASIRUNTIME") {
case "wazero":
diff --git a/src/time/sleep_test.go b/src/time/sleep_test.go
index 4a12c5a8b9..41de103fc7 100644
--- a/src/time/sleep_test.go
+++ b/src/time/sleep_test.go
@@ -149,7 +149,7 @@ func TestAfterFuncStarvation(t *testing.T) {
// Even if GOMAXPROCS=1, we expect the runtime to eventually schedule
// the AfterFunc goroutine instead of the runnable channel goroutine.
// However, in https://go.dev/issue/65178 this was observed to live-lock
- // on wasip1/wasm and js/wasm after <10000 runs.
+ // on wasip1 and js/wasm after <10000 runs.
defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(1))
var (
diff --git a/test/abi/bad_internal_offsets.go b/test/abi/bad_internal_offsets.go
index bad4ebdc8e..e689f50609 100644
--- a/test/abi/bad_internal_offsets.go
+++ b/test/abi/bad_internal_offsets.go
@@ -1,6 +1,6 @@
// compile
-//go:build !wasm
+//go:build !wasm && !wasm32
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/abi/double_nested_addressed_struct.go b/test/abi/double_nested_addressed_struct.go
index c3e68a1783..165985d61f 100644
--- a/test/abi/double_nested_addressed_struct.go
+++ b/test/abi/double_nested_addressed_struct.go
@@ -1,6 +1,6 @@
// run
-//go:build !wasm
+//go:build !wasm && !wasm32
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/abi/double_nested_struct.go b/test/abi/double_nested_struct.go
index 0dce143f57..2e62a23c11 100644
--- a/test/abi/double_nested_struct.go
+++ b/test/abi/double_nested_struct.go
@@ -1,6 +1,6 @@
// run
-//go:build !wasm
+//go:build !wasm && !wasm32
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/abi/f_ret_z_not.go b/test/abi/f_ret_z_not.go
index 0fec654e4b..470bcfee72 100644
--- a/test/abi/f_ret_z_not.go
+++ b/test/abi/f_ret_z_not.go
@@ -1,6 +1,6 @@
// run
-//go:build !wasm
+//go:build !wasm && !wasm32
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/abi/fibish.go b/test/abi/fibish.go
index 20ed92437a..7b68f416ef 100644
--- a/test/abi/fibish.go
+++ b/test/abi/fibish.go
@@ -1,6 +1,6 @@
// run
-//go:build !wasm
+//go:build !wasm && !wasm32
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/abi/fibish_closure.go b/test/abi/fibish_closure.go
index 682886cec4..c54c18abc5 100644
--- a/test/abi/fibish_closure.go
+++ b/test/abi/fibish_closure.go
@@ -1,6 +1,6 @@
// run
-//go:build !wasm
+//go:build !wasm && !wasm32
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/abi/leaf.go b/test/abi/leaf.go
index fb1be5cd8a..e6135d33e5 100644
--- a/test/abi/leaf.go
+++ b/test/abi/leaf.go
@@ -1,6 +1,6 @@
// run
-//go:build !wasm
+//go:build !wasm && !wasm32
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/abi/leaf2.go b/test/abi/leaf2.go
index fdad59cf7e..4a12dc64ac 100644
--- a/test/abi/leaf2.go
+++ b/test/abi/leaf2.go
@@ -1,6 +1,6 @@
// run
-//go:build !wasm
+//go:build !wasm && !wasm32
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/abi/many_int_input.go b/test/abi/many_int_input.go
index 046e31c39d..2c962bd98b 100644
--- a/test/abi/many_int_input.go
+++ b/test/abi/many_int_input.go
@@ -1,6 +1,6 @@
// run
-//go:build !wasm
+//go:build !wasm && !wasm32
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/abi/many_intstar_input.go b/test/abi/many_intstar_input.go
index dc9e43b5ab..1911d4208a 100644
--- a/test/abi/many_intstar_input.go
+++ b/test/abi/many_intstar_input.go
@@ -1,6 +1,6 @@
// run
-//go:build !wasm
+//go:build !wasm && !wasm32
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/abi/more_intstar_input.go b/test/abi/more_intstar_input.go
index 256081d0f5..20ad6a85ab 100644
--- a/test/abi/more_intstar_input.go
+++ b/test/abi/more_intstar_input.go
@@ -1,6 +1,6 @@
// run
-//go:build !wasm
+//go:build !wasm && !wasm32
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/abi/named_results.go b/test/abi/named_results.go
index 07ea4610bf..95a939e5c1 100644
--- a/test/abi/named_results.go
+++ b/test/abi/named_results.go
@@ -1,6 +1,6 @@
// run
-//go:build !wasm
+//go:build !wasm && !wasm32
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/abi/named_return_stuff.go b/test/abi/named_return_stuff.go
index ac779f0dbe..27747d2906 100644
--- a/test/abi/named_return_stuff.go
+++ b/test/abi/named_return_stuff.go
@@ -1,6 +1,6 @@
// run
-//go:build !wasm
+//go:build !wasm && !wasm32
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/abi/reg_not_ssa.go b/test/abi/reg_not_ssa.go
index da0f405116..d5a0d45c12 100644
--- a/test/abi/reg_not_ssa.go
+++ b/test/abi/reg_not_ssa.go
@@ -1,6 +1,6 @@
// run
-//go:build !wasm
+//go:build !wasm && !wasm32
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/abi/return_stuff.go b/test/abi/return_stuff.go
index 222a9ee89a..7b302ab23a 100644
--- a/test/abi/return_stuff.go
+++ b/test/abi/return_stuff.go
@@ -1,6 +1,6 @@
// run
-//go:build !wasm
+//go:build !wasm && !wasm32
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/abi/s_sif_sif.go b/test/abi/s_sif_sif.go
index f57faac674..b4c717d7a2 100644
--- a/test/abi/s_sif_sif.go
+++ b/test/abi/s_sif_sif.go
@@ -1,6 +1,6 @@
// run
-//go:build !wasm
+//go:build !wasm && !wasm32
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/abi/spills3.go b/test/abi/spills3.go
index 4dee3eb679..5f04019885 100644
--- a/test/abi/spills3.go
+++ b/test/abi/spills3.go
@@ -1,6 +1,6 @@
// run
-//go:build !wasm
+//go:build !wasm && !wasm32
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/abi/spills4.go b/test/abi/spills4.go
index 646d6965d8..d991cbddc4 100644
--- a/test/abi/spills4.go
+++ b/test/abi/spills4.go
@@ -1,6 +1,6 @@
// run
-//go:build !wasm
+//go:build !wasm && !wasm32
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/abi/struct_3_string_input.go b/test/abi/struct_3_string_input.go
index 2291bbb036..4622ccb873 100644
--- a/test/abi/struct_3_string_input.go
+++ b/test/abi/struct_3_string_input.go
@@ -1,6 +1,6 @@
// run
-//go:build !wasm
+//go:build !wasm && !wasm32
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/abi/struct_lower_1.go b/test/abi/struct_lower_1.go
index 363b85c019..dced9feef2 100644
--- a/test/abi/struct_lower_1.go
+++ b/test/abi/struct_lower_1.go
@@ -1,6 +1,6 @@
// run
-//go:build !wasm
+//go:build !wasm && !wasm32
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/abi/too_big_to_ssa.go b/test/abi/too_big_to_ssa.go
index e10acd1752..07aad537ea 100644
--- a/test/abi/too_big_to_ssa.go
+++ b/test/abi/too_big_to_ssa.go
@@ -1,6 +1,6 @@
// run
-//go:build !wasm
+//go:build !wasm && !wasm32
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/abi/uglyfib.go b/test/abi/uglyfib.go
index 9c9d710105..3c3161e1fe 100644
--- a/test/abi/uglyfib.go
+++ b/test/abi/uglyfib.go
@@ -1,6 +1,6 @@
// run
-//go:build !wasm
+//go:build !wasm && !wasm32
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/abi/wrapdefer_largetmp.go b/test/abi/wrapdefer_largetmp.go
index 1aaaade39c..7af97fd306 100644
--- a/test/abi/wrapdefer_largetmp.go
+++ b/test/abi/wrapdefer_largetmp.go
@@ -1,6 +1,6 @@
// run
-//go:build !wasm
+//go:build !wasm && !wasm32
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/codegen/arithmetic.go b/test/codegen/arithmetic.go
index e07b7442b4..46100d2724 100644
--- a/test/codegen/arithmetic.go
+++ b/test/codegen/arithmetic.go
@@ -421,6 +421,12 @@ func ConstDivs(n1 uint, n2 int) (uint, int) {
return a, b
}
+func ConstDiv7(n uint32) uint32 {
+ // wasm:1`I64Mul` -`I64DivU`
+ // wasm32:1`I64Mul` -`I64DivU`
+ return n / 7
+}
+
func FloatDivs(a []float32) float32 {
// amd64:`DIVSS 8\([A-Z]+\), X[0-9]+`
// 386/sse2:`DIVSS 8\([A-Z]+\), X[0-9]+`
diff --git a/test/codegen/memops.go b/test/codegen/memops.go
index 0800fbcbaf..4f84f6869f 100644
--- a/test/codegen/memops.go
+++ b/test/codegen/memops.go
@@ -23,11 +23,13 @@ func Equal4Constant(p unsafe.Pointer) bool {
func Equal8Constant(p unsafe.Pointer) bool {
// wasm:`I64Eq` -`.*memequal.*`
+ // wasm32:`I64Eq` -`.*memequal.*`
return memequal(p, unsafe.Pointer(unsafe.StringData("abcdefgh")), 8)
}
func Equal5Constant(p unsafe.Pointer) bool {
// wasm:`I64Eq` -`.*memequal.*`
+ // wasm32:`I64Eq` -`.*memequal.*`
return memequal(unsafe.Pointer(unsafe.StringData("abcde")), p, 5)
}
diff --git a/test/codegen/slices.go b/test/codegen/slices.go
index 8d9f265d41..84e552af14 100644
--- a/test/codegen/slices.go
+++ b/test/codegen/slices.go
@@ -524,6 +524,17 @@ func SliceAndIndex(a []int, b int) int {
return a[b:][b]
}
+// 64-bit indices on wasm32 use the backend panic path.
+func IndexInt64(s []byte, i int64) byte {
+ // wasm32:`Call runtime\.panicExtend\(SB\)` -`Call runtime\.goPanicExtend`
+ return s[i]
+}
+
+func IndexUint64(s []byte, i uint64) byte {
+ // wasm32:`Call runtime\.panicExtend\(SB\)` -`Call runtime\.goPanicExtend`
+ return s[i]
+}
+
// --------------------------------------- //
// Code generation for unsafe.Slice //
// --------------------------------------- //
diff --git a/test/codegen/wasmimport.go b/test/codegen/wasmimport.go
index 061f743f2a..31e5b15887 100644
--- a/test/codegen/wasmimport.go
+++ b/test/codegen/wasmimport.go
@@ -4,22 +4,22 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build wasm
+//go:build wasm || wasm32
package codegen
// Imported 32-bit values should not be widened just to store them on the Go stack.
//go:wasmimport test int32
-func ImportInt32() int32 // wasm:`I32Store\s` -`I64ExtendI32U`
+func ImportInt32() int32 // wasm:`I32Store\s` -`I64ExtendI32U` wasm32:`I32Store\s` -`I64ExtendI32U`
//go:wasmimport test bool
-func ImportBool() bool // wasm:`I32Store8` -`I64ExtendI32U`
+func ImportBool() bool // wasm:`I32Store8` -`I64ExtendI32U` wasm32:`I32Store8` -`I64ExtendI32U`
// Pointer results must retain their full Go pointer width on each architecture.
//go:wasmimport test pointer
-func ImportPointer() *byte // wasm:`I64ExtendI32U` `I64Store\s`
+func ImportPointer() *byte // wasm:`I64ExtendI32U` `I64Store\s` wasm32:`I32Store\s` -`I64ExtendI32U`
//go:wasmimport test int64
-func ImportInt64() int64 // wasm:`I64Store\s`
+func ImportInt64() int64 // wasm:`I64Store\s` wasm32:`I64Store\s`
diff --git a/test/codegen/wasmjump.go b/test/codegen/wasmjump.go
index 0e5b980907..fa04169e61 100644
--- a/test/codegen/wasmjump.go
+++ b/test/codegen/wasmjump.go
@@ -9,6 +9,7 @@ package codegen
// Branch directly to basic blocks located after the jump.
func wasmJumpForward(x int) int {
// wasm:`Br\s` -`Set\sPC_B`
+ // wasm32:`Br\s` -`Set\sPC_B`
if x > 0 {
return x + 1
}
diff --git a/test/convert5.go b/test/convert5.go
index 6a787071de..5e43877bcd 100644
--- a/test/convert5.go
+++ b/test/convert5.go
@@ -4,7 +4,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build !wasm && !386 && !arm && !mips && !mipsle
+//go:build !wasm && !wasm32 && !386 && !arm && !mips && !mipsle
// TODO fix this to work for wasm and 32-bit architectures.
// Doing more than this, however, expands the change.
diff --git a/test/convinline.go b/test/convinline.go
index e9a6bf9f11..77a22dbee0 100644
--- a/test/convinline.go
+++ b/test/convinline.go
@@ -1,5 +1,5 @@
// runoutput
-//go:build !wasm
+//go:build !wasm && !wasm32
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/fixedbugs/issue11656.go b/test/fixedbugs/issue11656.go
index 2d746891d6..15768a445f 100644
--- a/test/fixedbugs/issue11656.go
+++ b/test/fixedbugs/issue11656.go
@@ -16,6 +16,6 @@
// any unwind information for the artificial function, and will not be
// able to unwind past that point.
-//go:build !windows && !wasm && !gccgo
+//go:build !windows && !wasm && !wasm32 && !gccgo
package ignored
diff --git a/test/fixedbugs/issue22200b.go b/test/fixedbugs/issue22200b.go
index 79fa91c435..fcb237f727 100644
--- a/test/fixedbugs/issue22200b.go
+++ b/test/fixedbugs/issue22200b.go
@@ -1,6 +1,6 @@
// errorcheck
-//go:build !386 && !amd64p32 && !arm && !mips && !mipsle
+//go:build !386 && !amd64p32 && !arm && !mips && !mipsle && !wasm32
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/fixedbugs/issue52697.go b/test/fixedbugs/issue52697.go
index 7143a101a5..29c8cc31ce 100644
--- a/test/fixedbugs/issue52697.go
+++ b/test/fixedbugs/issue52697.go
@@ -4,7 +4,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build !386 && !amd64p32 && !arm && !mips && !mipsle
+//go:build !386 && !amd64p32 && !arm && !mips && !mipsle && !wasm32
package main
diff --git a/test/fixedbugs/issue6036.go b/test/fixedbugs/issue6036.go
index e7c2557864..dac447f1eb 100644
--- a/test/fixedbugs/issue6036.go
+++ b/test/fixedbugs/issue6036.go
@@ -1,6 +1,6 @@
// compile
-//go:build !386 && !arm && !mips && !mipsle && !amd64p32
+//go:build !386 && !arm && !mips && !mipsle && !amd64p32 && !wasm32
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/fixedbugs/issue75764.go b/test/fixedbugs/issue75764.go
index efc36a3e98..94634d7fe0 100644
--- a/test/fixedbugs/issue75764.go
+++ b/test/fixedbugs/issue75764.go
@@ -43,7 +43,7 @@ func best(f func() time.Duration) time.Duration {
}
func main() {
- if runtime.GOARCH == "wasm" {
+ if runtime.GOARCH == "wasm" || runtime.GOARCH == "wasm32" {
// TODO: upgrade wasm to do indirect tail calls
return
}
diff --git a/test/fixedbugs/issue80519.go b/test/fixedbugs/issue80519.go
index 5b8bad4773..6acd9fe448 100644
--- a/test/fixedbugs/issue80519.go
+++ b/test/fixedbugs/issue80519.go
@@ -121,7 +121,7 @@ func main() {
panic("range clear target changed through unsafe pointer field")
}
- if runtime.GOARCH != "wasm" {
+ if runtime.GOARCH != "wasm" && runtime.GOARCH != "wasm32" {
panicked = false
func() {
defer func() {
diff --git a/test/fixedbugs/issue80896.go b/test/fixedbugs/issue80896.go
index 131a862df9..986c34f023 100644
--- a/test/fixedbugs/issue80896.go
+++ b/test/fixedbugs/issue80896.go
@@ -1,6 +1,6 @@
// errorcheck -std
-//go:build !(386 || arm || mips || mipsle)
+//go:build !(386 || arm || mips || mipsle || wasm32)
// Copyright 2026 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/fixedbugs/issue9604b.go b/test/fixedbugs/issue9604b.go
index 0033a6ff95..114027bb11 100644
--- a/test/fixedbugs/issue9604b.go
+++ b/test/fixedbugs/issue9604b.go
@@ -5,7 +5,7 @@
// license that can be found in the LICENSE file.
// terribly slow on wasm
-//go:build !wasm
+//go:build !wasm && !wasm32
package main
diff --git a/test/inline_sync.go b/test/inline_sync.go
index 8359aa3aa2..e4cfad3d90 100644
--- a/test/inline_sync.go
+++ b/test/inline_sync.go
@@ -1,6 +1,6 @@
// errorcheck -0 -m
-//go:build !nacl && !386 && !wasm && !arm && !gcflags_noopt
+//go:build !nacl && !386 && !wasm && !wasm32 && !arm && !gcflags_noopt
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/internal/runtime/sys/callerpc.go b/test/internal/runtime/sys/callerpc.go
index c87b068709..7eb3fa3e2a 100644
--- a/test/internal/runtime/sys/callerpc.go
+++ b/test/internal/runtime/sys/callerpc.go
@@ -15,5 +15,6 @@ func callerPC() uintptr {
// The continuation slot is 8 bytes on both ports, but wasm32 stores
// the logical PC in its low word and the function handle in its high word.
// wasm:`I64Load\s` -`I64Load32U`
+ // wasm32:`I64Load32U` -`I64Load\s`
return GetCallerPC()
}
diff --git a/test/nilptr3.go b/test/nilptr3.go
index 2cc510beb6..d98bfa27f2 100644
--- a/test/nilptr3.go
+++ b/test/nilptr3.go
@@ -1,6 +1,6 @@
// errorcheck -0 -d=nil
-//go:build !wasm && !aix
+//go:build !wasm && !wasm32 && !aix
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/nilptr5.go b/test/nilptr5.go
index a76592abad..f286f190fd 100644
--- a/test/nilptr5.go
+++ b/test/nilptr5.go
@@ -1,6 +1,6 @@
// errorcheck -0 -d=nil
-//go:build !wasm && !aix
+//go:build !wasm && !wasm32 && !aix
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/nilptr5_wasm.go b/test/nilptr5_wasmx.go
similarity index 97%
rename from test/nilptr5_wasm.go
rename to test/nilptr5_wasmx.go
index e653ffd287..de9d8d1141 100644
--- a/test/nilptr5_wasm.go
+++ b/test/nilptr5_wasmx.go
@@ -1,6 +1,6 @@
// errorcheck -0 -d=nil
-//go:build wasm
+//go:build wasm || wasm32
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/peano.go b/test/peano.go
index 1102a97244..e5325f9a2b 100644
--- a/test/peano.go
+++ b/test/peano.go
@@ -119,7 +119,7 @@ var results = [...]int{
func main() {
max := 9
- if runtime.GOARCH == "wasm" {
+ if runtime.GOARCH == "wasm" || runtime.GOARCH == "wasm32" {
max = 7 // stack size is limited
}
for i := 0; i <= max; i++ {
diff --git a/test/wasmexport.go b/test/wasmexport.go
index 3b92ae93c9..f137e62868 100644
--- a/test/wasmexport.go
+++ b/test/wasmexport.go
@@ -6,7 +6,7 @@
// Verify that misplaced directives are diagnosed.
-//go:build wasm
+//go:build wasm || wasm32
package p
diff --git a/test/wasmexport2.go b/test/wasmexport2.go
index cfbfab99b0..19c96d3580 100644
--- a/test/wasmexport2.go
+++ b/test/wasmexport2.go
@@ -7,7 +7,7 @@
// Verify that wasmexport supports allowed types and rejects
// unallowed types.
-//go:build wasm
+//go:build wasm || wasm32
package p
diff --git a/test/wasmexport_wasm32.go b/test/wasmexport_wasm32.go
new file mode 100644
index 0000000000..c16d5650cc
--- /dev/null
+++ b/test/wasmexport_wasm32.go
@@ -0,0 +1,31 @@
+// errorcheck
+
+// Copyright 2026 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build wasm32
+
+package p
+
+import (
+ "structs"
+ "unsafe"
+)
+
+type pointerHostLayout struct {
+ _ structs.HostLayout
+ p *int32
+ u unsafe.Pointer
+}
+
+//go:wasmexport nestedPointers
+func nestedPointers(**int32, *pointerHostLayout) {}
+
+type badHostLayout struct {
+ _ structs.HostLayout
+ s string
+}
+
+//go:wasmexport badNestedValue
+func badNestedValue(*badHostLayout) {} // ERROR "go:wasmexport: unsupported parameter type"
diff --git a/test/wasmmemsize.dir/asm_wasm.s b/test/wasmmemsize.dir/asm_wasmx.s
similarity index 90%
rename from test/wasmmemsize.dir/asm_wasm.s
rename to test/wasmmemsize.dir/asm_wasmx.s
index daccfcc753..55889543a9 100644
--- a/test/wasmmemsize.dir/asm_wasm.s
+++ b/test/wasmmemsize.dir/asm_wasmx.s
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build wasm || wasm32
+
#include "textflag.h"
TEXT ·currentMemory(SB), NOSPLIT, $0
diff --git a/test/wasmmemsize.go b/test/wasmmemsize.go
index 4498169087..1c436d6a9b 100644
--- a/test/wasmmemsize.go
+++ b/test/wasmmemsize.go
@@ -6,6 +6,6 @@
// This test checks the memory size of a small wasm program.
-//go:build wasm
+//go:build wasm || wasm32
package ignored