]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: fix minor bug in trampoline insertion
authorCherry Zhang <cherryyz@google.com>
Thu, 7 May 2020 15:53:58 +0000 (11:53 -0400)
committerCherry Zhang <cherryyz@google.com>
Thu, 7 May 2020 20:18:02 +0000 (20:18 +0000)
Fix a minor bug where it should use Textp2 instead of Textp. This
doesn't affect correctness. It just made the pre-allocation less
effective.

Change-Id: Ib3fa8ab3c64037e3582933970d051f278286353b
Reviewed-on: https://go-review.googlesource.com/c/go/+/232837
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
src/cmd/link/internal/ld/data.go

index 162ef9ba4e3f0e31863e3b17a9278c14e602c12d..13ccb86a0355d4b6557bb0c0dc0d902131d9938c 100644 (file)
@@ -2177,7 +2177,7 @@ func (ctxt *Link) textaddress() {
 
        // merge tramps into Textp, keeping Textp in address order
        if ntramps != 0 {
-               newtextp := make([]loader.Sym, 0, len(ctxt.Textp)+ntramps)
+               newtextp := make([]loader.Sym, 0, len(ctxt.Textp2)+ntramps)
                i := 0
                for _, s := range ctxt.Textp2 {
                        for ; i < ntramps && ldr.SymValue(ctxt.tramps[i]) < ldr.SymValue(s); i++ {