aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/gc
diff options
context:
space:
mode:
authorThan McIntosh <thanm@google.com>2021-06-08 20:09:49 -0400
committerThan McIntosh <thanm@google.com>2021-06-09 02:18:34 +0000
commitaa5540cd82170f82c6fe11511e12de96aa58cbc1 (patch)
tree00abeac7f45255bed191721a176f1cf2ecfd7e8f /src/cmd/compile/internal/gc
parent07ca28d529e1afb64a9f6f068214c05ee9772d34 (diff)
downloadgo-aa5540cd82170f82c6fe11511e12de96aa58cbc1.tar.gz
go-aa5540cd82170f82c6fe11511e12de96aa58cbc1.zip
cmd/compile: make map.zero symbol content-addressable
The compiler machinery that generates "map.zero" symbols marks them as RODATA and DUPOK, which is problematic when a given application has multiple map zero symbols (from different packages) with varying sizes: the dupok path in the loader assumes that if two symbols have the same name, it is safe to pick any of the versions. In the case of map.zero, the link needs to select the largest symbol, not an arbitrary sym. To fix this problem, mark map.zero symbols as content-addressable, since the loader's content addressability processing path already supports selection of the larger symbol in cases where there are dups. Fixes #46653. Change-Id: Iabd2feef01d448670ba795c7eaddc48c191ea276 Reviewed-on: https://go-review.googlesource.com/c/go/+/326211 Trust: Than McIntosh <thanm@google.com> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/cmd/compile/internal/gc')
-rw-r--r--src/cmd/compile/internal/gc/obj.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/gc/obj.go b/src/cmd/compile/internal/gc/obj.go
index 0b10cb8a9e..55a0ab7da7 100644
--- a/src/cmd/compile/internal/gc/obj.go
+++ b/src/cmd/compile/internal/gc/obj.go
@@ -148,6 +148,7 @@ func dumpdata() {
if reflectdata.ZeroSize > 0 {
zero := base.PkgLinksym("go.map", "zero", obj.ABI0)
objw.Global(zero, int32(reflectdata.ZeroSize), obj.DUPOK|obj.RODATA)
+ zero.Set(obj.AttrContentAddressable, true)
}
staticdata.WriteFuncSyms()