]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/link: generate .xdata PE section
authorqmuntal <quimmuntal@gmail.com>
Thu, 12 Jan 2023 14:47:19 +0000 (15:47 +0100)
committerQuim Muntal <quimmuntal@gmail.com>
Tue, 2 May 2023 09:22:56 +0000 (09:22 +0000)
commit39ca989b883b913287d282365510a9152a3f80e6
tree340682e3007db9b8f89b2ae45da48c57e35c40fd
parent14cf82aa37ec33012ca48febd83fb16e1178beee
cmd/link: generate .xdata PE section

This CL adds a .xdata section to the PE file generated by the Go linker.
It is also the first CL of the SEH chain that adds effective support
for unwinding the Go stack, as demonstrated by the newly added tests.

The .xdata section is a standard PE section that contains
an array of unwind data info structures. This structures are used to
record the effects a function has on the stack pointer,
and where the nonvolatile registers are saved on the stack [1].

Note that this CL still does not support unwinding the cgo stack.

Updates #57302

[1] https://learn.microsoft.com/en-us/cpp/build/exception-handling-x64#struct-unwind_info

Change-Id: I6f305a51ed130b758ff9ca7b90c091e50a109a6f
Reviewed-on: https://go-review.googlesource.com/c/go/+/457455
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Davis Goodin <dagood@microsoft.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/link/internal/ld/asmb.go
src/cmd/link/internal/ld/data.go
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/ld/pe.go
src/cmd/link/internal/ld/seh.go
src/cmd/link/internal/sym/symkind.go
src/cmd/link/internal/sym/symkind_string.go
src/internal/syscall/windows/syscall_windows.go
src/internal/syscall/windows/zsyscall_windows.go
src/runtime/runtime-seh_windows_test.go