aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2024-05-22 15:46:02 -0400
committerGopher Robot <gobot@golang.org>2024-05-23 01:17:26 +0000
commit4cac885741b845bd7f4aaad5bc9844b44eb23136 (patch)
treeed100e299cb58e1783aaf80f18b2375555d024d2 /src/runtime
parent05cbbf985fed823a174bf95cc78a7d44f948fdab (diff)
downloadgo-4cac885741b845bd7f4aaad5bc9844b44eb23136.tar.xz
all: document legacy //go:linkname for modules with ≥200 dependents
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>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/alg.go16
-rw-r--r--src/runtime/badlinkname.go1
-rw-r--r--src/runtime/iface.go1
-rw-r--r--src/runtime/malloc.go3
-rw-r--r--src/runtime/map.go28
-rw-r--r--src/runtime/map_fast32.go1
-rw-r--r--src/runtime/map_fast64.go2
-rw-r--r--src/runtime/map_faststr.go1
-rw-r--r--src/runtime/mbarrier.go2
-rw-r--r--src/runtime/mgc.go1
-rw-r--r--src/runtime/proc.go4
-rw-r--r--src/runtime/proflabel.go16
-rw-r--r--src/runtime/runtime1.go19
-rw-r--r--src/runtime/slice.go1
-rw-r--r--src/runtime/string.go10
-rw-r--r--src/runtime/stubs.go16
-rw-r--r--src/runtime/symtab.go80
-rw-r--r--src/runtime/sys_darwin.go9
-rw-r--r--src/runtime/time_nofake.go8
-rw-r--r--src/runtime/timestub.go10
-rw-r--r--src/runtime/type.go18
21 files changed, 244 insertions, 3 deletions
diff --git a/src/runtime/alg.go b/src/runtime/alg.go
index f40cc9b8b6..c11ef4c6ef 100644
--- a/src/runtime/alg.go
+++ b/src/runtime/alg.go
@@ -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.
diff --git a/src/runtime/badlinkname.go b/src/runtime/badlinkname.go
index 47ce44ada8..a0bdab2ca6 100644
--- a/src/runtime/badlinkname.go
+++ b/src/runtime/badlinkname.go
@@ -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
diff --git a/src/runtime/iface.go b/src/runtime/iface.go
index 94bc07e380..9dcc25cf23 100644
--- a/src/runtime/iface.go
+++ b/src/runtime/iface.go
@@ -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.
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go
index 75f25a94e4..70a198a81c 100644
--- a/src/runtime/malloc.go
+++ b/src/runtime/malloc.go
@@ -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
diff --git a/src/runtime/map.go b/src/runtime/map.go
index 4818cdcd92..5b13fda304 100644
--- a/src/runtime/map.go
+++ b/src/runtime/map.go
@@ -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
//
diff --git a/src/runtime/map_fast32.go b/src/runtime/map_fast32.go
index f3d830ea43..0eb8562f51 100644
--- a/src/runtime/map_fast32.go
+++ b/src/runtime/map_fast32.go
@@ -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.
diff --git a/src/runtime/map_fast64.go b/src/runtime/map_fast64.go
index 29cee968cd..aca60eb2a8 100644
--- a/src/runtime/map_fast64.go
+++ b/src/runtime/map_fast64.go
@@ -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.
diff --git a/src/runtime/map_faststr.go b/src/runtime/map_faststr.go
index 1494348be7..5461a9f81e 100644
--- a/src/runtime/map_faststr.go
+++ b/src/runtime/map_faststr.go
@@ -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.
diff --git a/src/runtime/mbarrier.go b/src/runtime/mbarrier.go
index c90c5f729e..c83e5c6fcd 100644
--- a/src/runtime/mbarrier.go
+++ b/src/runtime/mbarrier.go
@@ -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
//
diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go
index d78b2f7692..9874a9afde 100644
--- a/src/runtime/mgc.go
+++ b/src/runtime/mgc.go
@@ -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.
diff --git a/src/runtime/proc.go b/src/runtime/proc.go
index a948149936..68296bd1e4 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -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.
diff --git a/src/runtime/proflabel.go b/src/runtime/proflabel.go
index b2a161729e..7c29c0ef83 100644
--- a/src/runtime/proflabel.go
+++ b/src/runtime/proflabel.go
@@ -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
diff --git a/src/runtime/runtime1.go b/src/runtime/runtime1.go
index 378f0d8ea3..6086d3a0d8 100644
--- a/src/runtime/runtime1.go
+++ b/src/runtime/runtime1.go
@@ -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))
diff --git a/src/runtime/slice.go b/src/runtime/slice.go
index 7ffca036c0..b91caf0dfe 100644
--- a/src/runtime/slice.go
+++ b/src/runtime/slice.go
@@ -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.
diff --git a/src/runtime/string.go b/src/runtime/string.go
index d45888b7a8..5bdb25b9db 100644
--- a/src/runtime/string.go
+++ b/src/runtime/string.go
@@ -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.
diff --git a/src/runtime/stubs.go b/src/runtime/stubs.go
index 69ffacc62c..ff4fe5eafd 100644
--- a/src/runtime/stubs.go
+++ b/src/runtime/stubs.go
@@ -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.
diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go
index a7ce9c3a7e..40f0be6542 100644
--- a/src/runtime/symtab.go
+++ b/src/runtime/symtab.go
@@ -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.
diff --git a/src/runtime/sys_darwin.go b/src/runtime/sys_darwin.go
index d8fa39429f..1e4b2ac79e 100644
--- a/src/runtime/sys_darwin.go
+++ b/src/runtime/sys_darwin.go
@@ -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) {
diff --git a/src/runtime/time_nofake.go b/src/runtime/time_nofake.go
index e455f64b9f..130ff12816 100644
--- a/src/runtime/time_nofake.go
+++ b/src/runtime/time_nofake.go
@@ -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
diff --git a/src/runtime/timestub.go b/src/runtime/timestub.go
index 1d2926b43d..a9d71c1fd4 100644
--- a/src/runtime/timestub.go
+++ b/src/runtime/timestub.go
@@ -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()
diff --git a/src/runtime/type.go b/src/runtime/type.go
index a2975c4a99..201340752b 100644
--- a/src/runtime/type.go
+++ b/src/runtime/type.go
@@ -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.