]> Cypherpunks repositories - gostls13.git/commit
[dev.link] cmd/internal/obj: handle content-addressable symbols with relocations
authorCherry Zhang <cherryyz@google.com>
Thu, 16 Jul 2020 03:14:50 +0000 (23:14 -0400)
committerCherry Zhang <cherryyz@google.com>
Mon, 20 Jul 2020 17:26:32 +0000 (17:26 +0000)
commit526d99a49ae67bfde15134b96159680988615d2d
tree35f2e189bdb7fedec71ae11933b8b1edd2642a23
parent289c238a339c59737b7f271b19bc9217e7d69851
[dev.link] cmd/internal/obj: handle content-addressable symbols with relocations

For content-addressable symbols with relocations, we build a
content hash based on its content and relocations. Depending on
the category of the referenced symbol, we choose different hash
algorithms such that the hash is globally consistent.

For now, we only support content-addressable symbols with
relocations when the current package's import path is known, so
that the symbol names are fully expanded. Otherwise, if the
referenced symbol is a named symbol whose name is not fully
expanded, the hash won't be globally consistent, and can cause
erroneous collisions. This is fine for now, as the deduplication
is just an optimization, not a requirement for correctness (until
we get to type descriptors).

Change-Id: I639e4e03dd749b5d71f0a55c2525926575b1ac30
Reviewed-on: https://go-review.googlesource.com/c/go/+/243142
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
src/cmd/asm/main.go
src/cmd/compile/internal/gc/main.go
src/cmd/compile/internal/gc/obj.go
src/cmd/internal/obj/link.go
src/cmd/internal/obj/objfile2.go
src/cmd/internal/obj/objfile_test.go [new file with mode: 0644]
src/cmd/internal/obj/sym.go