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>
This commit is contained in:
yuhan6665
2024-09-09 11:32:16 -04:00
parent f5616ed2fe
commit 186f953bfd
3 changed files with 19 additions and 1 deletions
-1
View 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
+9
View File
@@ -520,6 +520,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")
+10
View File
@@ -24,6 +24,7 @@ import (
"strings"
"sync"
"time"
_ "unsafe" // for linkname
)
const (
@@ -1149,6 +1150,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,