From: Russ Cox Date: Wed, 14 Apr 2021 16:30:36 +0000 (-0400) Subject: cmd/link: sort the pclntab relocations X-Git-Tag: go1.17beta1~470 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9f7079c44e;p=gostls13.git cmd/link: sort the pclntab relocations llvm-mingw's lld produces an invalid windows/arm64 executable when presented with relocations that are out of order (the relocation for each function is emitted for two different locations, so we end up with two sorted streams roughly interlaced, not one sorted stream). Sorting should not break other systems, so sort always. Change-Id: Ic9a95e7145881db5984cbda442f27b0cc24748fb Reviewed-on: https://go-review.googlesource.com/c/go/+/312033 Trust: Russ Cox Run-TryBot: Russ Cox TryBot-Result: Go Bot Reviewed-by: Cherry Zhang --- diff --git a/src/cmd/link/internal/ld/pcln.go b/src/cmd/link/internal/ld/pcln.go index 79ad9d73e9..05fd302369 100644 --- a/src/cmd/link/internal/ld/pcln.go +++ b/src/cmd/link/internal/ld/pcln.go @@ -590,6 +590,7 @@ func (state *pclntab) generateFunctab(ctxt *Link, funcs []loader.Sym, inlSyms ma if !useSymValue { // Generate relocations for funcdata when externally linking. state.writeFuncData(ctxt, sb, funcs, inlSyms, startLocations, setAddr, setUintNOP) + sb.SortRelocs() } }