]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.16] cmd/compile: make map.zero symbol content-addressable
authorThan McIntosh <thanm@google.com>
Wed, 9 Jun 2021 00:09:49 +0000 (20:09 -0400)
committerDmitri Shuralyov <dmitshur@golang.org>
Tue, 29 Jun 2021 17:38:08 +0000 (17:38 +0000)
commitd4ee0255f26ec755181682133dae0238b690274c
tree9c69dbe3a45aab0fc3bb758acb0a4d8788edce92
parentfd129a6b0e6041da048b845e966be94bd718b9aa
[release-branch.go1.16] 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 #46657.

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>
(cherry picked from commit aa5540cd82170f82c6fe11511e12de96aa58cbc1)
Reviewed-on: https://go-review.googlesource.com/c/go/+/326212
Run-TryBot: Cherry Mui <cherryyz@google.com>
src/cmd/compile/internal/gc/obj.go
test/fixedbugs/issue46653.dir/bad/bad.go [new file with mode: 0644]
test/fixedbugs/issue46653.dir/main.go [new file with mode: 0644]
test/fixedbugs/issue46653.go [new file with mode: 0644]