]> Cypherpunks repositories - gostls13.git/commitdiff
all: document legacy //go:linkname for modules with ≥500 dependents
authorRuss Cox <rsc@golang.org>
Wed, 22 May 2024 19:03:13 +0000 (15:03 -0400)
committerGopher Robot <gobot@golang.org>
Thu, 23 May 2024 01:16:53 +0000 (01:16 +0000)
For #67401.

Change-Id: I7dd28c3b01a1a647f84929d15412aa43ab0089ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/587575
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

23 files changed:
src/database/sql/badlinkname.go
src/database/sql/sql.go
src/internal/bytealg/compare_generic.go
src/internal/cpu/cpu_arm64_darwin.go
src/net/badlinkname.go
src/net/dnsclient.go
src/net/http/badlinkname.go
src/net/http/request.go
src/net/interface.go
src/net/url/badlinkname.go [deleted file]
src/net/url/url.go
src/runtime/alg.go
src/runtime/atomic_pointer.go
src/runtime/badlinkname.go
src/runtime/malloc.go
src/runtime/mgc.go
src/runtime/panic.go
src/runtime/proc.go
src/runtime/rand.go
src/runtime/sema.go
src/runtime/stubs.go
src/sync/badlinkname.go [deleted file]
src/sync/pool.go

index a77def9fbd936ef9cecd0454758b4f13102aa534..95a2354afdc8ab3ea0b3fb0e5fed41d880b96e7f 100644 (file)
@@ -13,4 +13,3 @@ import _ "unsafe"
 // in new code.
 
 //go:linkname convertAssign
-//go:linkname drivers
index 9373aa1c5896c6aa52d92ce9fed255db42b4fdbb..de774a051093df2ffdfe40fda122ac2448b29314 100644 (file)
@@ -29,12 +29,22 @@ import (
        "sync"
        "sync/atomic"
        "time"
+       _ "unsafe"
 )
 
-var (
-       driversMu sync.RWMutex
-       drivers   = make(map[string]driver.Driver)
-)
+var driversMu sync.RWMutex
+
+// drivers should be an internal detail,
+// but widely used packages access it using linkname.
+// (It is extra wrong that they linkname drivers but not driversMu.)
+// Notable members of the hall of shame include:
+//   - github.com/instana/go-sensor
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname drivers
+var drivers = make(map[string]driver.Driver)
 
 // nowFunc returns the current time; it's overridden in tests.
 var nowFunc = time.Now
index 8c08b7e6f5dde5094083dc0a8aace80aa2a5193c..74126ae8051d17576ae96e4a1071c556d9d28664 100644 (file)
@@ -39,6 +39,16 @@ func CompareString(a, b string) int {
        return runtime_cmpstring(a, b)
 }
 
+// runtime.cmpstring calls are emitted by the compiler.
+//
+// runtime.cmpstring should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/bytedance/gopkg
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
 //go:linkname runtime_cmpstring runtime.cmpstring
 func runtime_cmpstring(a, b string) int {
        l := len(a)
index 60beadddbb1d606a4b1ff650160d54dc80703914..fad66c6c9062ffbb5dd502263ac67405fc96f497 100644 (file)
@@ -6,6 +6,8 @@
 
 package cpu
 
+import _ "unsafe" // for linkname
+
 func osInit() {
        ARM64.HasATOMICS = sysctlEnabled([]byte("hw.optional.armv8_1_atomics\x00"))
        ARM64.HasCRC32 = sysctlEnabled([]byte("hw.optional.armv8_crc32\x00"))
@@ -24,6 +26,15 @@ func osInit() {
 //go:noescape
 func getsysctlbyname(name []byte) (int32, int32)
 
+// sysctlEnabled should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/bytedance/gopkg
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname sysctlEnabled
 func sysctlEnabled(name []byte) bool {
        ret, value := getsysctlbyname(name)
        if ret < 0 {
index 0334e834a8892c9e52318b76af3a444acb8906d1..57d6f617945101a7a8059529869eb296974881a8 100644 (file)
@@ -13,4 +13,3 @@ import _ "unsafe"
 // in new code.
 
 //go:linkname defaultNS
-//go:linkname isDomainName
index 7f279d0de458182c34ebb3e7711e04afc59b5e1a..5f135cc211738dd8edac5e01bf7e4bade99bfd8e 100644 (file)
@@ -76,6 +76,16 @@ func equalASCIIName(x, y dnsmessage.Name) bool {
 // isDomainName checks if a string is a presentation-format domain name
 // (currently restricted to hostname-compatible "preferred name" LDH labels and
 // SRV-like "underscore labels"; see golang.org/issue/12421).
+//
+// isDomainName should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/sagernet/sing
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname isDomainName
 func isDomainName(s string) bool {
        // The root domain name is valid. See golang.org/issue/45715.
        if s == "." {
index 93408ecd55d969419b3f471bcdb5ea61ddae0c27..98726b1071847bbbd386f8bbdc0df99848a19cb4 100644 (file)
@@ -20,10 +20,8 @@ import _ "unsafe"
 //go:linkname cloneURLValues
 //go:linkname newBufioReader
 //go:linkname newBufioWriterSize
-//go:linkname parseBasicAuth
 //go:linkname putBufioReader
 //go:linkname putBufioWriter
-//go:linkname readRequest
 
 // The compiler doesn't allow linknames on methods, for good reasons.
 // We use this trick to push linknames of the methods.
index f208b95c462d854e0b3b9707d33012d4e581d693..ecb48a4364226ec4a2d6e7045199653e25db71a0 100644 (file)
@@ -25,6 +25,7 @@ import (
        "strconv"
        "strings"
        "sync"
+       _ "unsafe" // for linkname
 
        "golang.org/x/net/http/httpguts"
        "golang.org/x/net/idna"
@@ -986,6 +987,16 @@ func (r *Request) BasicAuth() (username, password string, ok bool) {
 
 // parseBasicAuth parses an HTTP Basic Authentication string.
 // "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" returns ("Aladdin", "open sesame", true).
+//
+// parseBasicAuth should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/sagernet/sing
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname parseBasicAuth
 func parseBasicAuth(auth string) (username, password string, ok bool) {
        const prefix = "Basic "
        // Case insensitive prefix match. See Issue 22736.
@@ -1061,6 +1072,15 @@ func ReadRequest(b *bufio.Reader) (*Request, error) {
        return req, err
 }
 
+// readRequest should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/sagernet/sing
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname readRequest
 func readRequest(b *bufio.Reader) (req *Request, err error) {
        tp := newTextprotoReader(b)
        defer putTextprotoReader(tp)
index 20ac07d31a4a54caefd75705480141c7e17f3599..74bb4f0e1c612246b076602ee71e9607dbc7094a 100644 (file)
@@ -9,6 +9,7 @@ import (
        "internal/itoa"
        "sync"
        "time"
+       _ "unsafe"
 )
 
 // BUG(mikio): On JS, methods and functions related to
@@ -17,6 +18,16 @@ import (
 // BUG(mikio): On AIX, DragonFly BSD, NetBSD, OpenBSD, Plan 9 and
 // Solaris, the MulticastAddrs method of Interface is not implemented.
 
+// errNoSuchInterface should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/sagernet/sing
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname errNoSuchInterface
+
 var (
        errInvalidInterface         = errors.New("invalid network interface")
        errInvalidInterfaceIndex    = errors.New("invalid network interface index")
diff --git a/src/net/url/badlinkname.go b/src/net/url/badlinkname.go
deleted file mode 100644 (file)
index 536abe2..0000000
+++ /dev/null
@@ -1,20 +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 url
-
-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.
-
-// The compiler doesn't allow linknames on methods, for good reasons.
-// We use this trick to push linknames of the methods.
-// Do not call them in this package.
-
-//go:linkname badlinkname_URL_setPath net/url.(*URL).setPath
-func badlinkname_URL_setPath(*URL, string) error
index 629b903f9ba618aa7274a45e665a86b5cded9e88..7beaef1ba66311419864d2f86b4eb39d9524ed83 100644 (file)
@@ -17,6 +17,7 @@ import (
        "slices"
        "strconv"
        "strings"
+       _ "unsafe" // for linkname
 )
 
 // Error reports an error and the operation and URL that caused it.
@@ -677,6 +678,16 @@ func parseHost(host string) (string, error) {
 // - setPath("/foo%2fbar") will set Path="/foo/bar" and RawPath="/foo%2fbar"
 // setPath will return an error only if the provided path contains an invalid
 // escaping.
+//
+// setPath should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/sagernet/sing
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname badSetPath net/url.(*URL).setPath
 func (u *URL) setPath(p string) error {
        path, err := unescape(p, encodePath)
        if err != nil {
@@ -692,6 +703,9 @@ func (u *URL) setPath(p string) error {
        return nil
 }
 
+// for linkname because we cannot linkname methods directly
+func badSetPath(*URL, string) error
+
 // EscapedPath returns the escaped form of u.Path.
 // In general there are multiple possible escaped forms of any path.
 // EscapedPath returns u.RawPath when it is a valid escaping of u.Path.
index 4886db944c7666728742fae25408c8a86952c4d0..f40cc9b8b628eb8dbb688ba573aa69b455388b4b 100644 (file)
@@ -50,6 +50,7 @@ var useAeshash bool
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
 //   - github.com/dgraph-io/ristretto
+//   - github.com/outcaste-io/ristretto
 //
 // Do not remove or change the type signature.
 // See go.dev/issue/67401.
@@ -65,6 +66,7 @@ func memhash64(p unsafe.Pointer, h uintptr) uintptr
 // Notable members of the hall of shame include:
 //   - github.com/aristanetworks/goarista
 //   - github.com/bytedance/sonic
+//   - github.com/bytedance/go-tagexpr/v2
 //
 // Do not remove or change the type signature.
 // See go.dev/issue/67401.
@@ -140,6 +142,7 @@ func interhash(p unsafe.Pointer, h uintptr) uintptr {
 // nilinterhash should be an internal detail,
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
+//   - github.com/anacrolix/stm
 //   - github.com/aristanetworks/goarista
 //
 // Do not remove or change the type signature.
index e3d17b5cf86b7bb38fba661b21f617761211834a..9711fb208bbb3de8234a646bc6c4644fd911c1ca 100644 (file)
@@ -18,6 +18,15 @@ import (
 // atomicwb performs a write barrier before an atomic pointer write.
 // The caller should guard the call with "if writeBarrier.enabled".
 //
+// atomicwb should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/bytedance/gopkg
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname atomicwb
 //go:nosplit
 func atomicwb(ptr *unsafe.Pointer, new unsafe.Pointer) {
        slot := (*uintptr)(unsafe.Pointer(ptr))
index f826701aa4e8be4f12d8a9e2e7a9b3e0e0d38e41..47ce44ada851fb6b13fd4319c19632591f6de889 100644 (file)
@@ -18,23 +18,17 @@ import _ "unsafe"
 // See go.dev/issue/67401.
 
 //go:linkname add
-//go:linkname atomicwb
 //go:linkname callers
-//go:linkname entersyscallblock
 //go:linkname fastexprand
 //go:linkname gopanic
-//go:linkname gopark
-//go:linkname goready
-//go:linkname goyield
-//go:linkname procPin
-//go:linkname procUnpin
 //go:linkname sched
 //go:linkname startTheWorld
 //go:linkname stopTheWorld
 //go:linkname stringHash
 //go:linkname typehash
-//go:linkname wakep
 
 // Notable members of the hall of shame include:
 //   - github.com/dgraph-io/ristretto
+//   - github.com/outcaste-io/ristretto
+//   - github.com/clubpay/ronykit
 //go:linkname cputicks
index e2f296e7c474a040b0372b8fd723aebbe1715c9a..75f25a94e41f7519d146b17fbaeb20c934caed39 100644 (file)
@@ -969,9 +969,11 @@ func (c *mcache) nextFree(spc spanClass) (v gclinkptr, s *mspan, shouldhelpgc bo
 // mallocgc should be an internal detail,
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
+//   - github.com/bytedance/gopkg
 //   - github.com/bytedance/sonic
-//   - github.com/ugorji/go/codec
+//   - github.com/cockroachdb/cockroach
 //   - github.com/cockroachdb/pebble
+//   - github.com/ugorji/go/codec
 //
 // Do not remove or change the type signature.
 // See go.dev/issue/67401.
index 9bfcf06069d051045cb5b7cfa3c9f1e76160c1d8..d78b2f76928a6866a0672ba5fd7a74b9c5d2b520 100644 (file)
@@ -1703,6 +1703,14 @@ var poolcleanup func()
 var boringCaches []unsafe.Pointer  // for crypto/internal/boring
 var uniqueMapCleanup chan struct{} // for unique
 
+// sync_runtime_registerPoolCleanup should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/bytedance/gopkg
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
 //go:linkname sync_runtime_registerPoolCleanup sync.runtime_registerPoolCleanup
 func sync_runtime_registerPoolCleanup(f func()) {
        poolcleanup = f
index 433b54675abf659cb1e0c39b7a84c9336d824a0a..2e15649092a5eb67384fe67f9ab9768643aedc69 100644 (file)
@@ -1033,6 +1033,8 @@ func sync_fatal(s string) {
 //   - github.com/bytedance/sonic
 //   - github.com/cockroachdb/pebble
 //   - github.com/dgraph-io/ristretto
+//   - github.com/outcaste-io/ristretto
+//   - gvisor.dev/gvisor
 //
 // Do not remove or change the type signature.
 // See go.dev/issue/67401.
index ba44f05c169024bdda022a00dd318f10cc7325e4..a94814993628b7692e180e62c18176bf163e092d 100644 (file)
@@ -382,6 +382,16 @@ func goschedIfBusy() {
 // Reason explains why the goroutine has been parked. It is displayed in stack
 // traces and heap dumps. Reasons should be unique and descriptive. Do not
 // re-use reasons, add new ones.
+//
+// gopark should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - gvisor.dev/gvisor
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname gopark
 func gopark(unlockf func(*g, unsafe.Pointer) bool, lock unsafe.Pointer, reason waitReason, traceReason traceBlockReason, traceskip int) {
        if reason != waitReasonSleep {
                checkTimeouts() // timeouts may expire while two goroutines keep the scheduler busy
@@ -408,6 +418,15 @@ func goparkunlock(lock *mutex, reason waitReason, traceReason traceBlockReason,
        gopark(parkunlock_c, unsafe.Pointer(lock), reason, traceReason, traceskip)
 }
 
+// goready should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - gvisor.dev/gvisor
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname goready
 func goready(gp *g, traceskip int) {
        systemstack(func() {
                ready(gp, traceskip, true)
@@ -3034,6 +3053,16 @@ func handoffp(pp *p) {
 // Tries to add one more P to execute G's.
 // Called when a G is made runnable (newproc, ready).
 // Must be called with a P.
+//
+// wakep should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - gvisor.dev/gvisor
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname wakep
 func wakep() {
        // Be conservative about spinning threads, only start one if none exist
        // already.
@@ -4163,6 +4192,16 @@ func preemptPark(gp *g) {
 // goyield is like Gosched, but it:
 // - emits a GoPreempt trace event instead of a GoSched trace event
 // - puts the current G on the runq of the current P instead of the globrunq
+//
+// goyield should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - gvisor.dev/gvisor
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname goyield
 func goyield() {
        checkTimeouts()
        mcall(goyield_m)
@@ -4397,6 +4436,14 @@ func reentersyscall(pc, sp, bp uintptr) {
 //
 // This is exported via linkname to assembly in the syscall package and x/sys.
 //
+// Other packages should not be accessing entersyscall directly,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - gvisor.dev/gvisor
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
 //go:nosplit
 //go:linkname entersyscall
 func entersyscall() {
@@ -4449,7 +4496,16 @@ func entersyscall_gcwait() {
 }
 
 // The same as entersyscall(), but with a hint that the syscall is blocking.
+
+// entersyscallblock should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - gvisor.dev/gvisor
 //
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname entersyscallblock
 //go:nosplit
 func entersyscallblock() {
        gp := getg()
@@ -4511,6 +4567,14 @@ func entersyscallblock_handoff() {
 //
 // This is exported via linkname to assembly in the syscall package.
 //
+// exitsyscall should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - gvisor.dev/gvisor
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
 //go:nosplit
 //go:nowritebarrierrec
 //go:linkname exitsyscall
@@ -4735,6 +4799,7 @@ func exitsyscall0(gp *g) {
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
 //   - github.com/containerd/containerd
+//   - gvisor.dev/gvisor
 //
 // Do not remove or change the type signature.
 // See go.dev/issue/67401.
@@ -4764,6 +4829,7 @@ func syscall_runtime_BeforeFork() {
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
 //   - github.com/containerd/containerd
+//   - gvisor.dev/gvisor
 //
 // Do not remove or change the type signature.
 // See go.dev/issue/67401.
@@ -4797,6 +4863,7 @@ var inForkedChild bool
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
 //   - github.com/containerd/containerd
+//   - gvisor.dev/gvisor
 //
 // Do not remove or change the type signature.
 // See go.dev/issue/67401.
@@ -6968,6 +7035,15 @@ func setMaxThreads(in int) (out int) {
        return
 }
 
+// procPin should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/bytedance/gopkg
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname procPin
 //go:nosplit
 func procPin() int {
        gp := getg()
@@ -6977,6 +7053,15 @@ func procPin() int {
        return int(mp.p.ptr().id)
 }
 
+// procUnpin should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/bytedance/gopkg
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname procUnpin
 //go:nosplit
 func procUnpin() {
        gp := getg()
@@ -7009,6 +7094,14 @@ func sync_atomic_runtime_procUnpin() {
 
 // Active spinning for sync.Mutex.
 //
+// sync_runtime_canSpin should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - gvisor.dev/gvisor
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
 //go:linkname sync_runtime_canSpin sync.runtime_canSpin
 //go:nosplit
 func sync_runtime_canSpin(i int) bool {
@@ -7026,6 +7119,14 @@ func sync_runtime_canSpin(i int) bool {
        return true
 }
 
+// sync_runtime_doSpin should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - gvisor.dev/gvisor
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
 //go:linkname sync_runtime_doSpin sync.runtime_doSpin
 //go:nosplit
 func sync_runtime_doSpin() {
index 62577dda91c6c6087a28000b4ade2ba8001d085f..827d182d12f5e1d208704bd91088c40a189728f0 100644 (file)
@@ -178,6 +178,15 @@ func randn(n uint32) uint32 {
 // the rule is that other packages using runtime-provided
 // randomness must always use rand.
 //
+// cheaprand should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/bytedance/gopkg
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname cheaprand
 //go:nosplit
 func cheaprand() uint32 {
        mp := getg().m
index f86a19f705a3ce30462eb57a7335c0fd51b9568f..0eb3c31a9fc2d1f44daa7e22663ea2aff2149d35 100644 (file)
@@ -57,6 +57,14 @@ func (t *semTable) rootFor(addr *uint32) *semaRoot {
        return &t[(uintptr(unsafe.Pointer(addr))>>3)%semTabSize].root
 }
 
+// sync_runtime_Semacquire should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - gvisor.dev/gvisor
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
 //go:linkname sync_runtime_Semacquire sync.runtime_Semacquire
 func sync_runtime_Semacquire(addr *uint32) {
        semacquire1(addr, false, semaBlockProfile, 0, waitReasonSemacquire)
@@ -67,6 +75,14 @@ func poll_runtime_Semacquire(addr *uint32) {
        semacquire1(addr, false, semaBlockProfile, 0, waitReasonSemacquire)
 }
 
+// sync_runtime_Semrelease should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - gvisor.dev/gvisor
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
 //go:linkname sync_runtime_Semrelease sync.runtime_Semrelease
 func sync_runtime_Semrelease(addr *uint32, handoff bool, skipframes int) {
        semrelease1(addr, handoff, skipframes)
index 8770b59b02aa4086d0ed1701b15bb5a85cc08471..69ffacc62ca233d8f6a23e8630cc677a8ceab944 100644 (file)
@@ -88,6 +88,7 @@ func badsystemstack() {
 // Notable members of the hall of shame include:
 //   - github.com/bytedance/sonic
 //   - github.com/dgraph-io/ristretto
+//   - github.com/outcaste-io/ristretto
 //
 // Do not remove or change the type signature.
 // See go.dev/issue/67401.
@@ -122,6 +123,7 @@ func reflect_memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) {
 //   - github.com/ebitengine/purego
 //   - github.com/tetratelabs/wazero
 //   - github.com/ugorji/go/codec
+//   - gvisor.dev/gvisor
 //
 // Do not remove or change the type signature.
 // See go.dev/issue/67401.
@@ -161,6 +163,7 @@ func memequal(a, b unsafe.Pointer, size uintptr) bool
 // noescape should be an internal detail,
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
+//   - github.com/bytedance/gopkg
 //   - github.com/ebitengine/purego
 //
 // Do not remove or change the type signature.
@@ -245,6 +248,15 @@ func breakpoint()
 //go:noescape
 func reflectcall(stackArgsType *_type, fn, stackArgs unsafe.Pointer, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs)
 
+// procyield should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/slackhq/nebula
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname procyield
 func procyield(cycles uint32)
 
 type neverCallThisFunction struct{}
diff --git a/src/sync/badlinkname.go b/src/sync/badlinkname.go
deleted file mode 100644 (file)
index 8dcff6d..0000000
+++ /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 sync
-
-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 poolCleanup
index 9214bf6e34722aba7b2a077263227249c4187c50..881cd1f4c25e5062476d650af87b51dda22eea9c 100644 (file)
@@ -242,6 +242,15 @@ func (p *Pool) pinSlow() (*poolLocal, int) {
        return &local[pid], pid
 }
 
+// poolCleanup should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/bytedance/gopkg
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname poolCleanup
 func poolCleanup() {
        // This function is called with the world stopped, at the beginning of a garbage collection.
        // It must not allocate and probably should not call any runtime functions.