Skip to content

Conversation

@zchee
Copy link
Contributor

@zchee zchee commented Dec 17, 2025

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.

go env output
AR='/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar'
CC='/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang'
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'
$ git rev-parse --abbrev-ref HEAD
go
$ git rev-parse HEAD
9f2192bea5ab6eeec7cf59c2a0f609fffbadbcca

# 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

@tamird
Copy link
Contributor

tamird commented Dec 25, 2025

I think there's also a nonsensical constraint here:

//go:build amd64 && !go1.25 && !go1.26

since go1.26 is true iff go1.25 is true, so logical AND there is pointless.

@zchee
Copy link
Contributor Author

zchee commented Dec 25, 2025

@tamird

I think there's also a nonsensical constraint here:

yep, I'd overlooked. I'll fix as well later.

@zchee zchee force-pushed the fix-go126-build-constraints branch from 14bb657 to 049a70d Compare December 29, 2025 10:54
@zchee
Copy link
Contributor Author

zchee commented Dec 29, 2025

@ayushr2 @tamird PTAL

@zchee zchee force-pushed the fix-go126-build-constraints branch from 049a70d to ccb762a Compare December 29, 2025 13:03
@zchee
Copy link
Contributor Author

zchee commented Jan 8, 2026

gentle ping

Signed-off-by: Koichi Shiraishi <[email protected]>
@zchee zchee force-pushed the fix-go126-build-constraints branch from ccb762a to 02d0f03 Compare January 8, 2026 02:11
Copy link
Collaborator

@ayushr2 ayushr2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@zchee
Copy link
Contributor Author

zchee commented Jan 8, 2026

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.

@zchee
Copy link
Contributor Author

zchee commented Jan 8, 2026

@ayushr2 is thiss changes are correct?


If correctly and need to squash, I'll do that.

// 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.
Copy link
Collaborator

@ayushr2 ayushr2 Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment is wrong, should be // https://go.dev/cl/714800 (1.26) changes size of the schedt.midle field.

@ayushr2
Copy link
Collaborator

ayushr2 commented Jan 8, 2026

Could you also squash your commits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants