Skip to content

Commit 2416661

Browse files
qmuntalpull[bot]
authored andcommitted
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 <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Run-TryBot: Quim Muntal <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 29693b7 commit 2416661

File tree

1 file changed

+4
-11
lines changed
  • src/cmd/link/internal/loadpe

1 file changed

+4
-11
lines changed

src/cmd/link/internal/loadpe/ldpe.go

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

0 commit comments

Comments
 (0)