]> Cypherpunks repositories - gostls13.git/commitdiff
all: document legacy //go:linkname for modules with ≥1,000 dependents
authorRuss Cox <rsc@golang.org>
Wed, 22 May 2024 04:14:42 +0000 (00:14 -0400)
committerGopher Robot <gobot@golang.org>
Thu, 23 May 2024 01:16:50 +0000 (01:16 +0000)
For #67401.

Change-Id: If23a2c07e3dd042a3c439da7088437a330b9caa4
Reviewed-on: https://go-review.googlesource.com/c/go/+/587222
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/runtime/badlinkname.go
src/runtime/chan.go
src/runtime/malloc.go
src/runtime/map.go
src/runtime/mbarrier.go
src/runtime/stubs.go
src/runtime/sys_darwin.go
src/syscall/syscall_darwin.go

index 47ebbad9a430b2607e18e1dff7b3f3252a51f688..f826701aa4e8be4f12d8a9e2e7a9b3e0e0d38e41 100644 (file)
@@ -20,7 +20,6 @@ import _ "unsafe"
 //go:linkname add
 //go:linkname atomicwb
 //go:linkname callers
-//go:linkname chanbuf
 //go:linkname entersyscallblock
 //go:linkname fastexprand
 //go:linkname gopanic
@@ -33,8 +32,6 @@ import _ "unsafe"
 //go:linkname startTheWorld
 //go:linkname stopTheWorld
 //go:linkname stringHash
-//go:linkname typedmemmove
-//go:linkname typedslicecopy
 //go:linkname typehash
 //go:linkname wakep
 
index 6ce824f62cef3b6b19ddbd1e59b67b2ac741b25f..f1cd74a3fd16e22eedf62a9e11730db3b6128fc8 100644 (file)
@@ -120,6 +120,16 @@ func makechan(t *chantype, size int) *hchan {
 }
 
 // chanbuf(c, i) is pointer to the i'th slot in the buffer.
+//
+// chanbuf should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/fjl/memsize
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname chanbuf
 func chanbuf(c *hchan, i uint) unsafe.Pointer {
        return add(c.buf, uintptr(i)*uintptr(c.elemsize))
 }
index 097946df66f71f0bb4669295baa529e31b6b49e1..e2f296e7c474a040b0372b8fd723aebbe1715c9a 100644 (file)
@@ -1407,6 +1407,7 @@ func reflectlite_unsafe_New(typ *_type) unsafe.Pointer {
 // newarray should be an internal detail,
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
+//   - github.com/segmentio/encoding
 //   - github.com/ugorji/go/codec
 //
 // Do not remove or change the type signature.
@@ -1430,6 +1431,7 @@ func newarray(typ *_type, n int) unsafe.Pointer {
 //   - github.com/bytedance/sonic
 //   - github.com/goccy/json
 //   - github.com/modern-go/reflect2
+//   - github.com/segmentio/encoding
 //   - github.com/segmentio/kafka-go
 //
 // Do not remove or change the type signature.
index 276b2044323b5a8985dbee13640a0f2dd131a535..4818cdcd924917981ae1238efed570087f0a5bcc 100644 (file)
@@ -602,6 +602,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/segmentio/encoding
 //   - github.com/ugorji/go/codec
 //
 // Do not remove or change the type signature.
@@ -860,6 +861,7 @@ search:
 // Notable members of the hall of shame include:
 //   - github.com/bytedance/sonic
 //   - github.com/goccy/go-json
+//   - github.com/segmentio/encoding
 //   - github.com/ugorji/go/codec
 //
 // Do not remove or change the type signature.
@@ -917,6 +919,7 @@ func mapiterinit(t *maptype, h *hmap, it *hiter) {
 // Notable members of the hall of shame include:
 //   - github.com/bytedance/sonic
 //   - github.com/ugorji/go/codec
+//   - github.com/segmentio/encoding
 //   - gonum.org/v1/gonum
 //
 // Do not remove or change the type signature.
@@ -1370,6 +1373,7 @@ func advanceEvacuationMark(h *hmap, t *maptype, newbit uintptr) {
 // Notable members of the hall of shame include:
 //   - github.com/modern-go/reflect2
 //   - github.com/goccy/go-json
+//   - github.com/segmentio/encoding
 //
 // Do not remove or change the type signature.
 // See go.dev/issue/67401.
index f09151d913446d65978c076c3fbd42229d6dc039..c90c5f729e3010514a301c0b20224c0d1e706546 100644 (file)
@@ -148,6 +148,15 @@ import (
 // TODO: Perfect for go:nosplitrec since we can't have a safe point
 // anywhere in the bulk barrier or memmove.
 //
+// typedmemmove should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/segmentio/encoding
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname typedmemmove
 //go:nosplit
 func typedmemmove(typ *abi.Type, dst, src unsafe.Pointer) {
        if dst == src {
@@ -258,6 +267,15 @@ func reflectcallmove(typ *_type, dst, src unsafe.Pointer, size uintptr, regs *ab
        }
 }
 
+// typedslicecopy should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/segmentio/encoding
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname typedslicecopy
 //go:nosplit
 func typedslicecopy(typ *_type, dstPtr unsafe.Pointer, dstLen int, srcPtr unsafe.Pointer, srcLen int) int {
        n := dstLen
@@ -317,6 +335,7 @@ func typedslicecopy(typ *_type, dstPtr unsafe.Pointer, dstLen int, srcPtr unsafe
 // but widely used packages access it using linkname.
 // Notable members of the hall of shame include:
 //   - github.com/modern-go/reflect2
+//   - github.com/segmentio/encoding
 //
 // Do not remove or change the type signature.
 // See go.dev/issue/67401.
index 7ec24d30e4c74b5eb6d44dc5eb994e9272b195e6..8770b59b02aa4086d0ed1701b15bb5a85cc08471 100644 (file)
@@ -119,8 +119,9 @@ 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/ugorji/go/codec
 //   - github.com/ebitengine/purego
+//   - github.com/tetratelabs/wazero
+//   - github.com/ugorji/go/codec
 //
 // Do not remove or change the type signature.
 // See go.dev/issue/67401.
index a96e2fe1e31ae6b51becd48d5beaa007710e91c9..d8fa39429f068a0606f6a7f55f7adba987fa00fd 100644 (file)
@@ -46,6 +46,13 @@ func syscallX()
 // (in addition to standard package syscall).
 // Do not remove or change the type signature.
 //
+// syscall.syscall6 is meant for package syscall (and x/sys),
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/tetratelabs/wazero
+//
+// See go.dev/issue/67401.
+//
 //go:linkname syscall_syscall6 syscall.syscall6
 //go:nosplit
 func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) {
index 2e13b57cd32e759a0df6476185af22da2c84e80b..5b38aeae31a6fc50d10e450cbf99428888ff9a39 100644 (file)
@@ -113,6 +113,15 @@ func libc_getfsstat_trampoline()
 
 //go:cgo_import_dynamic libc_getfsstat getfsstat "/usr/lib/libSystem.B.dylib"
 
+// utimensat should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+//   - github.com/tetratelabs/wazero
+//
+// See go.dev/issue/67401.
+//
+//go:linkname utimensat
+
 //sys  utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
 
 /*