]> Cypherpunks repositories - gostls13.git/commitdiff
maps: correct use of linkname
authorRuss Cox <rsc@golang.org>
Tue, 23 Jan 2024 19:42:42 +0000 (14:42 -0500)
committerRuss Cox <rsc@golang.org>
Fri, 26 Jan 2024 04:31:27 +0000 (04:31 +0000)
Linkname should have uses at both ends,
and then no fake assembly file is needed.

Change-Id: Ia2066be7b1e08d71a6db622d2a167f1b09cb7d9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/558297
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/maps/maps.go
src/maps/maps.s [deleted file]

index befde18c9c973433cd3fecfc0a3982371c77c06c..82b348c2f34c2b10033466fe73a16a697b91fd5c 100644 (file)
@@ -5,6 +5,10 @@
 // Package maps defines various functions useful with maps of any type.
 package maps
 
+import (
+       _ "unsafe"
+)
+
 // Equal reports whether two maps contain the same key/value pairs.
 // Values are compared using ==.
 func Equal[M1, M2 ~map[K]V, K, V comparable](m1 M1, m2 M2) bool {
@@ -34,6 +38,7 @@ func EqualFunc[M1 ~map[K]V1, M2 ~map[K]V2, K comparable, V1, V2 any](m1 M1, m2 M
 }
 
 // clone is implemented in the runtime package.
+//go:linkname clone maps.clone
 func clone(m any) any
 
 // Clone returns a copy of m.  This is a shallow clone:
diff --git a/src/maps/maps.s b/src/maps/maps.s
deleted file mode 100644 (file)
index 4e55778..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright 2023 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.
-
-// need this empty asm file to enable linkname.
\ No newline at end of file