cmd/internal/archive: skip sentinel archive entries created by Go cmd

When reading an archive, check for the presence of sentinel entries
created by the Go command. These zero-sized marker entries don't contain
any useful symbols, but rather are there to communicate info to the
linker; ignore them during symbol dumping.

Fixes #62036.

Change-Id: Ied017b0c5b92a3cf6fd13bb9c9f3a9664e4f20f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/519635
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Than McIntosh 2023-08-15 10:24:41 -04:00
parent fc212a9307
commit 1e245d21b8
3 changed files with 39 additions and 1 deletions

View file

@ -35,7 +35,7 @@ func openGoFile(f *os.File) (*File, error) {
L:
for _, e := range a.Entries {
switch e.Type {
case archive.EntryPkgDef:
case archive.EntryPkgDef, archive.EntrySentinelNonObj:
continue
case archive.EntryGoObj:
o := e.Obj