aboutsummaryrefslogtreecommitdiff
path: root/src/internal/cpu
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2024-05-21 23:02:51 -0400
committerGopher Robot <gobot@golang.org>2024-05-22 21:17:41 +0000
commit5fee159bc2e60736ce967560ee5be738fe5d5bd2 (patch)
treee6ebbad97d446072a6d06b3c5f8a5748b7014b96 /src/internal/cpu
parent4c589d93ad6f77e31cccc237c20133f0d8d8492f (diff)
downloadgo-5fee159bc2e60736ce967560ee5be738fe5d5bd2.tar.xz
all: document legacy //go:linkname for modules with ≥50,000 dependents
Note that this depends on the revert of CL 581395 to move zeroVal back. For #67401. Change-Id: I507c27c2404ad1348aabf1ffa3740e6b1957495b Reviewed-on: https://go-review.googlesource.com/c/go/+/587217 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/internal/cpu')
-rw-r--r--src/internal/cpu/badlinkname_linux_arm64.go15
-rw-r--r--src/internal/cpu/cpu_arm64_hwcap.go11
2 files changed, 11 insertions, 15 deletions
diff --git a/src/internal/cpu/badlinkname_linux_arm64.go b/src/internal/cpu/badlinkname_linux_arm64.go
deleted file mode 100644
index 9e2cfcef06..0000000000
--- a/src/internal/cpu/badlinkname_linux_arm64.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2024 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package cpu
-
-import _ "unsafe"
-
-// As of Go 1.22, the symbols below are found to be pulled via
-// linkname in the wild. We provide a push linkname here, to
-// keep them accessible with pull linknames.
-// This may change in the future. Please do not depend on them
-// in new code.
-
-//go:linkname HWCap
diff --git a/src/internal/cpu/cpu_arm64_hwcap.go b/src/internal/cpu/cpu_arm64_hwcap.go
index 7f0504ca16..34edf3eeb2 100644
--- a/src/internal/cpu/cpu_arm64_hwcap.go
+++ b/src/internal/cpu/cpu_arm64_hwcap.go
@@ -6,8 +6,19 @@
package cpu
+import _ "unsafe" // for linkname
+
// HWCap may be initialized by archauxv and
// should not be changed after it was initialized.
+//
+// Other widely used packages
+// access HWCap using linkname as well, most notably:
+// - github.com/klauspost/cpuid/v2
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname HWCap
var HWCap uint
// HWCAP bits. These are exposed by Linux.