]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.link] cmd/link: fix buglet in compilationUnitByStartPC
authorThan McIntosh <thanm@google.com>
Tue, 10 Mar 2020 14:27:13 +0000 (10:27 -0400)
committerThan McIntosh <thanm@google.com>
Tue, 10 Mar 2020 17:19:18 +0000 (17:19 +0000)
The methods of compilationUnitByStartPC (used in DWARF generation)
were looking at comp unit sym.Symbols instead of loader.Sym's, which
will not be viable once the wavefront reaches DWARF gen phase two.
Rewrite the methods to use only loader.Sym.

Change-Id: I0f520399d5458079c48cff1d882ef879934f8e92
Reviewed-on: https://go-review.googlesource.com/c/go/+/222759
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/link/internal/ld/dwarf2.go

index 8e2b18596796361853d3542f4b6976e7494c1012..cc344d8680e51160b893fb88fbe1ce26d724ce2b 100644 (file)
@@ -998,14 +998,14 @@ func (v compilationUnitByStartPC) Swap(i, j int) { v[i], v[j] = v[j], v[i] }
 
 func (v compilationUnitByStartPC) Less(i, j int) bool {
        switch {
-       case len(v[i].Textp) == 0 && len(v[j].Textp) == 0:
+       case len(v[i].Textp2) == 0 && len(v[j].Textp2) == 0:
                return v[i].Lib.Pkg < v[j].Lib.Pkg
-       case len(v[i].Textp) != 0 && len(v[j].Textp) == 0:
+       case len(v[i].Textp2) != 0 && len(v[j].Textp2) == 0:
                return true
-       case len(v[i].Textp) == 0 && len(v[j].Textp) != 0:
+       case len(v[i].Textp2) == 0 && len(v[j].Textp2) != 0:
                return false
        default:
-               return v[i].Textp[0].Value < v[j].Textp[0].Value
+               return v[i].PCs[0].Start < v[j].PCs[0].Start
        }
 }