]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: support non-amd64 on script/toolexec.txt
authorDaniel Martí <mvdan@mvdan.cc>
Thu, 22 Oct 2020 18:32:47 +0000 (19:32 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Thu, 22 Oct 2020 19:43:26 +0000 (19:43 +0000)
In https://golang.org/cl/263357, I wasn't thinking that the assembly
file without a GOARCH suffix would be built for all architectures. Only
build assembly for amd64, and update the stderr matching line.

I manually verified that this works on 386; since the only Go file in
that package is a stub, and no assembly files match GOARCH=386, no
assembly is built at all.

Change-Id: Ief3c6c9bdc223f342821b0ec27f00098fc25246a
Reviewed-on: https://go-review.googlesource.com/c/go/+/264457
Trust: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

src/cmd/go/testdata/script/toolexec.txt

index 021b7f16847062bcbed9c0c71dd1dfd533d6bac8..526234196b599262cb64bf632319744a63db83f1 100644 (file)
@@ -11,7 +11,7 @@ go build ./cmd/mytool
 # Finally, note that asm and cgo are run twice.
 
 go build -toolexec=$PWD/mytool
-stderr -count=2 '^asm'${GOEXE}' TOOLEXEC_IMPORTPATH=test/main/withasm$'
+[amd64] stderr -count=2 '^asm'${GOEXE}' TOOLEXEC_IMPORTPATH=test/main/withasm$'
 stderr -count=1 '^compile'${GOEXE}' TOOLEXEC_IMPORTPATH=test/main/withasm$'
 [cgo] stderr -count=2 '^cgo'${GOEXE}' TOOLEXEC_IMPORTPATH=test/main/withcgo$'
 [cgo] stderr -count=1 '^compile'${GOEXE}' TOOLEXEC_IMPORTPATH=test/main/withcgo$'
@@ -46,7 +46,9 @@ package withcgo
 // Stub file to ensure we build without cgo too.
 -- withasm/withasm.go --
 package withasm
--- withasm/withasm.s --
+
+// Note that we don't need to declare the Add func at all.
+-- withasm/withasm_amd64.s --
 TEXT ·Add(SB),$0-24
        MOVQ a+0(FP), AX
        ADDQ b+8(FP), AX