From 194e5a43dcf774b0de684cb7d252a3fa36ef3359 Mon Sep 17 00:00:00 2001 From: yuhan6665 <1588741+yuhan6665@users.noreply.github.com> Date: Sun, 18 Aug 2024 20:17:15 -0400 Subject: [PATCH] all: add push linknames to allow legacy pull linknames CL 585358 adds restrictions to disallow pull-only linknames (currently off by default). Currently, there are quite some pull- only linknames in user code in the wild. In order not to break those, we add push linknames to allow them to be pulled. This CL includes linknames found in a large code corpus (thanks Matthew Dempsky and Michael Pratt for the analysis!), that are not currently linknamed. Updates #67401. Change-Id: I32f5fc0c7a6abbd7a11359a025cfa2bf458fe767 Reviewed-on: https://go-review.googlesource.com/c/go/+/586137 Reviewed-by: Russ Cox LUCI-TryBot-Result: Go LUCI --- badlinkname.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 badlinkname.go diff --git a/badlinkname.go b/badlinkname.go new file mode 100644 index 0000000..8555896 --- /dev/null +++ b/badlinkname.go @@ -0,0 +1,27 @@ +// 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 reality + +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 aeadAESGCMTLS13 +//go:linkname cipherSuiteTLS13ByID +//go:linkname cipherSuitesTLS13 +//go:linkname defaultCipherSuitesTLS13 +//go:linkname defaultCipherSuitesTLS13NoAES +//go:linkname errShutdown + +// The compiler doesn't allow linknames on methods, for good reasons. +// We use this trick to push linknames of the methods. +// Do not call them in this package. + +//go:linkname badlinkname_halfConn_incSeq crypto/tls.(*halfConn).incSeq +func badlinkname_halfConn_incSeq(*halfConn)