diff options
author | Than McIntosh <thanm@google.com> | 2020-04-17 09:11:57 -0400 |
---|---|---|
committer | Than McIntosh <thanm@google.com> | 2020-04-20 19:25:18 +0000 |
commit | c32b59026475342c9cf187b50e890a94c146bc79 (patch) | |
tree | a6a8bbcbcfd426c9531959db5d2ed0c5b09d4fb5 /src/cmd/link/internal/ld/lib.go | |
parent | 817bd10caee03fbf6fb6231934d9cf9a1b13c170 (diff) | |
download | go-c32b59026475342c9cf187b50e890a94c146bc79.tar.gz go-c32b59026475342c9cf187b50e890a94c146bc79.zip |
[dev.link] cmd/link: revise representation of dwarfp
Change linker DWARF generation to move away from emitting a single
giant list of DWARF symbols, and instead emit a list of descriptors,
with each descriptor holding the symbols for a specific DWARF section.
While placing all DWARF symbols in a single lists does come in handy
in certain instances, it also creates a lot of confusion and weird
code in other cases, specifically where we want to perform operations
on a section-by-section basis (resulting in code that tries to
re-discover section boundaries by walking/inspecting the list).
Change-Id: I4dac81bd38cba903c9fd7004d613597e76dfb77a
Reviewed-on: https://go-review.googlesource.com/c/go/+/228780
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/cmd/link/internal/ld/lib.go')
-rw-r--r-- | src/cmd/link/internal/ld/lib.go | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go index c400d80a18..b71bef22f4 100644 --- a/src/cmd/link/internal/ld/lib.go +++ b/src/cmd/link/internal/ld/lib.go @@ -2820,14 +2820,19 @@ func (ctxt *Link) loadlibfull() { pclntabFirstFunc = ctxt.loader.Syms[pclntabFirstFunc2] pclntabLastFunc = ctxt.loader.Syms[pclntabLastFunc2] - // Populate dwarfp from dwarfp2. If we see a symbol index on dwarfp2 + // Populate dwarfp from dwarfp2. If we see a symbol index // 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)) + for _, si := range dwarfp2 { + syms := make([]*sym.Symbol, 0, len(si.syms)) + for _, symIdx := range si.syms { + s := ctxt.loader.Syms[symIdx] + if s == nil { + panic(fmt.Sprintf("nil sym for dwarfp2 element %d", symIdx)) + } + s.Attr |= sym.AttrLocal + syms = append(syms, s) } - dwarfp = append(dwarfp, s) + dwarfp = append(dwarfp, dwarfSecInfo2{syms: syms}) } } |