Files
garble/testdata/script/crossbuild.txtar
Daniel Martí 30357af923 drop Go 1.22 and require Go 1.23.0 or later (#876)
This lets us start taking advantage of featurs from Go 1.23,
particularly tracking aliases in go/types and iterators.

Note that we need to add code to properly handle or skip over the new
*types.Alias type which go/types produces for Go type aliases.
Also note that we actually turn this mode off entirely for now,
due to the bug reported at https://go.dev/issue/70394.

We don't yet remove our own alias tracking code yet due to the above.
We hope to be able to remove it very soon.
2024-11-17 16:06:57 +01:00

53 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 also windows; then linux.
# GOARCH=arm, unless the host is also arm; then amd64.
# Windows and ARM are both interesting,
# and it helps with coverage as we mainly test on linux/amd64.
#
# 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
[!arm] env GOARCH=arm
[arm] env GOARCH=arm64
exec garble build -gcflags=math/bits=-d=ssa/intrinsics/debug=1
stderr 'intrinsic substitution for Len64.*BitLen64'
# 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]