cmd: stop looking for __.(GO)?SYMDEF entries in archives

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>
This commit is contained in:
Matthew Dempsky 2016-02-25 14:58:03 -08:00
parent 5c613e9162
commit 67dbde0d71
4 changed files with 9 additions and 56 deletions

View file

@ -255,10 +255,7 @@ var coutbuf struct {
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
@ -781,7 +778,7 @@ func objfile(lib *Library) {
return
}
/* skip over optional __.GOSYMDEF and process __.PKGDEF */
/* process __.PKGDEF */
off := obj.Boffset(f)
var arhdr ArHdr
@ -792,15 +789,6 @@ func objfile(lib *Library) {
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
@ -829,7 +817,7 @@ func objfile(lib *Library) {
* 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)