diff --git a/pkg/sync/BUILD b/pkg/sync/BUILD index 3f2676a5e..5950fbb78 100644 --- a/pkg/sync/BUILD +++ b/pkg/sync/BUILD @@ -29,6 +29,7 @@ go_library( "runtime_constants.go", "runtime_exectracer2.go", "runtime_go121_unsafe.go", + "runtime_go124_unsafe.go", "runtime_not_go121_unsafe.go", "runtime_other.go", "runtime_spinning_amd64.s", diff --git a/pkg/sync/runtime_go121_unsafe.go b/pkg/sync/runtime_go121_unsafe.go index 344b55663..cda0855ef 100644 --- a/pkg/sync/runtime_go121_unsafe.go +++ b/pkg/sync/runtime_go121_unsafe.go @@ -3,7 +3,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build go1.21 +//go:build go1.21 && !go1.24 package sync diff --git a/pkg/sync/runtime_go124_unsafe.go b/pkg/sync/runtime_go124_unsafe.go new file mode 100644 index 000000000..66ba80ba0 --- /dev/null +++ b/pkg/sync/runtime_go124_unsafe.go @@ -0,0 +1,14 @@ +// Copyright 2024 The gVisor Authors. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.24 + +package sync + +import "unsafe" + +// Use checkoffset to assert that maptype.hasher (the only field we use) has +// the correct offset. +const maptypeHasherOffset = unsafe.Offsetof(maptype{}.Hasher) // +checkoffset internal/abi SwissMapType.Hasher diff --git a/tools/checkconst/checkconst.go b/tools/checkconst/checkconst.go index d3003e9c6..9e5419b20 100644 --- a/tools/checkconst/checkconst.go +++ b/tools/checkconst/checkconst.go @@ -142,19 +142,6 @@ func extractFacts(pass *analysis.Pass) { // Accumulate all facts. c.walkScope(pass, make([]string, 0, 128), pass.Pkg.Scope()) - // "MapType" was renamed to "OldMapType" in go.dev/cl/580779, but there - // are a number of nogo tests that rely on MapType.Hasher to be present. - // Rolling out that change without breaking nogo tests is means that we - // need to support both names for a short while until we can use the go1.24 - // build tag to fix the issue in sources. - // - // TODO(floriank): Remove once no longer needed - if pass.Pkg.Path() == "internal/abi" { - if cc, ok := c.Offsets["OldMapType.Hasher"]; ok { - c.Offsets["MapType.Hasher"] = cc - } - } - pass.ExportPackageFact(&c) }