From 97259c5d6b5928b4519a227b2e5a540259c49bbd Mon Sep 17 00:00:00 2001 From: Cherry Mui Date: Fri, 27 Feb 2026 23:38:49 -0500 Subject: sync: replace linkname with import The sync package uses linkname to access internal/runtime/atomic package's LoadAcquintptr and StoreReluintptr functions. It was not able to import the package when the package was runtime/internal/atomic. Now that it moves to internal/runtime, the sync package can just import it and call the functions normally. Change-Id: Ic7399e33d0e965fdcdf505be67a7f90e0260ddee Reviewed-on: https://go-review.googlesource.com/c/go/+/750160 LUCI-TryBot-Result: Go LUCI Reviewed-by: Michael Pratt --- src/cmd/compile/internal/ssagen/intrinsics.go | 4 ---- src/cmd/compile/internal/ssagen/intrinsics_test.go | 22 ---------------------- 2 files changed, 26 deletions(-) (limited to 'src/cmd') diff --git a/src/cmd/compile/internal/ssagen/intrinsics.go b/src/cmd/compile/internal/ssagen/intrinsics.go index 0657d5fc75..3ba4c4486c 100644 --- a/src/cmd/compile/internal/ssagen/intrinsics.go +++ b/src/cmd/compile/internal/ssagen/intrinsics.go @@ -707,9 +707,7 @@ func initIntrinsics(cfg *intrinsicBuildConfig) { alias("internal/runtime/atomic", "LoadAcq", "internal/runtime/atomic", "Load", lwatomics...) alias("internal/runtime/atomic", "LoadAcq64", "internal/runtime/atomic", "Load64", lwatomics...) alias("internal/runtime/atomic", "LoadAcquintptr", "internal/runtime/atomic", "LoadAcq", p4...) - alias("sync", "runtime_LoadAcquintptr", "internal/runtime/atomic", "LoadAcq", p4...) // linknamed alias("internal/runtime/atomic", "LoadAcquintptr", "internal/runtime/atomic", "LoadAcq64", p8...) - alias("sync", "runtime_LoadAcquintptr", "internal/runtime/atomic", "LoadAcq64", p8...) // linknamed // Aliases for atomic store operations alias("internal/runtime/atomic", "Storeint32", "internal/runtime/atomic", "Store", all...) @@ -719,9 +717,7 @@ func initIntrinsics(cfg *intrinsicBuildConfig) { alias("internal/runtime/atomic", "StoreRel", "internal/runtime/atomic", "Store", lwatomics...) alias("internal/runtime/atomic", "StoreRel64", "internal/runtime/atomic", "Store64", lwatomics...) alias("internal/runtime/atomic", "StoreReluintptr", "internal/runtime/atomic", "StoreRel", p4...) - alias("sync", "runtime_StoreReluintptr", "internal/runtime/atomic", "StoreRel", p4...) // linknamed alias("internal/runtime/atomic", "StoreReluintptr", "internal/runtime/atomic", "StoreRel64", p8...) - alias("sync", "runtime_StoreReluintptr", "internal/runtime/atomic", "StoreRel64", p8...) // linknamed // Aliases for atomic swap operations alias("internal/runtime/atomic", "Xchgint32", "internal/runtime/atomic", "Xchg", all...) diff --git a/src/cmd/compile/internal/ssagen/intrinsics_test.go b/src/cmd/compile/internal/ssagen/intrinsics_test.go index 37058556dc..ca20115c53 100644 --- a/src/cmd/compile/internal/ssagen/intrinsics_test.go +++ b/src/cmd/compile/internal/ssagen/intrinsics_test.go @@ -153,8 +153,6 @@ var wantIntrinsics = map[testIntrinsicKey]struct{}{ {"amd64", "math/bits", "TrailingZeros8"}: struct{}{}, {"amd64", "runtime", "KeepAlive"}: struct{}{}, {"amd64", "runtime", "slicebytetostringtmp"}: struct{}{}, - {"amd64", "sync", "runtime_LoadAcquintptr"}: struct{}{}, - {"amd64", "sync", "runtime_StoreReluintptr"}: struct{}{}, {"amd64", "sync/atomic", "AddInt32"}: struct{}{}, {"amd64", "sync/atomic", "AddInt64"}: struct{}{}, {"amd64", "sync/atomic", "AddUint32"}: struct{}{}, @@ -328,8 +326,6 @@ var wantIntrinsics = map[testIntrinsicKey]struct{}{ {"arm64", "runtime", "memequal"}: struct{}{}, {"arm64", "runtime", "publicationBarrier"}: struct{}{}, {"arm64", "runtime", "slicebytetostringtmp"}: struct{}{}, - {"arm64", "sync", "runtime_LoadAcquintptr"}: struct{}{}, - {"arm64", "sync", "runtime_StoreReluintptr"}: struct{}{}, {"arm64", "sync/atomic", "AddInt32"}: struct{}{}, {"arm64", "sync/atomic", "AddInt64"}: struct{}{}, {"arm64", "sync/atomic", "AddUint32"}: struct{}{}, @@ -470,8 +466,6 @@ var wantIntrinsics = map[testIntrinsicKey]struct{}{ {"loong64", "runtime", "KeepAlive"}: struct{}{}, {"loong64", "runtime", "publicationBarrier"}: struct{}{}, {"loong64", "runtime", "slicebytetostringtmp"}: struct{}{}, - {"loong64", "sync", "runtime_LoadAcquintptr"}: struct{}{}, - {"loong64", "sync", "runtime_StoreReluintptr"}: struct{}{}, {"loong64", "sync/atomic", "AddInt32"}: struct{}{}, {"loong64", "sync/atomic", "AddInt64"}: struct{}{}, {"loong64", "sync/atomic", "AddUint32"}: struct{}{}, @@ -568,8 +562,6 @@ var wantIntrinsics = map[testIntrinsicKey]struct{}{ {"mips", "runtime", "KeepAlive"}: struct{}{}, {"mips", "runtime", "publicationBarrier"}: struct{}{}, {"mips", "runtime", "slicebytetostringtmp"}: struct{}{}, - {"mips", "sync", "runtime_LoadAcquintptr"}: struct{}{}, - {"mips", "sync", "runtime_StoreReluintptr"}: struct{}{}, {"mips", "sync/atomic", "AddInt32"}: struct{}{}, {"mips", "sync/atomic", "AddUint32"}: struct{}{}, {"mips", "sync/atomic", "AddUintptr"}: struct{}{}, @@ -646,8 +638,6 @@ var wantIntrinsics = map[testIntrinsicKey]struct{}{ {"mips64", "runtime", "KeepAlive"}: struct{}{}, {"mips64", "runtime", "publicationBarrier"}: struct{}{}, {"mips64", "runtime", "slicebytetostringtmp"}: struct{}{}, - {"mips64", "sync", "runtime_LoadAcquintptr"}: struct{}{}, - {"mips64", "sync", "runtime_StoreReluintptr"}: struct{}{}, {"mips64", "sync/atomic", "AddInt32"}: struct{}{}, {"mips64", "sync/atomic", "AddInt64"}: struct{}{}, {"mips64", "sync/atomic", "AddUint32"}: struct{}{}, @@ -734,8 +724,6 @@ var wantIntrinsics = map[testIntrinsicKey]struct{}{ {"mips64le", "runtime", "KeepAlive"}: struct{}{}, {"mips64le", "runtime", "publicationBarrier"}: struct{}{}, {"mips64le", "runtime", "slicebytetostringtmp"}: struct{}{}, - {"mips64le", "sync", "runtime_LoadAcquintptr"}: struct{}{}, - {"mips64le", "sync", "runtime_StoreReluintptr"}: struct{}{}, {"mips64le", "sync/atomic", "AddInt32"}: struct{}{}, {"mips64le", "sync/atomic", "AddInt64"}: struct{}{}, {"mips64le", "sync/atomic", "AddUint32"}: struct{}{}, @@ -816,8 +804,6 @@ var wantIntrinsics = map[testIntrinsicKey]struct{}{ {"mipsle", "runtime", "KeepAlive"}: struct{}{}, {"mipsle", "runtime", "publicationBarrier"}: struct{}{}, {"mipsle", "runtime", "slicebytetostringtmp"}: struct{}{}, - {"mipsle", "sync", "runtime_LoadAcquintptr"}: struct{}{}, - {"mipsle", "sync", "runtime_StoreReluintptr"}: struct{}{}, {"mipsle", "sync/atomic", "AddInt32"}: struct{}{}, {"mipsle", "sync/atomic", "AddUint32"}: struct{}{}, {"mipsle", "sync/atomic", "AddUintptr"}: struct{}{}, @@ -930,8 +916,6 @@ var wantIntrinsics = map[testIntrinsicKey]struct{}{ {"ppc64", "runtime", "KeepAlive"}: struct{}{}, {"ppc64", "runtime", "publicationBarrier"}: struct{}{}, {"ppc64", "runtime", "slicebytetostringtmp"}: struct{}{}, - {"ppc64", "sync", "runtime_LoadAcquintptr"}: struct{}{}, - {"ppc64", "sync", "runtime_StoreReluintptr"}: struct{}{}, {"ppc64", "sync/atomic", "AddInt32"}: struct{}{}, {"ppc64", "sync/atomic", "AddInt64"}: struct{}{}, {"ppc64", "sync/atomic", "AddUint32"}: struct{}{}, @@ -1055,8 +1039,6 @@ var wantIntrinsics = map[testIntrinsicKey]struct{}{ {"ppc64le", "runtime", "KeepAlive"}: struct{}{}, {"ppc64le", "runtime", "publicationBarrier"}: struct{}{}, {"ppc64le", "runtime", "slicebytetostringtmp"}: struct{}{}, - {"ppc64le", "sync", "runtime_LoadAcquintptr"}: struct{}{}, - {"ppc64le", "sync", "runtime_StoreReluintptr"}: struct{}{}, {"ppc64le", "sync/atomic", "AddInt32"}: struct{}{}, {"ppc64le", "sync/atomic", "AddInt64"}: struct{}{}, {"ppc64le", "sync/atomic", "AddUint32"}: struct{}{}, @@ -1176,8 +1158,6 @@ var wantIntrinsics = map[testIntrinsicKey]struct{}{ {"riscv64", "runtime", "KeepAlive"}: struct{}{}, {"riscv64", "runtime", "publicationBarrier"}: struct{}{}, {"riscv64", "runtime", "slicebytetostringtmp"}: struct{}{}, - {"riscv64", "sync", "runtime_LoadAcquintptr"}: struct{}{}, - {"riscv64", "sync", "runtime_StoreReluintptr"}: struct{}{}, {"riscv64", "sync/atomic", "AddInt32"}: struct{}{}, {"riscv64", "sync/atomic", "AddInt64"}: struct{}{}, {"riscv64", "sync/atomic", "AddUint32"}: struct{}{}, @@ -1295,8 +1275,6 @@ var wantIntrinsics = map[testIntrinsicKey]struct{}{ {"s390x", "math/bits", "TrailingZeros8"}: struct{}{}, {"s390x", "runtime", "KeepAlive"}: struct{}{}, {"s390x", "runtime", "slicebytetostringtmp"}: struct{}{}, - {"s390x", "sync", "runtime_LoadAcquintptr"}: struct{}{}, - {"s390x", "sync", "runtime_StoreReluintptr"}: struct{}{}, {"s390x", "sync/atomic", "AddInt32"}: struct{}{}, {"s390x", "sync/atomic", "AddInt64"}: struct{}{}, {"s390x", "sync/atomic", "AddUint32"}: struct{}{}, -- cgit v1.3-6-g1900