sync: fix go1.26 build constraints#12397
Conversation
|
I think there's also a nonsensical constraint here: gvisor/pkg/sync/runtime_spinning_amd64.s Line 17 in 466fd4e since go1.26 is true iff go1.25 is true, so logical AND there is pointless. |
yep, I'd overlooked. I'll fix as well later. |
14bb657 to
049a70d
Compare
049a70d to
ccb762a
Compare
|
gentle ping |
ccb762a to
02d0f03
Compare
ayushr2
left a comment
There was a problem hiding this comment.
Sorry for the back and forth regarding comments. Was having trouble importing this change. It seems that we have a Copybara transformation which requires that go1.25 be accompanied with // https://go.dev/cl/669235 (1.25) adds a new schedt field prior to nmspinning. and go1.26 be accompanied with // https://go.dev/cl/714800 (1.26) changes size of the schedt.midle field.
Even when using !go1.26, we need the 1.26 comment. If you look, this is the rule that the current codebase is following. I don't agree with it, but defining complex copybara transformations is tough. The transformation currently doesn't understand "don't add comment for !go1.xx".
Could you update your PR with this rule? I will also leave in line comments to clarify more. Without this, the copybara transformations are failing.
|
okay and np! I'm not Googler but I know Copybara is difficult to manage (I heard this from the author of the CUE language), and I'll fix it soon. |
|
@ayushr2 is thiss changes are correct? If correctly and need to squash, I'll do that. |
pkg/sync/runtime_constants_go125.go
Outdated
| // limitations under the License. | ||
|
|
||
| // https://go.dev/cl/670497 (1.25) adds a new wait reason, adjusting the value of waitReasonSemacquire. | ||
| // https://go.dev/cl/688335 (1.26) reorders waitreason runtime constants, adjusting the values of waitReasonSemacquire et al. |
There was a problem hiding this comment.
I think this comment is wrong, should be // https://go.dev/cl/714800 (1.26) changes size of the schedt.midle field.
|
Could you also squash your commits. |
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
5dcd8fe to
ecdf845
Compare
|
@ayushr2 squashed. PTAL. |
Fix compile error on `go1.26rc1`. There is no error in `pkg/sync/runtime_spinning_go126_amd64.s`, but `pkg/sync/runtime_spinning_go125_amd64.s` is blocking `go1.26`, so fix it as well. - https://github.com/google/gvisor/blob/9f2192bea5ab6eeec7cf59c2a0f609fffbadbcca/pkg/sync/runtime_spinning_go125_amd64.s#L17 <details> <summary><code>go env</code> output</summary> ``` AR='/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_ENABLED='1' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' CXX='/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++' GCCGO='gccgo' GO111MODULE='' GOARCH='arm64' GOARM64='v8.0' GOAUTH='netrc' GOBIN='' GOCACHE='/Users/zchee/.cache/go/go-build' GOCACHEPROG='' GODEBUG='' GOENV='/Users/zchee/.config/go/env/env' GOEXE='' GOEXPERIMENT='loopvar,newinliner,jsonv2,greenteagc' GOFIPS140='latest' GOFLAGS='' GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/dp/89wwdp754235m6jmdzj7p5lm0000gn/T/go-build365494810=/tmp/go-build -gno-record-gcc-switches -fno-common' GOHOSTARCH='arm64' GOHOSTOS='darwin' GOINSECURE='' GOMOD='/Users/zchee/go/src/gvisor.dev/gvisor/go.mod' GOMODCACHE='/Users/zchee/go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='darwin' GOPATH='/Users/zchee/go' GOPRIVATE='' GOPROXY='https://proxy.golang.org,direct' GOROOT='/Users/zchee/sdk/go1.26rc1' GOSUMDB='sum.golang.org' GOTELEMETRY='on' GOTELEMETRYDIR='/Users/zchee/Library/Application Support/go/telemetry' GOTMPDIR='' GOTOOLCHAIN='go1.26rc1+auto' GOTOOLDIR='/Users/zchee/sdk/go1.26rc1/pkg/tool/darwin_arm64' GOVCS='' GOVERSION='go1.26rc1' GOWORK='' PKG_CONFIG='pkgconf' ``` </details> ```console $ git rev-parse --abbrev-ref HEAD go $ git rev-parse HEAD 9f2192b # my local machine is darwin/arm64 $ GOOS=linux GOARCH=amd64 go1.26rc1 build -o /dev/null -v ./sync gvisor.dev/gvisor/pkg/sync # gvisor.dev/gvisor/pkg/sync sync/runtime_constants_go126.go:22:2: WaitReasonSelect redeclared in this block sync/runtime_constants_go125.go:22:2: other declaration of WaitReasonSelect sync/runtime_constants_go126.go:23:2: WaitReasonChanReceive redeclared in this block sync/runtime_constants_go125.go:23:2: other declaration of WaitReasonChanReceive sync/runtime_constants_go126.go:24:2: WaitReasonSemacquire redeclared in this block sync/runtime_constants_go125.go:24:2: other declaration of WaitReasonSemacquire ``` FUTURE_COPYBARA_INTEGRATE_REVIEW=#12397 from zchee:fix-go126-build-constraints ecdf845 PiperOrigin-RevId: 854162392
Fix compile error on `go1.26rc1`. <details> <summary><code>go env</code> output</summary> ``` AR='/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_ENABLED='1' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' CXX='/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++' GCCGO='gccgo' GO111MODULE='' GOARCH='arm64' GOARM64='v8.0' GOAUTH='netrc' GOBIN='' GOCACHE='/Users/zchee/.cache/go/go-build' GOCACHEPROG='' GODEBUG='' GOENV='/Users/zchee/.config/go/env/env' GOEXE='' GOEXPERIMENT='loopvar,newinliner,jsonv2,greenteagc' GOFIPS140='latest' GOFLAGS='' GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/dp/89wwdp754235m6jmdzj7p5lm0000gn/T/go-build365494810=/tmp/go-build -gno-record-gcc-switches -fno-common' GOHOSTARCH='arm64' GOHOSTOS='darwin' GOINSECURE='' GOMOD='/Users/zchee/go/src/gvisor.dev/gvisor/go.mod' GOMODCACHE='/Users/zchee/go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='darwin' GOPATH='/Users/zchee/go' GOPRIVATE='' GOPROXY='https://proxy.golang.org,direct' GOROOT='/Users/zchee/sdk/go1.26rc1' GOSUMDB='sum.golang.org' GOTELEMETRY='on' GOTELEMETRYDIR='/Users/zchee/Library/Application Support/go/telemetry' GOTMPDIR='' GOTOOLCHAIN='go1.26rc1+auto' GOTOOLDIR='/Users/zchee/sdk/go1.26rc1/pkg/tool/darwin_arm64' GOVCS='' GOVERSION='go1.26rc1' GOWORK='' PKG_CONFIG='pkgconf' ``` </details> ```console $ git rev-parse --abbrev-ref HEAD go $ git rev-parse HEAD 9f2192b # my local machine is darwin/arm64 $ GOOS=linux GOARCH=amd64 go1.26rc1 build -o /dev/null -v ./sync gvisor.dev/gvisor/pkg/sync # gvisor.dev/gvisor/pkg/sync sync/runtime_constants_go126.go:22:2: WaitReasonSelect redeclared in this block sync/runtime_constants_go125.go:22:2: other declaration of WaitReasonSelect sync/runtime_constants_go126.go:23:2: WaitReasonChanReceive redeclared in this block sync/runtime_constants_go125.go:23:2: other declaration of WaitReasonChanReceive sync/runtime_constants_go126.go:24:2: WaitReasonSemacquire redeclared in this block sync/runtime_constants_go125.go:24:2: other declaration of WaitReasonSemacquire ``` FUTURE_COPYBARA_INTEGRATE_REVIEW=#12397 from zchee:fix-go126-build-constraints ecdf845 PiperOrigin-RevId: 854162392
Fix compile error on
go1.26rc1.There is no error in
pkg/sync/runtime_spinning_go126_amd64.s, butpkg/sync/runtime_spinning_go125_amd64.sis blockinggo1.26, so fix it as well.gvisor/pkg/sync/runtime_spinning_go125_amd64.s
Line 17 in 9f2192b
go envoutput