]> Cypherpunks repositories - gostls13.git/commit
cmd/link, runtime: mark goexit as the top of the call stack
authorMichael Munday <mike.munday@ibm.com>
Thu, 28 Mar 2019 16:51:30 +0000 (12:51 -0400)
committerMichael Munday <mike.munday@ibm.com>
Mon, 15 Apr 2019 13:17:28 +0000 (13:17 +0000)
commitaafe257390cc9048e8b5df898fabd79a9e0d4c39
tree2c0636b4b1ab59eb4b00a1f185515ce22ee2ff5a
parent0bd101cecc5458a8463b8d672bf1745c3cbb7c02
cmd/link, runtime: mark goexit as the top of the call stack

This CL adds a new attribute, TOPFRAME, which can be used to mark
functions that should be treated as being at the top of the call
stack. The function `runtime.goexit` has been marked this way on
architectures that use a link register.

This will stop programs that use DWARF to unwind the call stack
from unwinding past `runtime.goexit` on architectures that use a
link register. For example, it eliminates "corrupt stack?"
warnings when generating a backtrace that hits `runtime.goexit`
in GDB on s390x.

Similar code should be added for non-link-register architectures
(i.e. amd64, 386). They mark the top of the call stack slightly
differently to link register architectures so I haven't added
that code (they need to mark "rip" as undefined).

Fixes #24385.

Change-Id: I15b4c69ac75b491daa0acf0d981cb80eb06488de
Reviewed-on: https://go-review.googlesource.com/c/go/+/169726
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
16 files changed:
src/cmd/internal/goobj/read.go
src/cmd/internal/obj/link.go
src/cmd/internal/obj/objfile.go
src/cmd/internal/obj/plist.go
src/cmd/internal/obj/textflag.go
src/cmd/link/internal/ld/dwarf.go
src/cmd/link/internal/objfile/objfile.go
src/cmd/link/internal/sym/attribute.go
src/runtime/asm_arm.s
src/runtime/asm_arm64.s
src/runtime/asm_mips64x.s
src/runtime/asm_mipsx.s
src/runtime/asm_ppc64x.s
src/runtime/asm_s390x.s
src/runtime/runtime-gdb_test.go
src/runtime/textflag.h