1
0
mirror of https://github.com/golang/go synced 2024-11-19 09:24:39 -07:00

cmd/asm,cmd/compile: fix tail call in leaf functions on PPC64

In some leaf functions using "RET foo(SB)", the jump may be incorrectly
translated into "JMP LR" instead of "JMP foo(SB)".

Such is the case when compiling the autogenerated function in k8s
k8s.io/kubernetes/pkg/kubelet/server/stats.(*resourceAnalyzer).GetPodVolumeStats.

Fixes #50048

Change-Id: Icdf65fcda6b3c5eb9d3ad5c7aad04add9419dffb
Reviewed-on: https://go-review.googlesource.com/c/go/+/371034
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Paul Murphy <murp@ibm.com>
This commit is contained in:
Paul E. Murphy 2021-12-10 16:58:43 -06:00 committed by Cherry Mui
parent f4ca598c9f
commit d198a36d8c

View File

@ -884,8 +884,13 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
q = c.newprog()
q.As = ABR
q.Pos = p.Pos
if retTarget == nil {
q.To.Type = obj.TYPE_REG
q.To.Reg = REG_LR
} else {
q.To.Type = obj.TYPE_BRANCH
q.To.Sym = retTarget
}
q.Mark |= BRANCH
q.Spadj = +autosize