]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: don't sort pclntab entries
authorKeith Randall <khr@golang.org>
Tue, 12 Apr 2022 20:34:42 +0000 (13:34 -0700)
committerGopher Robot <gobot@golang.org>
Tue, 12 Apr 2022 23:13:38 +0000 (23:13 +0000)
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 <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@google.com>

src/cmd/link/internal/ld/data.go

index dae74d91d28d86f58fcc92828dc762f02ac7d69b..ce86f73cdab9354a102793191c1218a26feb180e 100644 (file)
@@ -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