]> Cypherpunks repositories - gostls13.git/commitdiff
all: document legacy //go:linkname for modules with ≥200 dependents
authorRuss Cox <rsc@golang.org>
Wed, 22 May 2024 19:46:02 +0000 (15:46 -0400)
committerGopher Robot <gobot@golang.org>
Thu, 23 May 2024 01:17:26 +0000 (01:17 +0000)
Ignored these linknames which have not worked for a while:

github.com/xtls/xray-core:
context.newCancelCtx removed in CL 463999 (Feb 2023)

github.com/u-root/u-root:
funcPC removed in CL 513837 (Jul 2023)

tinygo.org/x/drivers:
net.useNetdev never existed

For #67401.

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

30 files changed:
src/crypto/tls/badlinkname.go
src/crypto/tls/cipher_suites.go
src/crypto/tls/common.go
src/net/http/badlinkname.go
src/net/http/clone.go
src/net/http/transport.go
src/runtime/alg.go
src/runtime/badlinkname.go
src/runtime/iface.go
src/runtime/malloc.go
src/runtime/map.go
src/runtime/map_fast32.go
src/runtime/map_fast64.go
src/runtime/map_faststr.go
src/runtime/mbarrier.go
src/runtime/mgc.go
src/runtime/proc.go
src/runtime/proflabel.go
src/runtime/runtime1.go
src/runtime/slice.go
src/runtime/string.go
src/runtime/stubs.go
src/runtime/symtab.go
src/runtime/sys_darwin.go
src/runtime/time_nofake.go
src/runtime/timestub.go
src/runtime/type.go
src/time/badlinkname.go
src/time/format.go
src/time/time.go

index 4eef04d1ff64ac0d247b31d68e139566115f4704..841030abb4f9c0fe39028ba1b9dc51e42fb4705a 100644 (file)
@@ -12,7 +12,6 @@ import _ "unsafe"
 // This may change in the future. Please do not depend on them
 // in new code.
 
-//go:linkname aeadAESGCMTLS13
 //go:linkname cipherSuiteTLS13ByID
 //go:linkname errShutdown
 
index 5f37bf6eb401adf0d69857c2b2c231d5c7a22238..b2f330bc63ebe571b583b470fde80b6d61419279 100644 (file)
@@ -533,6 +533,15 @@ func aeadAESGCM(key, noncePrefix []byte) aead {
        return ret
 }
 
+// aeadAESGCMTLS13 should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/xtls/xray-core
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname aeadAESGCMTLS13
 func aeadAESGCMTLS13(key, nonceMask []byte) aead {
        if len(nonceMask) != aeadNonceLength {
                panic("tls: internal error: wrong nonce length")
index 601d5b8e4c4a45a0b05c3bbbd9e51747eb5136b3..498d345285cb7af89eb98b98a895c25e25473943 100644 (file)
@@ -25,6 +25,7 @@ import (
        "strings"
        "sync"
        "time"
+       _ "unsafe" // for linkname
 )
 
 const (
@@ -1129,6 +1130,15 @@ func (c *Config) mutualVersion(isClient bool, peerVersions []uint16) (uint16, bo
        return 0, false
 }
 
+// errNoCertificates should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/xtls/xray-core
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname errNoCertificates
 var errNoCertificates = errors.New("tls: no certificates configured")
 
 // getCertificate returns the best certificate for the given ClientHelloInfo,
index 98726b1071847bbbd386f8bbdc0df99848a19cb4..c714edf5f2dfddfc4cec3e79e30653d71141ee17 100644 (file)
@@ -12,12 +12,6 @@ import _ "unsafe"
 // This may change in the future. Please do not depend on them
 // in new code.
 
-//go:linkname cloneMultipartFileHeader
-//go:linkname cloneMultipartForm
-//go:linkname cloneOrMakeHeader
-//go:linkname cloneTLSConfig
-//go:linkname cloneURL
-//go:linkname cloneURLValues
 //go:linkname newBufioReader
 //go:linkname newBufioWriterSize
 //go:linkname putBufioReader
index 3a3375bff7164163d39753f4bbf1edb9e87f87cd..71f424227313d13b3cf93d3a49ce8fee15c84885 100644 (file)
@@ -8,8 +8,18 @@ import (
        "mime/multipart"
        "net/textproto"
        "net/url"
+       _ "unsafe" // for linkname
 )
 
+// cloneURLValues should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/searKing/golang
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname cloneURLValues
 func cloneURLValues(v url.Values) url.Values {
        if v == nil {
                return nil
@@ -19,6 +29,15 @@ func cloneURLValues(v url.Values) url.Values {
        return url.Values(Header(v).Clone())
 }
 
+// cloneURL should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/searKing/golang
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname cloneURL
 func cloneURL(u *url.URL) *url.URL {
        if u == nil {
                return nil
@@ -32,6 +51,15 @@ func cloneURL(u *url.URL) *url.URL {
        return u2
 }
 
+// cloneMultipartForm should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/searKing/golang
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname cloneMultipartForm
 func cloneMultipartForm(f *multipart.Form) *multipart.Form {
        if f == nil {
                return nil
@@ -53,6 +81,15 @@ func cloneMultipartForm(f *multipart.Form) *multipart.Form {
        return f2
 }
 
+// cloneMultipartFileHeader should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/searKing/golang
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname cloneMultipartFileHeader
 func cloneMultipartFileHeader(fh *multipart.FileHeader) *multipart.FileHeader {
        if fh == nil {
                return nil
@@ -65,6 +102,16 @@ func cloneMultipartFileHeader(fh *multipart.FileHeader) *multipart.FileHeader {
 
 // cloneOrMakeHeader invokes Header.Clone but if the
 // result is nil, it'll instead make and return a non-nil Header.
+//
+// cloneOrMakeHeader should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/searKing/golang
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname cloneOrMakeHeader
 func cloneOrMakeHeader(hdr Header) Header {
        clone := hdr.Clone()
        if clone == nil {
index 0d4332c3445ba8d2d93350d33f15406f3ff4846c..a1ff7ebe32bfd187967e3e63a0b55c439b9b9fe5 100644 (file)
@@ -30,6 +30,7 @@ import (
        "sync"
        "sync/atomic"
        "time"
+       _ "unsafe"
 
        "golang.org/x/net/http/httpguts"
        "golang.org/x/net/http/httpproxy"
@@ -2983,6 +2984,16 @@ func (fakeLocker) Unlock() {}
 // cloneTLSConfig returns a shallow clone of cfg, or a new zero tls.Config if
 // cfg is nil. This is safe to call even if cfg is in active use by a TLS
 // client or server.
+//
+// cloneTLSConfig should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/searKing/golang
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname cloneTLSConfig
 func cloneTLSConfig(cfg *tls.Config) *tls.Config {
        if cfg == nil {
                return &tls.Config{}
index f40cc9b8b628eb8dbb688ba573aa69b455388b4b..c11ef4c6efd3b1bbae6e01368e2716eb2f8453fb 100644 (file)
@@ -49,8 +49,12 @@ var useAeshash bool
 // memhash should be an internal detail,
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
+//   - github.com/aacfactory/fns
 //   - github.com/dgraph-io/ristretto
+//   - github.com/nbd-wtf/go-nostr
 //   - github.com/outcaste-io/ristretto
+//   - github.com/puzpuzpuz/xsync/v2
+//   - github.com/puzpuzpuz/xsync/v3
 //
 // Do not remove or change the type signature.
 // See go.dev/issue/67401.
@@ -67,6 +71,7 @@ func memhash64(p unsafe.Pointer, h uintptr) uintptr
 //   - github.com/aristanetworks/goarista
 //   - github.com/bytedance/sonic
 //   - github.com/bytedance/go-tagexpr/v2
+//   - github.com/cloudwego/frugal
 //
 // Do not remove or change the type signature.
 // See go.dev/issue/67401.
@@ -176,6 +181,17 @@ func nilinterhash(p unsafe.Pointer, h uintptr) uintptr {
 // maps generated by reflect.MapOf (reflect_typehash, below).
 // Note: this function must match the compiler generated
 // functions exactly. See issue 37716.
+//
+// typehash should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/puzpuzpuz/xsync/v2
+//   - github.com/puzpuzpuz/xsync/v3
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname typehash
 func typehash(t *_type, p unsafe.Pointer, h uintptr) uintptr {
        if t.TFlag&abi.TFlagRegularMemory != 0 {
                // Handle ptr sizes specially, see issue 37086.
index 47ce44ada851fb6b13fd4319c19632591f6de889..a0bdab2ca6274e8c0282b0cc51ec1072f873f93d 100644 (file)
@@ -25,7 +25,6 @@ import _ "unsafe"
 //go:linkname startTheWorld
 //go:linkname stopTheWorld
 //go:linkname stringHash
-//go:linkname typehash
 
 // Notable members of the hall of shame include:
 //   - github.com/dgraph-io/ristretto
index 94bc07e380dd54b4e54d296db9a2c0c74c85922c..9dcc25cf232a0297643a3b42a5655d6c7194a733 100644 (file)
@@ -663,6 +663,7 @@ var emptyInterfaceSwitchCache = abi.InterfaceSwitchCache{Mask: 0}
 // reflect_ifaceE2I is for package reflect,
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
+//   - gitee.com/quant1x/gox
 //   - github.com/modern-go/reflect2
 //
 // Do not remove or change the type signature.
index 75f25a94e41f7519d146b17fbaeb20c934caed39..70a198a81c905f8627db5d2a7fbf57a3cbe06f91 100644 (file)
@@ -971,6 +971,7 @@ func (c *mcache) nextFree(spc spanClass) (v gclinkptr, s *mspan, shouldhelpgc bo
 // Notable members of the hall of shame include:
 //   - github.com/bytedance/gopkg
 //   - github.com/bytedance/sonic
+//   - github.com/cloudwego/frugal
 //   - github.com/cockroachdb/cockroach
 //   - github.com/cockroachdb/pebble
 //   - github.com/ugorji/go/codec
@@ -1388,6 +1389,7 @@ func newobject(typ *_type) unsafe.Pointer {
 // reflect_unsafe_New is meant for package reflect,
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
+//   - gitee.com/quant1x/gox
 //   - github.com/goccy/json
 //   - github.com/modern-go/reflect2
 //
@@ -1430,6 +1432,7 @@ func newarray(typ *_type, n int) unsafe.Pointer {
 // reflect_unsafe_NewArray is meant for package reflect,
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
+//   - gitee.com/quant1x/gox
 //   - github.com/bytedance/sonic
 //   - github.com/goccy/json
 //   - github.com/modern-go/reflect2
index 4818cdcd924917981ae1238efed570087f0a5bcc..5b13fda3047abb503395cf284c6c874ba6e799b2 100644 (file)
@@ -308,6 +308,7 @@ func makemap_small() *hmap {
 // makemap should be an internal detail,
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
+//   - github.com/cloudwego/frugal
 //   - github.com/ugorji/go/codec
 //
 // Do not remove or change the type signature.
@@ -602,6 +603,7 @@ func mapaccess2_fat(t *maptype, h *hmap, key, zero unsafe.Pointer) (unsafe.Point
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
 //   - github.com/bytedance/sonic
+//   - github.com/cloudwego/frugal
 //   - github.com/segmentio/encoding
 //   - github.com/ugorji/go/codec
 //
@@ -860,6 +862,7 @@ search:
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
 //   - github.com/bytedance/sonic
+//   - github.com/cloudwego/frugal
 //   - github.com/goccy/go-json
 //   - github.com/segmentio/encoding
 //   - github.com/ugorji/go/codec
@@ -918,8 +921,9 @@ func mapiterinit(t *maptype, h *hmap, it *hiter) {
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
 //   - github.com/bytedance/sonic
-//   - github.com/ugorji/go/codec
+//   - github.com/cloudwego/frugal
 //   - github.com/segmentio/encoding
+//   - github.com/ugorji/go/codec
 //   - gonum.org/v1/gonum
 //
 // Do not remove or change the type signature.
@@ -1053,6 +1057,17 @@ next:
 }
 
 // mapclear deletes all keys from a map.
+// It is called by the compiler.
+//
+// mapclear should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/cloudwego/frugal
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname mapclear
 func mapclear(t *maptype, h *hmap) {
        if raceenabled && h != nil {
                callerpc := getcallerpc()
@@ -1371,6 +1386,7 @@ func advanceEvacuationMark(h *hmap, t *maptype, newbit uintptr) {
 // reflect_makemap is for package reflect,
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
+//   - gitee.com/quant1x/gox
 //   - github.com/modern-go/reflect2
 //   - github.com/goccy/go-json
 //   - github.com/segmentio/encoding
@@ -1420,6 +1436,7 @@ func reflect_makemap(t *maptype, cap int) *hmap {
 // reflect_mapaccess is for package reflect,
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
+//   - gitee.com/quant1x/gox
 //   - github.com/modern-go/reflect2
 //
 // Do not remove or change the type signature.
@@ -1445,6 +1462,13 @@ func reflect_mapaccess_faststr(t *maptype, h *hmap, key string) unsafe.Pointer {
        return elem
 }
 
+// reflect_mapassign is for package reflect,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - gitee.com/quant1x/gox
+//
+// Do not remove or change the type signature.
+//
 //go:linkname reflect_mapassign reflect.mapassign0
 func reflect_mapassign(t *maptype, h *hmap, key unsafe.Pointer, elem unsafe.Pointer) {
        p := mapassign(t, h, key)
@@ -1471,6 +1495,7 @@ func reflect_mapdelete_faststr(t *maptype, h *hmap, key string) {
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
 //   - github.com/modern-go/reflect2
+//   - gitee.com/quant1x/gox
 //
 // Do not remove or change the type signature.
 // See go.dev/issue/67401.
@@ -1483,6 +1508,7 @@ func reflect_mapiterinit(t *maptype, h *hmap, it *hiter) {
 // reflect_mapiternext is for package reflect,
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
+//   - gitee.com/quant1x/gox
 //   - github.com/modern-go/reflect2
 //   - github.com/goccy/go-json
 //
index f3d830ea4387613dd012b37e92236d6c3cf07168..0eb8562f5102dcd773bd6e61b904bd75863684a6 100644 (file)
@@ -103,6 +103,7 @@ func mapaccess2_fast32(t *maptype, h *hmap, key uint32) (unsafe.Pointer, bool) {
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
 //   - github.com/bytedance/sonic
+//   - github.com/cloudwego/frugal
 //   - github.com/ugorji/go/codec
 //
 // Do not remove or change the type signature.
index 29cee968cd5539763f9970a51bbccaef80bc8900..aca60eb2a80b02dad6b51d040edcf5185327b4f6 100644 (file)
@@ -103,6 +103,7 @@ func mapaccess2_fast64(t *maptype, h *hmap, key uint64) (unsafe.Pointer, bool) {
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
 //   - github.com/bytedance/sonic
+//   - github.com/cloudwego/frugal
 //   - github.com/ugorji/go/codec
 //
 // Do not remove or change the type signature.
@@ -203,6 +204,7 @@ done:
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
 //   - github.com/bytedance/sonic
+//   - github.com/cloudwego/frugal
 //   - github.com/ugorji/go/codec
 //
 // Do not remove or change the type signature.
index 1494348be72797d36979ba57d69f8cc95f3c8a9d..5461a9f81e8143c3a1819676e8abe3b1da437841 100644 (file)
@@ -213,6 +213,7 @@ dohash:
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
 //   - github.com/bytedance/sonic
+//   - github.com/cloudwego/frugal
 //   - github.com/ugorji/go/codec
 //
 // Do not remove or change the type signature.
index c90c5f729e3010514a301c0b20224c0d1e706546..c83e5c6fcdc1d0191bc5fba571378863bdfcb165 100644 (file)
@@ -211,6 +211,7 @@ func wbMove(typ *_type, dst, src unsafe.Pointer) {
 // reflect_typedmemmove is meant for package reflect,
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
+//   - gitee.com/quant1x/gox
 //   - github.com/goccy/json
 //   - github.com/modern-go/reflect2
 //   - github.com/ugorji/go/codec
@@ -334,6 +335,7 @@ func typedslicecopy(typ *_type, dstPtr unsafe.Pointer, dstLen int, srcPtr unsafe
 // reflect_typedslicecopy is meant for package reflect,
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
+//   - gitee.com/quant1x/gox
 //   - github.com/modern-go/reflect2
 //   - github.com/segmentio/encoding
 //
index d78b2f76928a6866a0672ba5fd7a74b9c5d2b520..9874a9afde9e61e8ba164cf4941fa6f56948a39a 100644 (file)
@@ -220,6 +220,7 @@ var gcphase uint32
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
 //   - github.com/bytedance/sonic
+//   - github.com/cloudwego/frugal
 //
 // Do not remove or change the type signature.
 // See go.dev/issue/67401.
index a94814993628b7692e180e62c18176bf163e092d..68296bd1e4a156319c16b671a427a736c0f4a98c 100644 (file)
@@ -7039,6 +7039,7 @@ func setMaxThreads(in int) (out int) {
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
 //   - github.com/bytedance/gopkg
+//   - github.com/choleraehyq/pid
 //
 // Do not remove or change the type signature.
 // See go.dev/issue/67401.
@@ -7057,6 +7058,7 @@ func procPin() int {
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
 //   - github.com/bytedance/gopkg
+//   - github.com/choleraehyq/pid
 //
 // Do not remove or change the type signature.
 // See go.dev/issue/67401.
@@ -7097,6 +7099,7 @@ func sync_atomic_runtime_procUnpin() {
 // sync_runtime_canSpin should be an internal detail,
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
+//   - github.com/livekit/protocol
 //   - gvisor.dev/gvisor
 //
 // Do not remove or change the type signature.
@@ -7122,6 +7125,7 @@ func sync_runtime_canSpin(i int) bool {
 // sync_runtime_doSpin should be an internal detail,
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
+//   - github.com/livekit/protocol
 //   - gvisor.dev/gvisor
 //
 // Do not remove or change the type signature.
index b2a161729eff2079d88a976b83411764ebbdf755..7c29c0ef836ac55609f1313670b47982b6b89d99 100644 (file)
@@ -8,6 +8,14 @@ import "unsafe"
 
 var labelSync uintptr
 
+// runtime_setProfLabel should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/DataDog/datadog-agent
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
 //go:linkname runtime_setProfLabel runtime/pprof.runtime_setProfLabel
 func runtime_setProfLabel(labels unsafe.Pointer) {
        // Introduce race edge for read-back via profile.
@@ -34,6 +42,14 @@ func runtime_setProfLabel(labels unsafe.Pointer) {
        getg().labels = labels
 }
 
+// runtime_getProfLabel should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/DataDog/datadog-agent
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
 //go:linkname runtime_getProfLabel runtime/pprof.runtime_getProfLabel
 func runtime_getProfLabel() unsafe.Pointer {
        return getg().labels
index 378f0d8ea3bcc17319307163b2b081c2b8f6331b..6086d3a0d890bc1ae72739f6c4e2629bd74b132c 100644 (file)
@@ -617,6 +617,7 @@ func releasem(mp *m) {
 // reflect_typelinks is meant for package reflect,
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
+//   - gitee.com/quant1x/gox
 //   - github.com/goccy/json
 //   - github.com/modern-go/reflect2
 //   - github.com/vmware/govmomi
@@ -638,6 +639,14 @@ func reflect_typelinks() ([]unsafe.Pointer, [][]int32) {
 
 // reflect_resolveNameOff resolves a name offset from a base pointer.
 //
+// reflect_resolveNameOff is for package reflect,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/agiledragon/gomonkey/v2
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
 //go:linkname reflect_resolveNameOff reflect.resolveNameOff
 func reflect_resolveNameOff(ptrInModule unsafe.Pointer, off int32) unsafe.Pointer {
        return unsafe.Pointer(resolveNameOff(ptrInModule, nameOff(off)).Bytes)
@@ -648,6 +657,7 @@ func reflect_resolveNameOff(ptrInModule unsafe.Pointer, off int32) unsafe.Pointe
 // reflect_resolveTypeOff is meant for package reflect,
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
+//   - gitee.com/quant1x/gox
 //   - github.com/modern-go/reflect2
 //
 // Do not remove or change the type signature.
@@ -660,6 +670,15 @@ func reflect_resolveTypeOff(rtype unsafe.Pointer, off int32) unsafe.Pointer {
 
 // reflect_resolveTextOff resolves a function pointer offset from a base type.
 //
+// reflect_resolveTextOff is for package reflect,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/cloudwego/frugal
+//   - github.com/agiledragon/gomonkey/v2
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
 //go:linkname reflect_resolveTextOff reflect.resolveTextOff
 func reflect_resolveTextOff(rtype unsafe.Pointer, off int32) unsafe.Pointer {
        return toRType((*_type)(rtype)).textOff(textOff(off))
index 7ffca036c029aec4ec194d63b4a5e9ef4eb4102a..b91caf0dfe885b979067e3a12a298bd924f22ddd 100644 (file)
@@ -166,6 +166,7 @@ func makeslice64(et *_type, len64, cap64 int64) unsafe.Pointer {
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
 //   - github.com/bytedance/sonic
+//   - github.com/chenzhuoyu/iasm
 //   - github.com/ugorji/go/codec
 //
 // Do not remove or change the type signature.
index d45888b7a8efa27a83874c49d299b7b2a499aa66..5bdb25b9db7cf45643f6dae62d1e968cf2385179 100644 (file)
@@ -78,6 +78,16 @@ func concatstring5(buf *tmpBuf, a0, a1, a2, a3, a4 string) string {
 // n is the length of the slice.
 // Buf is a fixed-size buffer for the result,
 // it is not nil if the result does not escape.
+//
+// slicebytetostring should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/cloudwego/frugal
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname slicebytetostring
 func slicebytetostring(buf *tmpBuf, ptr *byte, n int) string {
        if n == 0 {
                // Turns out to be a relatively common case.
index 69ffacc62ca233d8f6a23e8630cc677a8ceab944..ff4fe5eafd3aa27edc603b3e3c2c6f7fdc3c6825 100644 (file)
@@ -87,6 +87,8 @@ func badsystemstack() {
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
 //   - github.com/bytedance/sonic
+//   - github.com/chenzhuoyu/iasm
+//   - github.com/cloudwego/frugal
 //   - github.com/dgraph-io/ristretto
 //   - github.com/outcaste-io/ristretto
 //
@@ -120,6 +122,7 @@ func reflect_memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) {
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
 //   - github.com/bytedance/sonic
+//   - github.com/cloudwego/frugal
 //   - github.com/ebitengine/purego
 //   - github.com/tetratelabs/wazero
 //   - github.com/ugorji/go/codec
@@ -165,6 +168,7 @@ func memequal(a, b unsafe.Pointer, size uintptr) bool
 // Notable members of the hall of shame include:
 //   - github.com/bytedance/gopkg
 //   - github.com/ebitengine/purego
+//   - github.com/puzpuzpuz/xsync/v3
 //
 // Do not remove or change the type signature.
 // See go.dev/issue/67401.
@@ -345,7 +349,18 @@ func getclosureptr() uintptr
 func asmcgocall(fn, arg unsafe.Pointer) int32
 
 func morestack()
+
+// morestack_noctxt should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/cloudwego/frugal
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname morestack_noctxt
 func morestack_noctxt()
+
 func rt0_go()
 
 // return0 is a stub used to return 0 from deferproc.
@@ -435,6 +450,7 @@ func gcWriteBarrier1()
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
 //   - github.com/bytedance/sonic
+//   - github.com/cloudwego/frugal
 //
 // Do not remove or change the type signature.
 // See go.dev/issue/67401.
index a7ce9c3a7e94c8c53fec33b3120aa8cf761fc77f..40f0be65428e43fb6417d604447bbec4bfc09952 100644 (file)
@@ -437,8 +437,19 @@ type modulehash struct {
 // To make sure the map isn't collected, we keep a second reference here.
 var pinnedTypemaps []map[typeOff]*_type
 
-var firstmoduledata moduledata  // linker symbol
+var firstmoduledata moduledata // linker symbol
+
+// lastmoduledatap should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/cloudwego/frugal
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname lastmoduledatap
 var lastmoduledatap *moduledata // linker symbol
+
 var modulesSlice *[]*moduledata // see activeModules
 
 // activeModules returns a slice of active modules.
@@ -547,6 +558,15 @@ func moduledataverify() {
 
 const debugPcln = false
 
+// moduledataverify1 should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/cloudwego/frugal
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname moduledataverify1
 func moduledataverify1(datap *moduledata) {
        // Check that the pclntab's format is valid.
        hdr := datap.pcHeader
@@ -674,6 +694,16 @@ func (md *moduledata) funcName(nameOff int32) string {
 // If pc represents multiple functions because of inlining, it returns
 // the *Func describing the innermost function, but with an entry of
 // the outermost function.
+//
+// For completely unclear reasons, even though they can import runtime,
+// some widely used packages access this using linkname.
+// Notable members of the hall of shame include:
+//   - gitee.com/quant1x/gox
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname FuncForPC
 func FuncForPC(pc uintptr) *Func {
        f := findfunc(pc)
        if !f.valid() {
@@ -793,7 +823,16 @@ func (f funcInfo) entry() uintptr {
 // It is nosplit because it's part of the isgoexception
 // implementation.
 //
+// findfunc should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/cloudwego/frugal
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
 //go:nosplit
+//go:linkname findfunc
 func findfunc(pc uintptr) funcInfo {
        datap := findmoduledatap(pc)
        if datap == nil {
@@ -1101,6 +1140,16 @@ func pcdatavalue1(f funcInfo, table uint32, targetpc uintptr, strict bool) int32
 }
 
 // Like pcdatavalue, but also return the start PC of this PCData value.
+//
+// pcdatavalue2 should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/cloudwego/frugal
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname pcdatavalue2
 func pcdatavalue2(f funcInfo, table uint32, targetpc uintptr) (int32, uintptr) {
        if table >= f.npcdata {
                return -1, 0
@@ -1110,6 +1159,16 @@ func pcdatavalue2(f funcInfo, table uint32, targetpc uintptr) (int32, uintptr) {
 
 // funcdata returns a pointer to the ith funcdata for f.
 // funcdata should be kept in sync with cmd/link:writeFuncs.
+//
+// funcdata should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/cloudwego/frugal
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname funcdata
 func funcdata(f funcInfo, i uint8) unsafe.Pointer {
        if i < 0 || i >= f.nfuncdata {
                return nil
@@ -1129,6 +1188,16 @@ func funcdata(f funcInfo, i uint8) unsafe.Pointer {
 }
 
 // step advances to the next pc, value pair in the encoded table.
+//
+// step should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/cloudwego/frugal
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname step
 func step(p []byte, pc *uintptr, val *int32, first bool) (newp []byte, ok bool) {
        // For both uvdelta and pcdelta, the common case (~70%)
        // is that they are a single byte. If so, avoid calling readvarint.
@@ -1174,6 +1243,15 @@ type stackmap struct {
        bytedata [1]byte // bitmaps, each starting on a byte boundary
 }
 
+// stackmapdata should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/cloudwego/frugal
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname stackmapdata
 //go:nowritebarrier
 func stackmapdata(stkmap *stackmap, n int32) bitvector {
        // Check this invariant only when stackDebug is on at all.
index d8fa39429f068a0606f6a7f55f7adba987fa00fd..1e4b2ac79efdec65504f747f9f53b24d85406d93 100644 (file)
@@ -380,6 +380,15 @@ func nanotime1() int64 {
 }
 func nanotime_trampoline()
 
+// walltime should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - gitee.com/quant1x/gox
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname walltime
 //go:nosplit
 //go:cgo_unsafe_args
 func walltime() (int64, int32) {
index e455f64b9f8eba837f719034a1f9e625e4d67a17..130ff12816628054cee84b9ae44017f4b1fefe4b 100644 (file)
@@ -36,6 +36,14 @@ func nanotime() int64 {
 // overrideWrite allows write to be redirected externally, by
 // linkname'ing this and set it to a write function.
 //
+// overrideWrite should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - golang.zx2c4.com/wireguard/windows
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
 //go:linkname overrideWrite
 var overrideWrite func(fd uintptr, p unsafe.Pointer, n int32) int32
 
index 1d2926b43dc3d4c2447ba3af6961249c7f29b318..a9d71c1fd4042ff1327c1519569c5e6300a1a0f3 100644 (file)
@@ -11,6 +11,16 @@ package runtime
 
 import _ "unsafe" // for go:linkname
 
+// time_now should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - gitee.com/quant1x/gox
+//   - github.com/sethvargo/go-limiter
+//   - github.com/ulule/limiter/v3
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
 //go:linkname time_now time.now
 func time_now() (sec int64, nsec int32, mono int64) {
        sec, nsec = walltime()
index a2975c4a99b4e818cdc3a7df42c24e933dec8d3d..201340752b810c62012731b9cba6eec1ebae592b 100644 (file)
@@ -106,6 +106,15 @@ func reflectOffsUnlock() {
        unlock(&reflectOffs.lock)
 }
 
+// resolveNameOff should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/cloudwego/frugal
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname resolveNameOff
 func resolveNameOff(ptrInModule unsafe.Pointer, off nameOff) name {
        if off == 0 {
                return name{}
@@ -140,6 +149,15 @@ func (t rtype) nameOff(off nameOff) name {
        return resolveNameOff(unsafe.Pointer(t.Type), off)
 }
 
+// resolveTypeOff should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/cloudwego/frugal
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname resolveTypeOff
 func resolveTypeOff(ptrInModule unsafe.Pointer, off typeOff) *_type {
        if off == 0 || off == -1 {
                // -1 is the sentinel value for unreachable code.
index 96d2e3186257f8ad7ed31df0128527164a2af75b..097a823ccfc2801748f3c3c46d8907ed51468b99 100644 (file)
@@ -13,5 +13,3 @@ import _ "unsafe"
 // in new code.
 
 //go:linkname absClock
-//go:linkname absDate
-//go:linkname nextStdChunk
index c823bce4d806479f94f50d7dabb5c343d5bf9141..07f1f804c1d26ae944fe778d906536ba81dfbe5d 100644 (file)
@@ -7,6 +7,7 @@ package time
 import (
        "errors"
        "internal/stringslite"
+       _ "unsafe" // for linkname
 )
 
 // These are predefined layouts for use in [Time.Format] and [time.Parse].
@@ -184,6 +185,16 @@ func startsWithLowerCase(str string) bool {
 
 // nextStdChunk finds the first occurrence of a std string in
 // layout and returns the text before, the std string, and the text after.
+//
+// nextStdChunk should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/searKing/golang/go
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname nextStdChunk
 func nextStdChunk(layout string) (prefix string, std int, suffix string) {
        for i := 0; i < len(layout); i++ {
                switch c := int(layout[i]); c {
index 0bbdeaecf5d565626d26c4749ac0741e36d6017c..63ee6f6f94c0904611f18b109ef3119fb9814815 100644 (file)
@@ -988,6 +988,16 @@ func (t Time) date(full bool) (year int, month Month, day int, yday int) {
 }
 
 // absDate is like date but operates on an absolute time.
+//
+// absDate should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - gitee.com/quant1x/gox
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname absDate
 func absDate(abs uint64, full bool) (year int, month Month, day int, yday int) {
        // Split into time and day.
        d := abs / secondsPerDay