]> Cypherpunks repositories - gostls13.git/commit
cmd/link: fix deferreturn detector
authorKeith Randall <keithr@alum.mit.edu>
Fri, 7 Jun 2019 17:22:53 +0000 (13:22 -0400)
committerKeith Randall <khr@golang.org>
Fri, 7 Jun 2019 18:51:04 +0000 (18:51 +0000)
commit9eb403159da9debbb4881140995e62bec0c943f3
tree095c119f79f402a8e29f701623ea2c28e8383e9c
parent4c84d878130287f0c1d22afd83471e891600bf0f
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 IsDirectCall helper to find calls.

Fixes #32477
Update #6980

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>
src/cmd/link/internal/ld/pcln.go
test/fixedbugs/issue32477.go [new file with mode: 0644]