From: Cherry Zhang Date: Thu, 7 May 2020 15:53:58 +0000 (-0400) Subject: cmd/link: fix minor bug in trampoline insertion X-Git-Tag: go1.15beta1~198 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=33213039e5d806f93a11561609c804cef7c065b3;p=gostls13.git cmd/link: fix minor bug in trampoline insertion 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 TryBot-Result: Gobot Gobot Reviewed-by: Than McIntosh Reviewed-by: Jeremy Faller --- diff --git a/src/cmd/link/internal/ld/data.go b/src/cmd/link/internal/ld/data.go index 162ef9ba4e..13ccb86a03 100644 --- a/src/cmd/link/internal/ld/data.go +++ b/src/cmd/link/internal/ld/data.go @@ -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++ {