From ef225d1c57a97af984af114ee52005314530bbe2 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 21 May 2024 22:38:02 -0400 Subject: all: document legacy //go:linkname for modules with ≥100,000 dependents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For #67401. Change-Id: I51f5b561ee11eb242e3b1585d591281d0df4fc24 Reviewed-on: https://go-review.googlesource.com/c/go/+/587215 Auto-Submit: Russ Cox Reviewed-by: Cherry Mui LUCI-TryBot-Result: Go LUCI --- src/runtime/malloc.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/runtime/malloc.go') diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go index 1df9006011..4034060424 100644 --- a/src/runtime/malloc.go +++ b/src/runtime/malloc.go @@ -1371,6 +1371,14 @@ func newobject(typ *_type) unsafe.Pointer { return mallocgc(typ.Size_, typ, true) } +// reflect_unsafe_New is meant for package reflect, +// but widely used packages access it using linkname. +// Notable members of the hall of shame include: +// - github.com/modern-go/reflect2 +// +// Do not remove or change the type signature. +// See go.dev/issue/67401. +// //go:linkname reflect_unsafe_New reflect.unsafe_New func reflect_unsafe_New(typ *_type) unsafe.Pointer { return mallocgc(typ.Size_, typ, true) @@ -1393,6 +1401,14 @@ func newarray(typ *_type, n int) unsafe.Pointer { return mallocgc(mem, typ, true) } +// reflect_unsafe_NewArray is meant for package reflect, +// but widely used packages access it using linkname. +// Notable members of the hall of shame include: +// - github.com/modern-go/reflect2 +// +// Do not remove or change the type signature. +// See go.dev/issue/67401. +// //go:linkname reflect_unsafe_NewArray reflect.unsafe_NewArray func reflect_unsafe_NewArray(typ *_type, n int) unsafe.Pointer { return newarray(typ, n) -- cgit v1.3-6-g1900