1
0
mirror of https://github.com/golang/go synced 2024-11-23 07:20:06 -07:00

cmd/link/internal/loadpe: update comment about @feat.00 symbol handling

The @feat.00 comment is outdated, as Go does support SEH on
windows/amd64. While here, simplify it and add a link to the
relevant documentation.

Change-Id: I6e3c786ca4f4809baf46015edf569d06b12f1239
Reviewed-on: https://go-review.googlesource.com/c/go/+/550635
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
qmuntal 2023-12-17 17:51:25 +01:00 committed by Quim Muntal
parent 450f5d90c2
commit 761e10be88

View File

@ -493,17 +493,10 @@ func Load(l *loader.Loader, arch *sys.Arch, localSymVersion int, input *bio.Read
continue
}
if pesym.SectionNumber == IMAGE_SYM_ABSOLUTE && bytes.Equal(pesym.Name[:], []byte("@feat.00")) {
// Microsoft's linker looks at whether all input objects have an empty
// section called @feat.00. If all of them do, then it enables SEH;
// otherwise it doesn't enable that feature. So, since around the Windows
// XP SP2 era, most tools that make PE objects just tack on that section,
// so that it won't gimp Microsoft's linker logic. Go doesn't support SEH,
// so in theory, none of this really matters to us. But actually, if the
// linker tries to ingest an object with @feat.00 -- which are produced by
// LLVM's resource compiler, for example -- it chokes because of the
// IMAGE_SYM_ABSOLUTE section that it doesn't know how to deal with. Since
// @feat.00 is just a marking anyway, skip IMAGE_SYM_ABSOLUTE sections that
// are called @feat.00.
// The PE documentation says that, on x86 platforms, the absolute symbol named @feat.00
// is used to indicate that the COFF object supports SEH.
// Go doesn't support SEH on windows/386, so we can ignore this symbol.
// See https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#the-sxdata-section
continue
}
var sect *pe.Section