cmd/internal/obj: generate SEH aux symbols for windows/amd64

This CL updates the Go compiler so it generate SEH unwind info [1] as a
function auxiliary symbol when building for windows/amd64.

A follow up CL will teach the Go linker how to assemble these codes
into the PE .xdata section.

Updates #57302

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

Change-Id: I40ae0437bfee326c1a67c2b5e1496f0bf3ecea17
Reviewed-on: https://go-review.googlesource.com/c/go/+/461749
Reviewed-by: Davis Goodin <dagood@microsoft.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
This commit is contained in:
qmuntal 2023-01-16 16:21:48 +01:00 committed by Quim Muntal
parent d15fcbc79f
commit 76ac54b50e
11 changed files with 170 additions and 7 deletions

View file

@ -503,6 +503,8 @@ type FuncInfo struct {
FuncInfoSym *LSym
WasmImportSym *LSym
WasmImport *WasmImport
sehUnwindInfoSym *LSym
}
// JumpTable represents a table used for implementing multi-way
@ -1072,6 +1074,7 @@ type LinkArch struct {
Preprocess func(*Link, *LSym, ProgAlloc)
Assemble func(*Link, *LSym, ProgAlloc)
Progedit func(*Link, *Prog, ProgAlloc)
SEH func(*Link, *LSym) *LSym
UnaryDst map[As]bool // Instruction takes one operand, a destination.
DWARFRegisters map[int16]int16
}