]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.18] 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:11 +0000 (21:05 +0000)
commit63dd776220bb3a443e6b5c0766a389ec33dc4b69
tree48368d73eb8423084ade4fc3f1c8a64e5238b06b
parent2b989668973ae2b00bdcb30cf2ed141da9d22655
[release-branch.go1.18] 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 #56833

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/+/451916
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