all: use linknamestd for new linknames

For linknames within the standard library, we can use the new
linknamestd pragma. Apply it to linknames added in 1.27 cycle, as
they cannot be accessed externally.

Change-Id: I97f78ddcb6ca27718337dcfc8d3c581a5acd2b73
Reviewed-on: https://go-review.googlesource.com/c/go/+/780680
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
This commit is contained in:
Cherry Mui 2026-05-20 14:38:47 -04:00
parent 6a002d1474
commit 4dde0f6c36
6 changed files with 32 additions and 30 deletions

View file

@ -16,5 +16,5 @@ const (
// isProcessorFeaturePresent calls windows IsProcessorFeaturePresent API.
//
//go:linkname isProcessorFeaturePresent
//go:linknamestd isProcessorFeaturePresent
func isProcessorFeaturePresent(processorFeature uint32) bool // Implemented in runtime package.

View file

@ -8,27 +8,27 @@ import _ "unsafe" // for linkname
// Export some functions via linkname to assembly in sync/atomic.
//
//go:linkname Load
//go:linkname Loadp
//go:linkname Load64
//go:linkname Loaduintptr
//go:linkname Xadd
//go:linkname Xadd64
//go:linkname Xadduintptr
//go:linkname Xchg
//go:linkname Xchg64
//go:linkname Xchguintptr
//go:linkname Cas
//go:linkname Cas64
//go:linkname Casint32
//go:linkname Casint64
//go:linkname Casuintptr
//go:linkname Store
//go:linkname Store64
//go:linkname Storeuintptr
//go:linkname And32
//go:linkname And64
//go:linkname Anduintptr
//go:linkname Or32
//go:linkname Or64
//go:linkname Oruintptr
//go:linknamestd Load
//go:linknamestd Loadp
//go:linknamestd Load64
//go:linknamestd Loaduintptr
//go:linknamestd Xadd
//go:linknamestd Xadd64
//go:linknamestd Xadduintptr
//go:linknamestd Xchg
//go:linknamestd Xchg64
//go:linknamestd Xchguintptr
//go:linknamestd Cas
//go:linknamestd Cas64
//go:linknamestd Casint32
//go:linknamestd Casint64
//go:linknamestd Casuintptr
//go:linknamestd Store
//go:linknamestd Store64
//go:linknamestd Storeuintptr
//go:linknamestd And32
//go:linknamestd And64
//go:linknamestd Anduintptr
//go:linknamestd Or32
//go:linknamestd Or64
//go:linknamestd Oruintptr

View file

@ -19,7 +19,7 @@ import (
//go:linkname fatal
func fatal(s string)
//go:linkname bootstrapRand runtime.bootstrapRand
//go:linknamestd bootstrapRand runtime.bootstrapRand
func bootstrapRand() uint64
//go:linkname rand

View file

@ -1719,6 +1719,8 @@ func haveIdenticalUnderlyingType(T, V *abi.Type, cmpTags bool) bool {
// there can be more than one with a given string.
// Only types we might want to look up are included:
// pointers, channels, maps, slices, and arrays.
//
//go:linknamestd compiledTypelinks
func compiledTypelinks() ([]*abi.Type, [][]*abi.Type)
// rtypeOff should be an internal detail,
@ -2775,7 +2777,7 @@ func adjustAIXGCData(addr *byte) *byte {
// adjustAIXGCDataForRuntime adjusts the GCData field pointer
// as the runtime requires for AIX. See runtime.getGCMaskOnDemand.
//
//go:linkname adjustAIXGCDataForRuntime
//go:linknamestd adjustAIXGCDataForRuntime
//go:noescape
func adjustAIXGCDataForRuntime(*byte) *byte

View file

@ -263,7 +263,7 @@ func windows_QueryPerformanceFrequency() int64 {
return frequency
}
//go:linkname cpu_isProcessorFeaturePresent internal/cpu.isProcessorFeaturePresent
//go:linknamestd cpu_isProcessorFeaturePresent internal/cpu.isProcessorFeaturePresent
func cpu_isProcessorFeaturePresent(processorFeature uint32) bool {
ret := stdcall(_IsProcessorFeaturePresent, uintptr(processorFeature))
return ret != 0

View file

@ -655,7 +655,7 @@ func reflect_typelinks() ([]unsafe.Pointer, [][]int32) {
// slice for the main module, and a slice of slices, normally nil,
// for other modules.
//
//go:linkname reflect_compiledTypelinks reflect.compiledTypelinks
//go:linknamestd reflect_compiledTypelinks reflect.compiledTypelinks
func reflect_compiledTypelinks() ([]*abi.Type, [][]*abi.Type) {
modules := activeModules()
firstTypes := moduleTypelinks(modules[0])
@ -753,7 +753,7 @@ func reflect_addReflectOff(ptr unsafe.Pointer) int32 {
// the new address to use. This is only called on AIX.
// See getGCMaskOnDemand.
//
//go:linkname reflect_adjustAIXGCDataForRuntime reflect.adjustAIXGCDataForRuntime
//go:linknamestd reflect_adjustAIXGCDataForRuntime reflect.adjustAIXGCDataForRuntime
func reflect_adjustAIXGCDataForRuntime(addr *byte) *byte {
return (*byte)(add(unsafe.Pointer(addr), aixStaticDataBase-firstmoduledata.data))
}