The Go toolchain stopped creating them before Go 1.3, so no point in
worrying about them today.
History:
- Git commit
250a091 added cmd/ar, which wrote Plan 9 __.SYMDEF
entries into archive files.
- golang.org/cl/
6500117 renamed __.SYMDEF to __.GOSYMDEF. (Notably,
the commit message suggests users need to use Go nm to read symbols,
but even back then the toolchain did nothing with __.(GO)?SYMDEF files
except skip over them.)
- golang.org/cl/
42880043 added the -pack flag to cmd/gc to directly
produce archives by the Go compiler, and did not write __.GOSYMDEF
entries.
- golang.org/cl/
52310044 rewrote cmd/pack in Go, and removed support
for producing __.GOSYMDEF entries.
Change-Id: I255edf40d0d3690e3447e488039fcdef73c6d6b1
Reviewed-on: https://go-review.googlesource.com/19924
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
return false
}
- // symbol table may be first; skip it
- sz := arsize(b, "__.GOSYMDEF")
-
- if sz >= 0 {
- obj.Bseek(b, int64(sz), 1)
- } else {
- obj.Bseek(b, 8, 0)
- }
-
- // package export block is next
- sz = arsize(b, "__.PKGDEF")
-
- if sz <= 0 {
- return false
- }
- return true
+ // package export block should be first
+ sz := arsize(b, "__.PKGDEF")
+ return sz > 0
}
var idirs []string
return errCorruptArchive
}
switch name {
- case "__.SYMDEF", "__.GOSYMDEF", "__.PKGDEF":
+ case "__.PKGDEF":
r.skip(size)
default:
oldLimit := r.limit
f *os.File
}
-const (
- symname = "__.GOSYMDEF"
- pkgname = "__.PKGDEF"
-)
+const pkgname = "__.PKGDEF"
var (
// Set if we see an object compiled by the host compiler that is not
return
}
- /* skip over optional __.GOSYMDEF and process __.PKGDEF */
+ /* process __.PKGDEF */
off := obj.Boffset(f)
var arhdr ArHdr
goto out
}
- if strings.HasPrefix(arhdr.name, symname) {
- off += l
- l = nextar(f, off, &arhdr)
- if l <= 0 {
- Diag("%s: short read on archive file symbol header", lib.File)
- goto out
- }
- }
-
if !strings.HasPrefix(arhdr.name, pkgname) {
Diag("%s: cannot find package header", lib.File)
goto out
* the individual symbols that are unused.
*
* loading every object will also make it possible to
- * load foreign objects not referenced by __.GOSYMDEF.
+ * load foreign objects not referenced by __.PKGDEF.
*/
for {
l = nextar(f, off, &arhdr)
if string(line) == "!<arch>\n" {
// Archive file. Scan to __.PKGDEF.
var name string
- var size int
- if name, size, err = readGopackHeader(r); err != nil {
+ if name, _, err = readGopackHeader(r); err != nil {
return
}
- // Optional leading __.GOSYMDEF or __.SYMDEF.
- // Read and discard.
- if name == "__.SYMDEF" || name == "__.GOSYMDEF" {
- const block = 4096
- tmp := make([]byte, block)
- for size > 0 {
- n := size
- if n > block {
- n = block
- }
- if _, err = io.ReadFull(r, tmp[:n]); err != nil {
- return
- }
- size -= n
- }
-
- if name, _, err = readGopackHeader(r); err != nil {
- return
- }
- }
-
- // First real entry should be __.PKGDEF.
+ // First entry should be __.PKGDEF.
if name != "__.PKGDEF" {
err = errors.New("go archive is missing __.PKGDEF")
return