]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link/internal/loadpe: update comment about @feat.00 symbol handling
authorqmuntal <quimmuntal@gmail.com>
Sun, 17 Dec 2023 16:51:25 +0000 (17:51 +0100)
committerQuim Muntal <quimmuntal@gmail.com>
Mon, 18 Dec 2023 20:26:46 +0000 (20:26 +0000)
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>

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

index e4134607c4b56ae0fe257f9e57236f694602ac3c..1ba6debb4e67b874b267d5743d0c33b4ceb08643 100644 (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