[dev.link] cmd/link: convert DWARF type generation to use loader

Converts the portion of DWARF generation that deals with creation of
type DIEs and constant DIEs to use the new loader interfaces. Creation
of subprogram DIE and compilation unit DIE content still operates on
sym.Symbols at the moment, and happens much later in the linker.

The new code for type DIE generation is gated/guarded by the linker
flag "-newdw", which currently defaults to true. At some point in the
near future this flag should be removed, but it is handy for triage at
the moment.

This patch also includes shim code designed to run after loadlibfull()
that walks through the DIE chains and to converts loader.Sym
references back into sym.Symbol references for the remainder of the
compilation, since the second phase of DWARF has not yet been
converted.

Change-Id: I681a00fb8a1f3c37884a79b373d86411332e07c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/208230
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
This commit is contained in:
Than McIntosh 2019-11-20 10:43:11 -05:00
parent 6a819b0062
commit 25f1b093fe
7 changed files with 2693 additions and 1188 deletions

View file

@ -2620,6 +2620,13 @@ func (ctxt *Link) loadlibfull() {
// Pull the symbols out.
ctxt.loader.ExtractSymbols(ctxt.Syms, ctxt.Reachparent)
// If -newdw is in effect, then we generated dwarf DIE objects
// with embedded loader.Sym refs as opposed to sym.Symbol refs.
// Call a helper to rewrite the former to the latter in all DIEs
if *FlagNewDw {
dwarfConvertSymbols(ctxt)
}
setupdynexp(ctxt)
// Drop the cgodata reference.