]> Cypherpunks repositories - gostls13.git/commit
[dev.link] cmd/internal/goobj2, cmd/link: add content addressable symbols
authorCherry Zhang <cherryyz@google.com>
Fri, 10 Jul 2020 22:49:01 +0000 (18:49 -0400)
committerCherry Zhang <cherryyz@google.com>
Thu, 16 Jul 2020 18:44:07 +0000 (18:44 +0000)
commit27342e5bd9694df2878534ec122058ccbcd291aa
treec5e794f436a64dd9daa5779db833eeae3fe1d43d
parent5698ec36a86afcba0f7fe06e97e4cd5deaabe3f9
[dev.link] cmd/internal/goobj2, cmd/link: add content addressable symbols

This CL introduces content-addressable symbols (a.k.a. hashed
symbols) to object files. Content-addressable symbols are
identified and referenced by their content hashes, instead of by
names.

In the object file, a new pseudo-package index PkgIdxHashed is
introduced, for content-addressable symbols, and a new block is
added to store their hashes. The hashes are used by the linker to
identify and deduplicate the symbols.

For now, we only support content-addressable symbols that are
always locally defined (i.e. no cross-package references).

As a proof of concept, make string constant symbols content-
addressable.

Change-Id: Iaf53efd74c0ffb54fa95f784628cc84e95844536
Reviewed-on: https://go-review.googlesource.com/c/go/+/242079
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
src/cmd/compile/internal/gc/obj.go
src/cmd/internal/goobj/readnew.go
src/cmd/internal/goobj2/objfile.go
src/cmd/internal/obj/link.go
src/cmd/internal/obj/objfile2.go
src/cmd/internal/obj/sym.go
src/cmd/link/internal/ld/main.go
src/cmd/link/internal/loader/loader.go