]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: fix isStmt DWARF info
authorAustin Clements <austin@google.com>
Wed, 14 Nov 2018 20:45:27 +0000 (15:45 -0500)
committerAustin Clements <austin@google.com>
Wed, 14 Nov 2018 22:01:38 +0000 (22:01 +0000)
When CL 147160 introduced function ABIs encoded as symbol versions in
the linker, it became slightly more complicated to look up derived
DWARF symbols. It fixed this by introducing a dwarfFuncSym function to
hide this logic, but missed one derived lookup that was done in the
object reader itself. As a result, we lost the isStmt tables from the
compiler, so every PC was marked as a statement in the DWARF info.

Fix this by moving this derived lookup out of the object reader and
into the DWARF code and calling dwarfFuncSym to get the correctly
versioned symbol.

Should fix the linux-amd64-longtest builder.

Updates #27539.

Change-Id: If40d5ba28bab1918ac4ad18fbb5103666b6d978b
Reviewed-on: https://go-review.googlesource.com/c/149605
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
src/cmd/link/internal/ld/dwarf.go
src/cmd/link/internal/objfile/objfile.go
src/cmd/link/internal/sym/symbol.go

index d10f4ab3c3ca14a66d5acdaa09a49825f234e11b..a150306df9174dc8dd9f9ddf18cb62254d673baf 100644 (file)
@@ -1219,11 +1219,14 @@ func writelines(ctxt *Link, unit *compilationUnit, ls *sym.Symbol) {
 
                pciterinit(ctxt, &pcfile, &s.FuncInfo.Pcfile)
                pciterinit(ctxt, &pcline, &s.FuncInfo.Pcline)
-               pciterinit(ctxt, &pcstmt, &sym.Pcdata{P: s.FuncInfo.IsStmtSym.P})
 
-               if pcstmt.done != 0 {
+               isStmtSym := dwarfFuncSym(ctxt, s, dwarf.IsStmtPrefix, false)
+               if isStmtSym != nil && len(isStmtSym.P) > 0 {
+                       pciterinit(ctxt, &pcstmt, &sym.Pcdata{P: isStmtSym.P})
+               } else {
                        // Assembly files lack a pcstmt section, we assume that every instruction
                        // is a valid statement.
+                       pcstmt.done = 1
                        pcstmt.value = 1
                }
 
index 77c3a7f9148c40c15430b84d96650286a514262d..a85ba1ebee95be70a88fbfbd5050663651881092 100644 (file)
@@ -320,8 +320,6 @@ overwrite:
                        pc.InlTree[i].Func = r.readSymIndex()
                }
 
-               s.FuncInfo.IsStmtSym = r.syms.Lookup(dwarf.IsStmtPrefix+s.Name, int(s.Version))
-
                if !dupok {
                        if s.Attr.OnList() {
                                log.Fatalf("symbol %s listed multiple times", s.Name)
index 5e5fca467da2e84c01ea8f5f2ee36f6733d982b6..a1af4670a28b555397718af015456d022f3d643a 100644 (file)
@@ -499,7 +499,6 @@ type FuncInfo struct {
        Pcline      Pcdata
        Pcinline    Pcdata
        Pcdata      []Pcdata
-       IsStmtSym   *Symbol
        Funcdata    []*Symbol
        Funcdataoff []int64
        File        []*Symbol