1
0
mirror of https://github.com/golang/go synced 2024-11-22 01:54:42 -07:00

cmd/pack: rename __.SYMDEF to __.GOSYMDEF

This fixes a problem with ELF tools thinking they know the
format of the symbol table, as we do not use any of the
standard formats for that table.

This change will probably annoy the Plan 9 users, but I
believe there are other incompatibilities already that mean
they have to use a Go-specific nm.

Fixes #3473.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6500117
This commit is contained in:
Russ Cox 2012-09-13 10:26:21 -04:00
parent ec9967ff11
commit 6ee91ced92
8 changed files with 12 additions and 11 deletions

View File

@ -276,7 +276,7 @@ enum as
/* /*
* this is the ranlib header * this is the ranlib header
*/ */
#define SYMDEF "__.SYMDEF" #define SYMDEF "__.GOSYMDEF"
/* /*
* this is the simulated IEEE floating point * this is the simulated IEEE floating point

View File

@ -865,7 +865,7 @@ enum
/* /*
* this is the ranlib header * this is the ranlib header
*/ */
#define SYMDEF "__.SYMDEF" #define SYMDEF "__.GOSYMDEF"
/* /*
* this is the simulated IEEE floating point * this is the simulated IEEE floating point

View File

@ -547,7 +547,7 @@ enum
/* /*
* this is the ranlib header * this is the ranlib header
*/ */
#define SYMDEF "__.SYMDEF" #define SYMDEF "__.GOSYMDEF"
/* /*
* this is the simulated IEEE floating point * this is the simulated IEEE floating point

View File

@ -480,7 +480,7 @@ skiptopkgdef(Biobuf *b)
if(memcmp(p, "!<arch>\n", 8) != 0) if(memcmp(p, "!<arch>\n", 8) != 0)
return 0; return 0;
/* symbol table is first; skip it */ /* symbol table is first; skip it */
sz = arsize(b, "__.SYMDEF"); sz = arsize(b, "__.GOSYMDEF");
if(sz < 0) if(sz < 0)
return 0; return 0;
Bseek(b, sz, 1); Bseek(b, sz, 1);

View File

@ -366,7 +366,7 @@ objfile(char *file, char *pkg)
return; return;
} }
/* skip over __.SYMDEF */ /* skip over __.GOSYMDEF */
off = Boffset(f); off = Boffset(f);
if((l = nextar(f, off, &arhdr)) <= 0) { if((l = nextar(f, off, &arhdr)) <= 0) {
diag("%s: short read on archive file symbol header", file); diag("%s: short read on archive file symbol header", file);
@ -402,7 +402,7 @@ objfile(char *file, char *pkg)
* the individual symbols that are unused. * the individual symbols that are unused.
* *
* loading every object will also make it possible to * loading every object will also make it possible to
* load foreign objects not referenced by __.SYMDEF. * load foreign objects not referenced by __.GOSYMDEF.
*/ */
for(;;) { for(;;) {
l = nextar(f, off, &arhdr); l = nextar(f, off, &arhdr);

View File

@ -43,7 +43,7 @@ enum{
char *errs; /* exit status */ char *errs; /* exit status */
char *filename; /* current file */ char *filename; /* current file */
char symname[]="__.SYMDEF"; /* table of contents file name */ char symname[]="__.GOSYMDEF"; /* table of contents file name */
int multifile; /* processing multiple files */ int multifile; /* processing multiple files */
int aflag; int aflag;
int gflag; int gflag;

View File

@ -111,7 +111,7 @@ char *opt = "uvnbailogS";
char artemp[] = "/tmp/vXXXXX"; char artemp[] = "/tmp/vXXXXX";
char movtemp[] = "/tmp/v1XXXXX"; char movtemp[] = "/tmp/v1XXXXX";
char tailtemp[] = "/tmp/v2XXXXX"; char tailtemp[] = "/tmp/v2XXXXX";
char symdef[] = "__.SYMDEF"; char symdef[] = "__.GOSYMDEF";
char pkgdef[] = "__.PKGDEF"; char pkgdef[] = "__.PKGDEF";
int aflag; /* command line flags */ int aflag; /* command line flags */

View File

@ -52,13 +52,14 @@ func FindGcExportData(r *bufio.Reader) (err error) {
var name string var name string
var size int var size int
// First entry should be __.SYMDEF. // First entry should be __.GOSYMDEF.
// Older archives used __.SYMDEF, so allow that too.
// Read and discard. // Read and discard.
if name, size, err = readGopackHeader(r); err != nil { if name, size, err = readGopackHeader(r); err != nil {
return return
} }
if name != "__.SYMDEF" { if name != "__.SYMDEF" && name != "__.GOSYMDEF" {
err = errors.New("go archive does not begin with __.SYMDEF") err = errors.New("go archive does not begin with __.SYMDEF or __.GOSYMDEF")
return return
} }
const block = 4096 const block = 4096