]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.19] cmd/link/internal/ppc64: fix trampoline reuse distance calcul...
authorPaul E. Murphy <murp@ibm.com>
Wed, 16 Nov 2022 20:53:39 +0000 (14:53 -0600)
committerMichael Pratt <mpratt@google.com>
Fri, 9 Dec 2022 21:05:18 +0000 (21:05 +0000)
commit1b4db7e46365bbbba479d0689c5699e6c0ba1142
tree4b3f48ef08f78ae86a208201e5fcd539b5e5cb0e
parent06f8a2f92c51022b4a217abf7b5d953053589b35
[release-branch.go1.19] cmd/link/internal/ppc64: fix trampoline reuse distance calculation

If a compatible trampoline has been inserted by a previously laid
function in the same section, and is known to be sufficiently close,
it can be reused.

When testing if the trampoline can be reused, the addend of the direct
call should be ignored. It is already encoded in the trampoline. If the
addend is non-zero, and the target sufficiently far away, and just
beyond direct call reach, this may cause the trampoline to be
incorrectly reused.

This was observed on go1.17.13 and openshift-installer commit f3c53b382
building in release mode with the following error:

github.com/aliyun/alibaba-cloud-sdk-go/services/cms.(*Client).DescribeMonitoringAgentAccessKeyWithChan.func1: direct call too far: runtime.duffzero+1f0-tramp0-1 -2000078

Fixes #56834

Change-Id: I54af957302506d4e3cd5d3121542c83fe980e912
Reviewed-on: https://go-review.googlesource.com/c/go/+/451415
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/451417
Reviewed-by: Joedian Reid <joedian@golang.org>
src/cmd/go/testdata/script/trampoline_reuse_test.txt [new file with mode: 0644]
src/cmd/link/internal/ppc64/asm.go