From: Than McIntosh Date: Tue, 10 Mar 2020 14:27:13 +0000 (-0400) Subject: [dev.link] cmd/link: fix buglet in compilationUnitByStartPC X-Git-Tag: go1.15beta1~679^2~87 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=29c5291f03c64d54c1ed643f1273acc507ddd6cc;p=gostls13.git [dev.link] cmd/link: fix buglet in compilationUnitByStartPC 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 TryBot-Result: Gobot Gobot Reviewed-by: Cherry Zhang --- diff --git a/src/cmd/link/internal/ld/dwarf2.go b/src/cmd/link/internal/ld/dwarf2.go index 8e2b185967..cc344d8680 100644 --- a/src/cmd/link/internal/ld/dwarf2.go +++ b/src/cmd/link/internal/ld/dwarf2.go @@ -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 } }