]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.12] cmd/link: fix deferreturn detector
authorKeith Randall <keithr@alum.mit.edu>
Fri, 7 Jun 2019 17:22:53 +0000 (13:22 -0400)
committerDmitri Shuralyov <dmitshur@golang.org>
Mon, 10 Jun 2019 19:51:25 +0000 (19:51 +0000)
commita6178d8ee32c3a53cd489373061d475b52cc289e
tree57329252d8c0f4cf483d14ea69a53bfc1c3bb83a
parent3887549ce40f4bccd598ea491ce6a3b7334bc214
[release-branch.go1.12] cmd/link: fix deferreturn detector

The logic for detecting deferreturn calls is wrong.

We used to look for a relocation whose symbol is runtime.deferreturn
and has an offset of 0. But on some architectures, the relocation
offset is not zero. These include arm (the offset is 0xebfffffe) and
s390x (the offset is 6).

This ends up setting the deferreturn offset at 0, so we end up using
the entry point live map instead of the deferreturn live map in a
frame which defers and then segfaults.

Instead, use the IsDirectJump helper to find calls.

Fixes #32484

Change-Id: Iecb530a7cf6eabd7233be7d0731ffa78873f3a54
Reviewed-on: https://go-review.googlesource.com/c/go/+/181258
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
(cherry picked from commit 9eb403159da9debbb4881140995e62bec0c943f3)
Reviewed-on: https://go-review.googlesource.com/c/go/+/181262
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
src/cmd/link/internal/ld/pcln.go
test/fixedbugs/issue32477.go [new file with mode: 0644]