Add linknames for most modules with ≥50 dependents.
Add linknames for a few other modules that we know
are important but are below 50.
Remove linknames from badlinkname.go that do not merit
inclusion (very small number of dependents).
We can add them back later if the need arises.
Fixes #67401. (For now.)
Change-Id: I1e49fec0292265256044d64b1841d366c4106002
Reviewed-on: https://go-review.googlesource.com/c/go/+/587756
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Bypass: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
"internal/bytealg"
"unicode"
"unicode/utf8"
+ _ "unsafe" // for linkname
)
// Equal reports whether a and b
return b
}
+// Despite being an exported symbol,
+// Repeat is linknamed by widely used packages.
+// Notable members of the hall of shame include:
+// - gitee.com/quant1x/num
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+// Note that this comment is not part of the doc comment.
+//
+//go:linkname Repeat
+
// Repeat returns a new byte slice consisting of count copies of b.
//
// It panics if count is negative or if the result of (len(b) * count)
+++ /dev/null
-// 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 tls
-
-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 cipherSuiteTLS13ByID
-//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)
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
// - github.com/quic-go/quic-go
+// - github.com/sagernet/quic-go
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
// - github.com/xtls/xray-core
+// - github.com/v2fly/v2ray-core
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
// - github.com/quic-go/quic-go
+// - github.com/sagernet/quic-go
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
// - github.com/quic-go/quic-go
+// - github.com/sagernet/quic-go
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
+++ /dev/null
-// 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 x509
-
-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 systemRoots
import (
"internal/godebug"
"sync"
+ _ "unsafe" // for linkname
)
+// systemRoots should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+// - github.com/breml/rootcerts
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname systemRoots
var (
once sync.Once
systemRootsMu sync.RWMutex
+++ /dev/null
-// 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 sql
-
-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 convertAssign
"time"
"unicode"
"unicode/utf8"
+ _ "unsafe" // for linkname
)
var errNilPtr = errors.New("destination pointer is nil") // embedded in descriptive error
// convertAssign is the same as convertAssignRows, but without the optional
// rows argument.
+//
+// convertAssign should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+// - ariga.io/entcache
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname convertAssign
func convertAssign(dest, src any) error {
return convertAssignRows(dest, src, nil)
}
"io/fs"
"os"
"runtime/debug"
+ _ "unsafe" // for linkname
)
// Type alias for build info. We cannot move the types here, since
// a much larger dependency.
type BuildInfo = debug.BuildInfo
-var (
- // errUnrecognizedFormat is returned when a given executable file doesn't
- // appear to be in a known format, or it breaks the rules of that format,
- // or when there are I/O errors reading the file.
- errUnrecognizedFormat = errors.New("unrecognized file format")
-
- // errNotGoExe is returned when a given executable file is valid but does
- // not contain Go build information.
- errNotGoExe = errors.New("not a Go executable")
-
- // The build info blob left by the linker is identified by
- // a 16-byte header, consisting of buildInfoMagic (14 bytes),
- // the binary's pointer size (1 byte),
- // and whether the binary is big endian (1 byte).
- buildInfoMagic = []byte("\xff Go buildinf:")
-)
+// errUnrecognizedFormat is returned when a given executable file doesn't
+// appear to be in a known format, or it breaks the rules of that format,
+// or when there are I/O errors reading the file.
+var errUnrecognizedFormat = errors.New("unrecognized file format")
+
+// errNotGoExe is returned when a given executable file is valid but does
+// not contain Go build information.
+//
+// errNotGoExe should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+// - github.com/quay/claircore
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname errNotGoExe
+var errNotGoExe = errors.New("not a Go executable")
+
+// The build info blob left by the linker is identified by
+// a 16-byte header, consisting of buildInfoMagic (14 bytes),
+// the binary's pointer size (1 byte),
+// and whether the binary is big endian (1 byte).
+var buildInfoMagic = []byte("\xff Go buildinf:")
// ReadFile returns build information embedded in a Go binary
// file at the given path. Most information is only available for binaries built
+++ /dev/null
-// 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 build
-
-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.
-
-// 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_Context_goodOSArchFile go/build.(*Context).goodOSArchFile
-func badlinkname_Context_goodOSArchFile(*Context, string, map[string]bool) bool
// runtime.cmpstring should be an internal detail,
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
+// - gitee.com/zhaochuninhefei/gmgo
// - github.com/bytedance/gopkg
// - github.com/songzhibin97/gkit
//
+++ /dev/null
-// 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 testlog
-
-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 SetPanicOnExit0
package testlog
-import "sync"
+import (
+ "sync"
+ _ "unsafe" // for linkname
+)
// PanicOnExit0 reports whether to panic on a call to os.Exit(0).
// This is in the testlog package because, like other definitions in
}
// SetPanicOnExit0 sets panicOnExit0 to v.
+//
+// SetPanicOnExit0 should be an internal detail,
+// but alternate implementations of go test in other
+// build systems may need to access it using linkname.
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname SetPanicOnExit0
func SetPanicOnExit0(v bool) {
panicOnExit0.mu.Lock()
defer panicOnExit0.mu.Unlock()
import "unsafe"
+// Despite being an exported symbol,
+// Float32bits is linknamed by widely used packages.
+// Notable members of the hall of shame include:
+// - gitee.com/quant1x/num
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+// Note that this comment is not part of the doc comment.
+//
+//go:linkname Float32bits
+
// Float32bits returns the IEEE 754 binary representation of f,
// with the sign bit of f and the result in the same bit position.
// Float32bits(Float32frombits(x)) == x.
+++ /dev/null
-// 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 multipart
-
-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 escapeQuotes
+++ /dev/null
-// 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 net
-
-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 defaultNS
"os"
"sync/atomic"
"time"
+ _ "unsafe"
)
-var (
- defaultNS = []string{"127.0.0.1:53", "[::1]:53"}
- getHostname = os.Hostname // variable for testing
-)
+// defaultNS is the default name servers to use in the absence of DNS configuration.
+//
+// defaultNS should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+// - github.com/pojntfx/hydrapp/hydrapp
+// - github.com/mtibben/androiddnsfix
+// - github.com/metacubex/mihomo
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname defaultNS
+var defaultNS = []string{"127.0.0.1:53", "[::1]:53"}
+
+var getHostname = os.Hostname // variable for testing
type dnsConfig struct {
servers []string // server addresses (in host:port form) to use
+++ /dev/null
-// 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 http
-
-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 newBufioReader
-//go:linkname newBufioWriterSize
-//go:linkname putBufioReader
-//go:linkname putBufioWriter
-
-// 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_serverHandler_ServeHTTP net/http.serverHandler.ServeHTTP
-func badlinkname_serverHandler_ServeHTTP(serverHandler, ResponseWriter, *Request)
-
-//go:linkname badlinkname_Transport_Roundtrip net/http.(*Transport).RoundTrip
-func badlinkname_Transport_Roundtrip(*Transport, *Request) (*Response, error)
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
// - github.com/sagernet/sing
+// - github.com/v2fly/v2ray-core/v4
+// - github.com/v2fly/v2ray-core/v5
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
package http
+import _ "unsafe" // for linkname
+
+// RoundTrip should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+// - github.com/erda-project/erda-infra
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname badRoundTrip net/http.(*Transport).RoundTrip
+func badRoundTrip(*Transport, *Request) (*Response, error)
+
// RoundTrip implements the [RoundTripper] interface.
//
// For higher-level HTTP client support (such as handling of cookies
"sync"
"sync/atomic"
"time"
+ _ "unsafe" // for linkname
"golang.org/x/net/http/httpguts"
)
return nil
}
+// newBufioReader should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+// - github.com/gobwas/ws
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname newBufioReader
func newBufioReader(r io.Reader) *bufio.Reader {
if v := bufioReaderPool.Get(); v != nil {
br := v.(*bufio.Reader)
return bufio.NewReader(r)
}
+// putBufioReader should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+// - github.com/gobwas/ws
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname putBufioReader
func putBufioReader(br *bufio.Reader) {
br.Reset(nil)
bufioReaderPool.Put(br)
}
+// newBufioWriterSize should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+// - github.com/gobwas/ws
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname newBufioWriterSize
func newBufioWriterSize(w io.Writer, size int) *bufio.Writer {
pool := bufioWriterPool(size)
if pool != nil {
return bufio.NewWriterSize(w, size)
}
+// putBufioWriter should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+// - github.com/gobwas/ws
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname putBufioWriter
func putBufioWriter(bw *bufio.Writer) {
bw.Reset(nil)
if pool := bufioWriterPool(bw.Available()); pool != nil {
srv *Server
}
+// ServeHTTP should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+// - github.com/erda-project/erda-infra
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname badServeHTTP net/http.serverHandler.ServeHTTP
func (sh serverHandler) ServeHTTP(rw ResponseWriter, req *Request) {
handler := sh.srv.Handler
if handler == nil {
handler.ServeHTTP(rw, req)
}
+func badServeHTTP(serverHandler, ResponseWriter, *Request)
+
// AllowQuerySemicolons returns a handler that serves requests by converting any
// unescaped semicolons in the URL query to ampersands, and invoking the handler h.
//
"internal/bytealg"
"runtime"
"sync"
+ _ "unsafe" // for linkname
)
// BUG(rsc,mikio): On DragonFly BSD and OpenBSD, listening on the
return filterAddrList(filter, ips, inetaddr, host)
}
+// loopbackIP should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+// - github.com/database64128/tfo-go/v2
+// - github.com/metacubex/tfo-go
+// - github.com/sagernet/tfo-go
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname loopbackIP
func loopbackIP(net string) IP {
if net != "" && net[len(net)-1] == '6' {
return IPv6loopback
"net/netip"
"runtime"
"syscall"
+ _ "unsafe" // for linkname
)
// probe probes IPv4, IPv6 and IPv4-mapped IPv6 communication
// Note that the latest DragonFly BSD and OpenBSD kernels allow
// neither "net.inet6.ip6.v6only=1" change nor IPPROTO_IPV6 level
// IPV6_V6ONLY socket option setting.
+//
+// favoriteAddrFamily should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+// - github.com/database64128/tfo-go/v2
+// - github.com/metacubex/tfo-go
+// - github.com/sagernet/tfo-go
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname favoriteAddrFamily
func favoriteAddrFamily(network string, laddr, raddr sockaddr, mode string) (family int, ipv6only bool) {
switch network[len(network)-1] {
case '4':
return sa, nil
}
+// ipToSockaddr should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+// - github.com/database64128/tfo-go/v2
+// - github.com/metacubex/tfo-go
+// - github.com/sagernet/tfo-go
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname ipToSockaddr
func ipToSockaddr(family int, ip IP, port int, zone string) (syscall.Sockaddr, error) {
switch family {
case syscall.AF_INET:
"sync"
"syscall"
"time"
+ _ "unsafe" // for linkname
)
// Addr represents a network end point address.
}
// listenerBacklog is a caching wrapper around maxListenerBacklog.
+//
+// listenerBacklog should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+// - github.com/database64128/tfo-go/v2
+// - github.com/metacubex/tfo-go
+// - github.com/sagernet/tfo-go
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname listenerBacklog
func listenerBacklog() int {
listenerBacklogCache.Do(func() { listenerBacklogCache.val = maxListenerBacklog() })
return listenerBacklogCache.val
import (
"internal/abi"
+ "unsafe"
_ "unsafe"
)
// Widely used packages access these symbols using linkname,
// most notably:
-// - github.com/goccy/go-json
-// - github.com/goccy/go-reflect
+// - github.com/goccy/go-json
+// - github.com/goccy/go-reflect
+// - github.com/sohaha/zlsgo
+// - github.com/undefinedlabs/go-mpatch
//
// Do not remove or change the type signature.
// See go.dev/issue/67401
//go:linkname badlinkname_rtype_ptrTo reflect.(*rtype).ptrTo
func badlinkname_rtype_ptrTo(*rtype) *abi.Type
+
+//go:linkname badlinkname_Value_pointer reflect.(*Value).pointer
+func badlinkname_Value_pointer(Value) unsafe.Pointer
// It returns a new ID that can be used as a typeOff or textOff, and will
// be resolved correctly. Implemented in the runtime package.
//
+// addReflectOff should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+// - github.com/goplus/reflectx
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname addReflectOff
//go:noescape
func addReflectOff(ptr unsafe.Pointer) int32
// add should be an internal detail (and is trivially copyable),
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
+// - github.com/pinpoint-apm/pinpoint-go-agent
// - github.com/vmware/govmomi
//
// Do not remove or change the type signature.
// - fortio.org/log
// - github.com/goccy/go-json
// - github.com/goccy/go-reflect
+// - github.com/sohaha/zlsgo
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// - github.com/puzpuzpuz/xsync/v2
// - github.com/puzpuzpuz/xsync/v3
// - github.com/segmentio/parquet-go
+// - github.com/parquet-go/parquet-go
+// - github.com/authzed/spicedb
+// - github.com/pingcap/badger
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
// - github.com/segmentio/parquet-go
+// - github.com/parquet-go/parquet-go
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
// - github.com/segmentio/parquet-go
+// - github.com/parquet-go/parquet-go
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// - github.com/bytedance/go-tagexpr/v2
// - github.com/cloudwego/frugal
// - github.com/cloudwego/dynamicgo
+// - github.com/v2fly/v2ray-core/v5
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
}
// Testing adapters for hash quality tests (see hash_test.go)
+//
+// stringHash should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+// - github.com/k14s/starlark-go
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname stringHash
func stringHash(s string, seed uintptr) uintptr {
return strhash(noescape(unsafe.Pointer(&s)), seed)
}
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.
-
// These should be an internal details
// but widely used packages access them using linkname.
// Do not remove or change the type signature.
// See go.dev/issue/67401.
-//go:linkname fastexprand
-//go:linkname gopanic
-//go:linkname sched
-//go:linkname startTheWorld
-//go:linkname stopTheWorld
-//go:linkname stringHash
-
// Notable members of the hall of shame include:
// - github.com/dgraph-io/ristretto
// - github.com/outcaste-io/ristretto
// - github.com/clubpay/ronykit
//go:linkname cputicks
+
+// Notable members of the hall of shame include:
+// - gvisor.dev/gvisor (from assembly)
+//go:linkname sched
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
// - github.com/grafana/pyroscope-go/godeltaprof
+// - github.com/pyroscope-io/godeltaprof
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// The returned data contains a whole number of records, and tags contains
// exactly one entry per record.
//
+// runtime_pprof_readProfile should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+// - github.com/pyroscope-io/pyroscope
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
//go:linkname runtime_pprof_readProfile runtime/pprof.readProfile
func runtime_pprof_readProfile() ([]uint64, []unsafe.Pointer, bool) {
lock(&cpuprof.lock)
// Notable members of the hall of shame include:
// - gitee.com/quant1x/gox
// - github.com/modern-go/reflect2
+// - github.com/v2pro/plz
//
// Do not remove or change the type signature.
//
// used in internal/godebug and syscall
//go:linkname write
-// used in internal/runtime/atomic
-//go:linkname goarm
-
// used by cgo
//go:linkname _cgo_panic_internal
//go:linkname cgoAlwaysFalse
// - gitee.com/quant1x/gox
// - github.com/goccy/json
// - github.com/modern-go/reflect2
+// - github.com/v2pro/plz
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// - github.com/modern-go/reflect2
// - github.com/segmentio/encoding
// - github.com/segmentio/kafka-go
+// - github.com/v2pro/plz
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// - github.com/RomiChan/protobuf
// - github.com/segmentio/encoding
// - github.com/ugorji/go/codec
+// - github.com/wI2L/jettison
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// - github.com/goccy/go-json
// - github.com/RomiChan/protobuf
// - github.com/segmentio/encoding
+// - github.com/v2pro/plz
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// Notable members of the hall of shame include:
// - gitee.com/quant1x/gox
// - github.com/modern-go/reflect2
+// - github.com/v2pro/plz
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
// - gitee.com/quant1x/gox
+// - github.com/v2pro/plz
//
// Do not remove or change the type signature.
//
// Notable members of the hall of shame include:
// - github.com/modern-go/reflect2
// - gitee.com/quant1x/gox
+// - github.com/v2pro/plz
+// - github.com/wI2L/jettison
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// - gitee.com/quant1x/gox
// - github.com/modern-go/reflect2
// - github.com/goccy/go-json
+// - github.com/v2pro/plz
+// - github.com/wI2L/jettison
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
// - github.com/goccy/go-json
+// - github.com/wI2L/jettison
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// - github.com/goccy/json
// - github.com/modern-go/reflect2
// - github.com/ugorji/go/codec
+// - github.com/v2pro/plz
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// - github.com/modern-go/reflect2
// - github.com/RomiChan/protobuf
// - github.com/segmentio/encoding
+// - github.com/v2pro/plz
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
var panicnil = &godebugInc{name: "panicnil"}
// The implementation of the predeclared function panic.
+// The compiler emits calls to this function.
+//
+// gopanic should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+// - go.undefinedlabs.com/scopeagent
+// - github.com/goplus/igop
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname gopanic
func gopanic(e any) {
if e == nil {
if debug.panicnil.Load() != 1 {
// - github.com/outcaste-io/ristretto
// - github.com/pingcap/br
// - gvisor.dev/gvisor
+// - github.com/sagernet/gvisor
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
// - gvisor.dev/gvisor
+// - github.com/sagernet/gvisor
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
// - gvisor.dev/gvisor
+// - github.com/sagernet/gvisor
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
// - gvisor.dev/gvisor
+// - github.com/sagernet/gvisor
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
// - github.com/livekit/protocol
+// - github.com/sagernet/gvisor
// - gvisor.dev/gvisor
//
// Do not remove or change the type signature.
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
// - github.com/livekit/protocol
+// - github.com/sagernet/gvisor
// - gvisor.dev/gvisor
//
// Do not remove or change the type signature.
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
// - github.com/bytedance/gopkg
+// - github.com/zhangyunhao116/fastrand
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// the rule is that other packages using runtime-provided
// randomness must always use rand.
//
+// cheaprand64 should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+// - github.com/zhangyunhao116/fastrand
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname cheaprand64
//go:nosplit
func cheaprand64() int64 {
return int64(cheaprand())<<31 ^ int64(cheaprand())
// - github.com/goccy/json
// - github.com/modern-go/reflect2
// - github.com/vmware/govmomi
+// - github.com/pinpoint-apm/pinpoint-go-agent
+// - github.com/timandy/routine
+// - github.com/v2pro/plz
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// Notable members of the hall of shame include:
// - gitee.com/quant1x/gox
// - github.com/modern-go/reflect2
+// - github.com/v2pro/plz
+// - github.com/timandy/routine
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// Set on startup in asm_{386,amd64}.s
processorVersionInfo uint32
isIntel bool
+)
- // set by cmd/link on arm systems
+// set by cmd/link on arm systems
+// accessed using linkname by internal/runtime/atomic.
+//
+// goarm should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+// - github.com/creativeprojects/go-selfupdate
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname goarm
+var (
goarm uint8
goarmsoftfp uint8
)
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
// - gvisor.dev/gvisor
+// - github.com/sagernet/gvisor
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
// - gvisor.dev/gvisor
+// - github.com/sagernet/gvisor
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// - github.com/tetratelabs/wazero
// - github.com/ugorji/go/codec
// - gvisor.dev/gvisor
+// - github.com/sagernet/gvisor
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
// - github.com/grafana/pyroscope-go/godeltaprof
+// - github.com/pyroscope-io/godeltaprof
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
// used by cmd/link
//go:linkname msync
//go:linkname fcntl
-
-// mmap should be an internal detail,
-// but widely used packages access it using linkname.
-// Notable members of the hall of shame include:
-// - modernc.org/memory
-//
-// Do not remove or change the type signature.
-// See go.dev/issue/67401.
-//
-//go:linkname mmap
//go:linkname openat
//go:linkname fstatat
//go:linkname getentropy
-
-// mmap should be an internal detail,
-// but widely used packages access it using linkname.
-// Notable members of the hall of shame include:
-// - modernc.org/memory
-//
-// Do not remove or change the type signature.
-// See go.dev/issue/67401.
-//
-//go:linkname mmap
--- /dev/null
+// 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.
+
+//go:build unix
+
+package syscall
+
+import _ "unsafe" // for linkname
+
+// mmap should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+// - modernc.org/memory
+// - github.com/ncruces/go-sqlite3
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname mmap
// (Callers may want to use 0 as "time not set".)
var startNano int64 = runtimeNano() - 1
+// x/tools uses a linkname of time.Now in its tests. No harm done.
+//go:linkname Now
+
// Now returns the current local time.
func Now() Time {
sec, nsec, mono := now()