]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/pack: rename __.SYMDEF to __.GOSYMDEF
authorRuss Cox <rsc@golang.org>
Thu, 13 Sep 2012 14:26:21 +0000 (10:26 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 13 Sep 2012 14:26:21 +0000 (10:26 -0400)
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

src/cmd/5l/5.out.h
src/cmd/6l/6.out.h
src/cmd/8l/8.out.h
src/cmd/gc/lex.c
src/cmd/ld/lib.c
src/cmd/nm/nm.c
src/cmd/pack/ar.c
src/pkg/exp/types/exportdata.go

index 1dea18c49e89051d64b29c3692ecb75dd15e8a78..23ff6210e30928d1be9420f631e0d03bf26c2818 100644 (file)
@@ -276,7 +276,7 @@ enum        as
 /*
  * this is the ranlib header
  */
-#define        SYMDEF  "__.SYMDEF"
+#define        SYMDEF  "__.GOSYMDEF"
 
 /*
  * this is the simulated IEEE floating point
index cd861c038ea07698893d43a2eab368be60dc8bcf..01c2ba840bca5b1272bd16f43a72b70d93e9efd9 100644 (file)
@@ -865,7 +865,7 @@ enum
 /*
  * this is the ranlib header
  */
-#define        SYMDEF  "__.SYMDEF"
+#define        SYMDEF  "__.GOSYMDEF"
 
 /*
  * this is the simulated IEEE floating point
index 924ba93901d1c8d4e6aeb502e63ef25da2b61f2d..49e046207bb703672cc3a1e668895840d7051cc0 100644 (file)
@@ -547,7 +547,7 @@ enum
 /*
  * this is the ranlib header
  */
-#define        SYMDEF  "__.SYMDEF"
+#define        SYMDEF  "__.GOSYMDEF"
 
 /*
  * this is the simulated IEEE floating point
index 0788a615146b9303b58badf052fc61f4390dd88b..3ef3fcc746b2bb6f831baae4a94b571a085ffd22 100644 (file)
@@ -480,7 +480,7 @@ skiptopkgdef(Biobuf *b)
        if(memcmp(p, "!<arch>\n", 8) != 0)
                return 0;
        /* symbol table is first; skip it */
-       sz = arsize(b, "__.SYMDEF");
+       sz = arsize(b, "__.GOSYMDEF");
        if(sz < 0)
                return 0;
        Bseek(b, sz, 1);
index 2385809dbf0dcf7a54a90e431e38e2fc8bc37e8f..2026707c2fee5a43ccf464e5a74306369a38d54b 100644 (file)
@@ -366,7 +366,7 @@ objfile(char *file, char *pkg)
                return;
        }
        
-       /* skip over __.SYMDEF */
+       /* skip over __.GOSYMDEF */
        off = Boffset(f);
        if((l = nextar(f, off, &arhdr)) <= 0) {
                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.
         *
         * loading every object will also make it possible to
-        * load foreign objects not referenced by __.SYMDEF.
+        * load foreign objects not referenced by __.GOSYMDEF.
         */
        for(;;) {
                l = nextar(f, off, &arhdr);
index 845b6c773a6ad9f24a5f2957294322a9181ce9d7..6682390358b6f554a392d6ee61e437e33a782e36 100644 (file)
@@ -43,7 +43,7 @@ enum{
 
 char   *errs;                  /* exit status */
 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    aflag;
 int    gflag;
index 990094e5dbe28d7a5241fc34b403a56bcd9a7671..7053f841f37eedef478172c3aecad77094336cd7 100644 (file)
@@ -111,7 +111,7 @@ char        *opt =          "uvnbailogS";
 char   artemp[] =      "/tmp/vXXXXX";
 char   movtemp[] =     "/tmp/v1XXXXX";
 char   tailtemp[] =    "/tmp/v2XXXXX";
-char   symdef[] =      "__.SYMDEF";
+char   symdef[] =      "__.GOSYMDEF";
 char   pkgdef[] =      "__.PKGDEF";
 
 int    aflag;                          /* command line flags */
index bca2038804e0c23b7780842db45cd2849156efaf..22190153bbf2daaf95928c4730d5aa1dabf42e31 100644 (file)
@@ -52,13 +52,14 @@ func FindGcExportData(r *bufio.Reader) (err error) {
                var name string
                var size int
 
-               // First entry should be __.SYMDEF.
+               // First entry should be __.GOSYMDEF.
+               // Older archives used __.SYMDEF, so allow that too.
                // Read and discard.
                if name, size, err = readGopackHeader(r); err != nil {
                        return
                }
-               if name != "__.SYMDEF" {
-                       err = errors.New("go archive does not begin with __.SYMDEF")
+               if name != "__.SYMDEF" && name != "__.GOSYMDEF" {
+                       err = errors.New("go archive does not begin with __.SYMDEF or __.GOSYMDEF")
                        return
                }
                const block = 4096