Files
garble/testdata/script/crossbuild.txtar
T
Daniel Martí 41b45f9a9c windows/arm is gone for Go 1.26, use GOARCH=386 instead
We still test GOARCH=arm64 as part of darwin/arm64 below.
2026-03-15 23:36:56 +01:00

52 lines
1.7 KiB
Plaintext

# A fairly average Go build, importing some std libraries.
# We always build for a foreign GOOS.
# GOOS=windows, unless the host is already windows, in which case linux.
# GOARCH=386, unless the host is already 386, in which case amd64.
# This helps ensure good coverage for Windows and 32-bit architectures.
#
# We also ensure that intrinsics work as expected.
# The compiler replaces calls to some functions with intrinsics in its ssa stage,
# and it recognizes which functions via the package path and func name.
# If we obfuscate those package paths without adjusting the compiler,
# intrinsics aren't applied, causing performance loss or build errors.
# We use the math/bits package, as its Len64 intrinsic is present in both arm
# and arm64, and it is not part of the runtime nor its dependencies.
[!windows] env GOOS=windows
[windows] env GOOS=linux
[!386] env GOARCH=386
[386] env GOARCH=amd64
exec garble build -gcflags=math/bits=-d=ssa/intrinsics/debug=1
stderr 'intrinsic substitution for ReverseBytes32.*Bswap32'
# As a last step, also test building for MacOS if we're not already on it.
# We already cover Windows and Linux above, and MacOS is the other major OS.
# The way it is implemented in the standard library, in particular with syscalls,
# is different enough that it sometimes causes special bugs.
[darwin] stop
env GOOS=darwin
env GOARCH=arm64
exec garble build
-- go.mod --
module test/main
go 1.23
-- main.go --
package main
import "net/http"
func main() {
http.ListenAndServe("", nil)
}
-- 32bit.go --
//go:build arm
package main
// Will give "out of bounds" if we don't correctly set up types.Config.Sizes.
const is64bit = ^uint(0) >> 63 // 0 for 32-bit hosts, 1 for 64-bit ones.
var x [1]struct{}
var _ = x[is64bit]