]> Cypherpunks repositories - gostls13.git/commitdiff
internal/runtime/atomic: fix missing linknames
authorAustin Clements <austin@google.com>
Fri, 17 May 2024 19:32:13 +0000 (15:32 -0400)
committerGopher Robot <gobot@golang.org>
Fri, 17 May 2024 20:08:37 +0000 (20:08 +0000)
CL 544455, which added atomic And/Or APIs, raced with CL 585556, which
enabled stricter linkname checking. This caused linkname-related
failures on ARM and MIPS. Fix this by adding the necessary linknames.

We fix one other linkname that got overlooked in CL 585556.

Updates #61395.

Change-Id: I454f0767ce28188e550a61bc39b7e398239bc10e
Reviewed-on: https://go-review.googlesource.com/c/go/+/586516
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Austin Clements <austin@google.com>

src/internal/runtime/atomic/atomic_andor_generic.go
src/internal/runtime/atomic/atomic_mipsx.go
src/runtime/runtime2.go

index 6c12037d94b018b2768fb4f7c8a42a395d1100a0..433ee0bd6c21be2ee5482444fbd2456f6c68fc93 100644 (file)
@@ -4,8 +4,19 @@
 
 //go:build arm || wasm
 
+// Export some functions via linkname to assembly in sync/atomic.
+//
+//go:linkname And32
+//go:linkname Or32
+//go:linkname And64
+//go:linkname Or64
+//go:linkname Anduintptr
+//go:linkname Oruintptr
+
 package atomic
 
+import _ "unsafe" // For linkname
+
 //go:nosplit
 func And32(ptr *uint32, val uint32) uint32 {
        for {
index 26c80475996948af26c3018391941e71767a72ce..aba4143ea6613d1f19bddfb6fb9da8272e56fdfb 100644 (file)
@@ -11,6 +11,8 @@
 //go:linkname Cas64
 //go:linkname Load64
 //go:linkname Store64
+//go:linkname Or64
+//go:linkname And64
 
 package atomic
 
index 228340c394569b9d4d4c0278ca38f71180924493..ff11414e3ef635e3e6efbfb3a22f045cc603daf2 100644 (file)
@@ -1232,6 +1232,10 @@ var (
        timerpMask pMask
 )
 
+// goarmsoftfp is used by runtime/cgo assembly.
+//
+//go:linkname goarmsoftfp
+
 var (
        // Pool of GC parked background workers. Entries are type
        // *gcBgMarkWorkerNode.