From 1f97f960e76d1b722b7c4a0dd61e9b20ec6c2a37 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Tue, 12 Apr 2022 13:34:42 -0700 Subject: [PATCH] cmd/link: don't sort pclntab entries They are already in a good order. The sort here does nothing, as all the SymValues are 0. Sorting just arbitrarily permutes items because everything is equal and the sort isn't stable. Not sure why the ordering of these symbols matter. That ordering was added in CL 243223. Change-Id: Iee153394afdb39387701cfe0375bc022cf4bd489 Reviewed-on: https://go-review.googlesource.com/c/go/+/399540 Run-TryBot: Keith Randall TryBot-Result: Gopher Robot Reviewed-by: Cherry Mui Reviewed-by: Keith Randall Auto-Submit: Keith Randall --- src/cmd/link/internal/ld/data.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/cmd/link/internal/ld/data.go b/src/cmd/link/internal/ld/data.go index dae74d91d2..ce86f73cda 100644 --- a/src/cmd/link/internal/ld/data.go +++ b/src/cmd/link/internal/ld/data.go @@ -2112,12 +2112,7 @@ func (state *dodataState) dodataSect(ctxt *Link, symn sym.SymKind, syms []loader return si < sj }) } else { - // PCLNTAB was built internally, and has the proper order based on value. - // Sort the symbols as such. - for k, s := range syms { - sl[k].val = ldr.SymValue(s) - } - sort.Slice(sl, func(i, j int) bool { return sl[i].val < sl[j].val }) + // PCLNTAB was built internally, and already has the proper order. } // Set alignment, construct result -- 2.48.1