From 29c5291f03c64d54c1ed643f1273acc507ddd6cc Mon Sep 17 00:00:00 2001 From: Than McIntosh Date: Tue, 10 Mar 2020 10:27:13 -0400 Subject: [PATCH] [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 --- src/cmd/link/internal/ld/dwarf2.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 } } -- 2.48.1