From: qmuntal Date: Sun, 17 Dec 2023 16:51:25 +0000 (+0100) Subject: cmd/link/internal/loadpe: update comment about @feat.00 symbol handling X-Git-Tag: go1.22rc1~2^2~8 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=761e10be8805bf0b3afd015cf9f09856a6066ad2;p=gostls13.git 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 TryBot-Result: Gopher Robot Reviewed-by: Dmitri Shuralyov Run-TryBot: Quim Muntal LUCI-TryBot-Result: Go LUCI --- diff --git a/src/cmd/link/internal/loadpe/ldpe.go b/src/cmd/link/internal/loadpe/ldpe.go index e4134607c4..1ba6debb4e 100644 --- a/src/cmd/link/internal/loadpe/ldpe.go +++ b/src/cmd/link/internal/loadpe/ldpe.go @@ -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