mirror of
https://github.com/burrowers/garble.git
synced 2025-12-24 12:58:05 +08:00
fix building for GOOS=darwin on Go 1.22.0
It seems like building with Go 1.22.0 for GOOS=darwin started
running into some issues with the syscall package's use of ABIInternal
in assembly source code:
> exec garble build
[stderr]
# syscall
[...].s:16: ABI selector only permitted when compiling runtime, reference was to "runtime.entersyscall"
The error can be reproduced from another platform like GOOS=linux
as long as we have any test that cross-compiles std to GOOS=darwin.
We had crossbuild.txtar which only ensured we covered GOOS=windows
and GOOS=linux, so add a third case to ensure MacOS is covered too.
This will slow down the tests a bit, but is important for the sake
of ensuring that we catch these bugs early, even without MacOS on CI.
In fact, we hadn't caught this earlier for Go 1.22 precisely because
on CI we only tested on Go tip with GOOS=linux, for the sake of speed.
Adding the rest of the package import paths from objabi.allowAsmABIPkgs
to our runtimeAndDeps generated map solves this error.
This commit is contained in:
committed by
Paul Scheduikat
parent
7a67952494
commit
55921a06d4
6
testdata/script/gogarble.txtar
vendored
6
testdata/script/gogarble.txtar
vendored
@@ -36,11 +36,11 @@ exec garble build std
|
||||
# Also ensure we are obfuscating low-level std packages.
|
||||
exec garble build -o=out ./stdimporter
|
||||
! stderr . # no warnings
|
||||
! binsubstr out 'http.ListenAndServe' 'debug.WriteHeapDump' 'time.Now' 'syscall.Listen'
|
||||
! binsubstr out 'http.ListenAndServe' 'debug.WriteHeapDump' 'time.Now'
|
||||
|
||||
# The same low-level std packages appear in plain sight in regular builds.
|
||||
go build -o=out_regular ./stdimporter
|
||||
binsubstr out_regular 'http.ListenAndServe' 'debug.WriteHeapDump' 'time.Now' 'syscall.Listen'
|
||||
binsubstr out_regular 'http.ListenAndServe' 'debug.WriteHeapDump' 'time.Now'
|
||||
|
||||
# Also check that a full rebuild is reproducible, via a new GOCACHE.
|
||||
# This is slow, but necessary to uncover bugs hidden by the build cache.
|
||||
@@ -79,7 +79,6 @@ import (
|
||||
"net/http"
|
||||
"runtime/debug"
|
||||
"time"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -88,5 +87,4 @@ func main() {
|
||||
// as it is implemented by runtime via a linkname.
|
||||
debug.WriteHeapDump(1)
|
||||
time.Now()
|
||||
syscall.Listen(0, 1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user