Prepare for go.dev/cl/652276

Upstream Go CL https://go.dev/cl/652276 removes an unused field from
runtime.gobuf. This CL prepares for this change.

This CL also simplifies the build constraints in the hosttid files:
- Remove legacy '// +build' constraint syntax
- Remove explicit GOARCH matching. The GOARCH is in the filename

PiperOrigin-RevId: 733382770
This commit is contained in:
gVisor bot
2025-03-04 10:41:09 -08:00
parent c050619971
commit 1f79e1b26f
10 changed files with 119 additions and 8 deletions
+2
View File
@@ -13,6 +13,8 @@ go_library(
"goid_122_arm64.s",
"goid_123_amd64.s",
"goid_123_arm64.s",
"goid_125_amd64.s",
"goid_125_arm64.s",
],
stateify = False,
visibility = ["//visibility:public"],
+1 -1
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build go1.23
//go:build go1.23 && !go1.25
#include "textflag.h"
+1 -1
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build go1.23
//go:build go1.23 && !go1.25
#include "textflag.h"
+26
View File
@@ -0,0 +1,26 @@
// Copyright 2020 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build go1.25
#include "textflag.h"
#define GOID_OFFSET 152 // +checkoffset runtime g.goid
// func goid() int64
TEXT ·goid(SB),NOSPLIT|NOFRAME,$0-8
MOVQ (TLS), R14
MOVQ GOID_OFFSET(R14), R14
MOVQ R14, ret+0(FP)
RET
+26
View File
@@ -0,0 +1,26 @@
// Copyright 2020 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build go1.25
#include "textflag.h"
#define GOID_OFFSET 152 // +checkoffset runtime g.goid
// func goid() int64
TEXT ·goid(SB),NOSPLIT,$0-8
MOVD g, R0 // g
MOVD GOID_OFFSET(R0), R0
MOVD R0, ret+0(FP)
RET
+4 -2
View File
@@ -9,8 +9,10 @@ go_library(
name = "hosttid",
srcs = [
"hosttid.go",
"hosttid_amd64.s",
"hosttid_arm64.s",
"hosttid_124_amd64.s",
"hosttid_124_arm64.s",
"hosttid_125_amd64.s",
"hosttid_125_arm64.s",
],
visibility = ["//visibility:public"],
)
@@ -12,8 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build amd64
// +build amd64
//go:build !go1.25
#include "textflag.h"
@@ -12,8 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build arm64
// +build arm64
//go:build !go1.25
#include "textflag.h"
+29
View File
@@ -0,0 +1,29 @@
// Copyright 2018 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build go1.25
#include "textflag.h"
#define M_OFFSET 48 // +checkoffset runtime g.m
#define PROCID_OFFSET 64 // +checkoffset runtime m.procid
TEXT ·Current(SB),NOSPLIT|NOFRAME,$0-8
// procid is in getg().m.procid.
MOVQ TLS, AX
MOVQ 0(AX)(TLS*1), AX
MOVQ M_OFFSET(AX), AX // gp.m
MOVQ PROCID_OFFSET(AX), AX // mp.procid
MOVQ AX, ret+0(FP)
RET
+28
View File
@@ -0,0 +1,28 @@
// Copyright 2018 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build go1.25
#include "textflag.h"
#define M_OFFSET 48 // +checkoffset runtime g.m
#define PROCID_OFFSET 64 // +checkoffset runtime m.procid
TEXT ·Current(SB),NOSPLIT,$0-8
// procid is in getg().m.procid.
MOVD g, R0 // g
MOVD M_OFFSET(R0), R0 // gp.m
MOVD PROCID_OFFSET(R0), R0 // mp.procid
MOVD R0, ret+0(FP)
RET