From: Keith Randall Date: Tue, 12 Apr 2022 20:34:42 +0000 (-0700) Subject: cmd/link: don't sort pclntab entries X-Git-Tag: go1.19beta1~680 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=1f97f960e76d1b722b7c4a0dd61e9b20ec6c2a37;p=gostls13.git 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 --- 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