[dev.link] cmd/link: hoist dwarfGenerateDebugSyms out of dodata()

Hoist dwarfGenerateDebugSyms call up out of dodata to before
loadlibfull. This required a couple of small tweaks to the
loader and to loadlibfull.

Change-Id: I48ffb450d2e48b9e55775b73a6debcd27dbb7b9c
Reviewed-on: https://go-review.googlesource.com/c/go/+/228221
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
Than McIntosh 2020-04-13 15:38:03 -04:00
parent 3216d14f78
commit eed3ef581b
5 changed files with 21 additions and 22 deletions

View file

@ -2801,6 +2801,16 @@ func (ctxt *Link) loadlibfull() {
// Convert special symbols created by pcln.
pclntabFirstFunc = ctxt.loader.Syms[pclntabFirstFunc2]
pclntabLastFunc = ctxt.loader.Syms[pclntabLastFunc2]
// Populate dwarfp from dwarfp2. If we see a symbol index on dwarfp2
// whose loader.Syms entry is nil, something went wrong.
for _, symIdx := range dwarfp2 {
s := ctxt.loader.Syms[symIdx]
if s == nil {
panic(fmt.Sprintf("nil sym for dwarfp2 element %d", symIdx))
}
dwarfp = append(dwarfp, s)
}
}
func (ctxt *Link) dumpsyms() {