From 5fee159bc2e60736ce967560ee5be738fe5d5bd2 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 21 May 2024 23:02:51 -0400 Subject: all: document legacy //go:linkname for modules with ≥50,000 dependents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Auto-Submit: Russ Cox Reviewed-by: Cherry Mui --- src/internal/cpu/badlinkname_linux_arm64.go | 15 --------------- src/internal/cpu/cpu_arm64_hwcap.go | 11 +++++++++++ 2 files changed, 11 insertions(+), 15 deletions(-) delete mode 100644 src/internal/cpu/badlinkname_linux_arm64.go (limited to 'src/internal') 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. -- cgit v1.3-5-g9baa