From 05cbbf985fed823a174bf95cc78a7d44f948fdab Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 22 May 2024 15:03:13 -0400 Subject: all: document legacy //go:linkname for modules with ≥500 dependents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For #67401. Change-Id: I7dd28c3b01a1a647f84929d15412aa43ab0089ee Reviewed-on: https://go-review.googlesource.com/c/go/+/587575 Reviewed-by: Cherry Mui Auto-Submit: Russ Cox LUCI-TryBot-Result: Go LUCI --- src/sync/badlinkname.go | 15 --------------- src/sync/pool.go | 9 +++++++++ 2 files changed, 9 insertions(+), 15 deletions(-) delete mode 100644 src/sync/badlinkname.go (limited to 'src/sync') diff --git a/src/sync/badlinkname.go b/src/sync/badlinkname.go deleted file mode 100644 index 8dcff6d7fc..0000000000 --- a/src/sync/badlinkname.go +++ /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 diff --git a/src/sync/pool.go b/src/sync/pool.go index 9214bf6e34..881cd1f4c2 100644 --- a/src/sync/pool.go +++ b/src/sync/pool.go @@ -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. -- cgit v1.3-5-g9baa