aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/obj/objfile.go
diff options
context:
space:
mode:
authorqmuntal <quimmuntal@gmail.com>2023-01-16 16:21:48 +0100
committerQuim Muntal <quimmuntal@gmail.com>2023-04-05 19:44:37 +0000
commit76ac54b50ea39bbb1389ecfed71f4f0991cb4289 (patch)
tree5c14d62f6a442fc72a011b68a247fc7730b184a6 /src/cmd/internal/obj/objfile.go
parentd15fcbc79f252fe5c01e099ab89b58f1de61df32 (diff)
downloadgo-76ac54b50ea39bbb1389ecfed71f4f0991cb4289.tar.xz
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>
Diffstat (limited to 'src/cmd/internal/obj/objfile.go')
-rw-r--r--src/cmd/internal/obj/objfile.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cmd/internal/obj/objfile.go b/src/cmd/internal/obj/objfile.go
index 78fa4c1076..1e9e5a827b 100644
--- a/src/cmd/internal/obj/objfile.go
+++ b/src/cmd/internal/obj/objfile.go
@@ -602,6 +602,9 @@ func (w *writer) Aux(s *LSym) {
if fn.Pcln.Pcinline != nil && fn.Pcln.Pcinline.Size != 0 {
w.aux1(goobj.AuxPcinline, fn.Pcln.Pcinline)
}
+ if fn.sehUnwindInfoSym != nil && fn.sehUnwindInfoSym.Size != 0 {
+ w.aux1(goobj.AuxSehUnwindInfo, fn.sehUnwindInfoSym)
+ }
for _, pcSym := range fn.Pcln.Pcdata {
w.aux1(goobj.AuxPcdata, pcSym)
}
@@ -707,6 +710,9 @@ func nAuxSym(s *LSym) int {
if fn.Pcln.Pcinline != nil && fn.Pcln.Pcinline.Size != 0 {
n++
}
+ if fn.sehUnwindInfoSym != nil && fn.sehUnwindInfoSym.Size != 0 {
+ n++
+ }
n += len(fn.Pcln.Pcdata)
if fn.WasmImport != nil {
if fn.WasmImportSym == nil || fn.WasmImportSym.Size == 0 {
@@ -770,7 +776,7 @@ func genFuncInfoSyms(ctxt *Link) {
fn.FuncInfoSym = isym
b.Reset()
- auxsyms := []*LSym{fn.dwarfRangesSym, fn.dwarfLocSym, fn.dwarfDebugLinesSym, fn.dwarfInfoSym, fn.WasmImportSym}
+ auxsyms := []*LSym{fn.dwarfRangesSym, fn.dwarfLocSym, fn.dwarfDebugLinesSym, fn.dwarfInfoSym, fn.WasmImportSym, fn.sehUnwindInfoSym}
for _, s := range auxsyms {
if s == nil || s.Size == 0 {
continue