]> Cypherpunks repositories - gostls13.git/commit
[dev.link] cmd/link: create sym.Symbols after deadcode in newobj mode
authorCherry Zhang <cherryyz@google.com>
Sat, 5 Oct 2019 02:05:41 +0000 (22:05 -0400)
committerCherry Zhang <cherryyz@google.com>
Tue, 15 Oct 2019 18:55:32 +0000 (18:55 +0000)
commitcab29ebd84d3fae2092337684ba82999fe97e947
treeb26ffb58eff691b5c6a83c763be6de1aa430835d
parent90fe9c7c5c19cd0816c8afaa65a7f14d18cd3860
[dev.link] cmd/link: create sym.Symbols after deadcode in newobj mode

With the new object files, now we can run the deadcode pass on
indices instead of Symbol structs, so we can delay creating
Symbols after the deadcode pass. Then we only need to create
reachable symbols.

Not create Symbols in LoadNew and LoadRefs, and recombine
LoadReloc into LoadFull.

Split loadcgo into two parts: the first finds root symbols, the
second create Symbols and sets attributes. The first runs before
the deadcode pass, while the second runs after.

TODO: currently there are still symbols that are not marked
reachable but still used. This includes DWARF symbols, file
symbols, and type symbols that are referenced by DWARF symbols.
We still need to create them (conservatively).

Change-Id: I695779c9312be9d49ab1683957ac3e72e1f65a1e
Reviewed-on: https://go-review.googlesource.com/c/go/+/199643
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/link/internal/ld/deadcode.go
src/cmd/link/internal/ld/deadcode2.go
src/cmd/link/internal/ld/go.go
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/ld/link.go
src/cmd/link/internal/objfile/objfile2.go