diff options
| author | Than McIntosh <thanm@google.com> | 2020-06-10 13:14:15 -0400 |
|---|---|---|
| committer | Than McIntosh <thanm@google.com> | 2020-06-17 12:01:09 +0000 |
| commit | d08bab99b74b6da2f10e16fdcd4fb4b410ae07cb (patch) | |
| tree | d6f2136fe801e5afe69783aa24fb2dcefe7f59aa /src/cmd/internal/obj/dwarf.go | |
| parent | bc1dbe58cf35454b4f8f981707013fd868c6ce6f (diff) | |
| download | go-d08bab99b74b6da2f10e16fdcd4fb4b410ae07cb.tar.xz | |
[dev.link] cmd/link: rework line table generation to reduce heap mem
Rework the way symbols are handled in DWARF line table generation to
eliminate copying the data payload for all SWDWARFLINES syms (emitted
by the compiler) into the payload of the ".debug_line" section symbol
(generated by the linker). Instead, chain together the SWDWARFLINES
symbols into a list, then append that list to the section sym list in
dwarfp (this moves us from a single monolithic .debug_line to a
.debug_line section sym followed by a list symbols (one per function
and an epilog symbol per compilation unit). To enable this work, move
the emission of the DW_LNE_set_address op (at the start of each
function) from the linker to the compiler.
Change-Id: Iec61b44a451f7a386c82a89bf944de482b018789
Reviewed-on: https://go-review.googlesource.com/c/go/+/237427
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Diffstat (limited to 'src/cmd/internal/obj/dwarf.go')
| -rw-r--r-- | src/cmd/internal/obj/dwarf.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cmd/internal/obj/dwarf.go b/src/cmd/internal/obj/dwarf.go index 4118c6442c..1811ac7881 100644 --- a/src/cmd/internal/obj/dwarf.go +++ b/src/cmd/internal/obj/dwarf.go @@ -44,6 +44,13 @@ func (ctxt *Link) generateDebugLinesSymbol(s, lines *LSym) { } } + // Emit a LNE_set_address extended opcode, so as to establish the + // starting text address of this function. + dctxt.AddUint8(lines, 0) + dwarf.Uleb128put(dctxt, lines, 1+int64(ctxt.Arch.PtrSize)) + dctxt.AddUint8(lines, dwarf.DW_LNE_set_address) + dctxt.AddAddress(lines, s, 0) + // Set up the debug_lines state machine. // NB: This state machine is reset to this state when we've finished // generating the line table. See below. |
