]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/5l, cmd/6l, cmd/8l, cmd/ld: remove unused code, consolidate enums
authorShenghou Ma <minux@golang.org>
Wed, 6 Aug 2014 04:25:52 +0000 (00:25 -0400)
committerShenghou Ma <minux@golang.org>
Wed, 6 Aug 2014 04:25:52 +0000 (00:25 -0400)
LGTM=rsc
R=rsc, iant
CC=golang-codereviews
https://golang.org/cl/120220043

src/cmd/5l/asm.c
src/cmd/5l/l.h
src/cmd/6l/l.h
src/cmd/8l/l.h
src/cmd/ld/lib.h
src/cmd/ld/pass.c [deleted file]

index 2943442d51fef40ed4e78e4912ab6ab446649ad6..02b4c78f11cbe72dc2d06ddf1d13625e8aecbc7b 100644 (file)
@@ -648,14 +648,14 @@ asmb(void)
        switch(HEADTYPE) {
        default:
        case Hplan9:    /* plan 9 */
-               lput(0x647);                    /* magic */
-               lput(segtext.filelen);                  /* sizes */
-               lput(segdata.filelen);
-               lput(segdata.len - segdata.filelen);
-               lput(symsize);                  /* nsyms */
-               lput(entryvalue());             /* va of entry */
-               lput(0L);
-               lput(lcsize);
+               LPUT(0x647);                    /* magic */
+               LPUT(segtext.filelen);                  /* sizes */
+               LPUT(segdata.filelen);
+               LPUT(segdata.len - segdata.filelen);
+               LPUT(symsize);                  /* nsyms */
+               LPUT(entryvalue());             /* va of entry */
+               LPUT(0L);
+               LPUT(lcsize);
                break;
        case Hlinux:
        case Hfreebsd:
@@ -676,64 +676,6 @@ asmb(void)
        }
 }
 
-/*
-void
-cput(int32 c)
-{
-       *cbp++ = c;
-       if(--cbc <= 0)
-               cflush();
-}
-*/
-
-void
-wput(int32 l)
-{
-
-       cbp[0] = l>>8;
-       cbp[1] = l;
-       cbp += 2;
-       cbc -= 2;
-       if(cbc <= 0)
-               cflush();
-}
-
-
-void
-hput(int32 l)
-{
-
-       cbp[0] = l>>8;
-       cbp[1] = l;
-       cbp += 2;
-       cbc -= 2;
-       if(cbc <= 0)
-               cflush();
-}
-
-void
-lput(int32 l)
-{
-
-       cbp[0] = l>>24;
-       cbp[1] = l>>16;
-       cbp[2] = l>>8;
-       cbp[3] = l;
-       cbp += 4;
-       cbc -= 4;
-       if(cbc <= 0)
-               cflush();
-}
-
-void
-nopstat(char *f, Count *c)
-{
-       if(c->outof)
-       Bprint(&bso, "%s delay %d/%d (%.2f)\n", f,
-               c->outof - c->count, c->outof,
-               (double)(c->outof - c->count)/c->outof);
-}
-
 int32
 rnd(int32 v, int32 r)
 {
index 491dc8f8590ef1b444acde59ff25aa39dbfb021a..2a7200e758c463d22a4c61a359a4b23361b078e9 100644 (file)
@@ -48,23 +48,8 @@ enum
 #define        EXTERN  extern
 #endif
 
-/* do not undefine this - code will be removed eventually */
-#define        CALLEEBX
-
-#define        dynptrsize      0
-
 #define        P               ((Prog*)0)
 #define        S               ((LSym*)0)
-#define        TNAME           (ctxt->cursym?ctxt->cursym->name:noname)
-
-#define SIGNINTERN     (1729*325*1729)
-
-typedef        struct  Count   Count;
-struct Count
-{
-       int32   count;
-       int32   outof;
-};
 
 enum
 {
@@ -73,11 +58,6 @@ enum
        LABEL           = 1<<1,
        LEAF            = 1<<2,
 
-       STRINGSZ        = 200,
-       MINSIZ          = 64,
-       NENT            = 100,
-       MAXIO           = 8192,
-       MAXHIST         = 40,   /* limit of path elements for history symbols */
        MINLC   = 4,
 
        C_NONE          = 0,
@@ -127,8 +107,6 @@ enum
        C_GOK,
 };
 
-#ifndef COFFCVT
-
 EXTERN int32   autosize;
 EXTERN LSym*   datap;
 EXTERN int     debug[128];
@@ -152,25 +130,18 @@ void      adddynrela(LSym *rel, LSym *s, Reloc *r);
 void   adddynsym(Link *ctxt, LSym *s);
 int    archreloc(Reloc *r, LSym *s, vlong *val);
 void   asmb(void);
-void   cput(int32 c);
 int    elfreloc1(Reloc *r, vlong sectoff);
 void   elfsetupplt(void);
-void   hput(int32 l);
 void   listinit(void);
-void   lput(int32 l);
 int    machoreloc1(Reloc *r, vlong sectoff);
 void   main(int argc, char *argv[]);
-void   nopstat(char *f, Count *c);
 int32  rnd(int32 v, int32 r);
-void   wput(int32 l);
 
 /* Native is little-endian */
 #define        LPUT(a) lputl(a)
 #define        WPUT(a) wputl(a)
 #define        VPUT(a) abort()
 
-#endif
-
 /* Used by ../ld/dwarf.c */
 enum
 {
index 7303910a6e5af2cb68e6868571f899c0baafe440..ff2e69452e60dcb5c66a95fc541d054de91f0b5d 100644 (file)
@@ -68,14 +68,9 @@ EXTERN       int     RegSize;
 
 #define        P               ((Prog*)0)
 #define        S               ((LSym*)0)
-#define        TNAME           (ctxt->cursym?ctxt->cursym->name:noname)
 enum
 {
-       MINSIZ          = 8,
-       STRINGSZ        = 200,
        MINLC           = 1,
-       MAXIO           = 8192,
-       MAXHIST         = 40,                           /* limit of path elements for history symbols */
 };
 
 #pragma        varargck        type    "I"     uchar*
@@ -89,9 +84,6 @@ EXTERN        int32   spsize;
 EXTERN LSym*   symlist;
 EXTERN int32   symsize;
 
-EXTERN vlong   textstksiz;
-EXTERN vlong   textarg;
-
 int    Iconv(Fmt *fp);
 void   adddynlib(char *lib);
 void   adddynrel(LSym *s, Reloc *r);
@@ -103,8 +95,6 @@ int  elfreloc1(Reloc *r, vlong sectoff);
 void   elfsetupplt(void);
 void   listinit(void);
 int    machoreloc1(Reloc *r, vlong sectoff);
-void   main(int argc, char *argv[]);
-void   parsetextconst(vlong arg);
 vlong  rnd(vlong v, vlong r);
 
 /* Native is little-endian */
index c9695ade0ae2bb62df4342973632dba3c6f2783d..70d3a4bb4f893ef7e3bb699bca8423132488f6aa 100644 (file)
@@ -50,15 +50,10 @@ enum
 
 #define        P               ((Prog*)0)
 #define        S               ((LSym*)0)
-#define        TNAME           (ctxt->cursym?ctxt->cursym->name:noname)
 
 enum
 {
-       MINSIZ          = 4,
-       STRINGSZ        = 200,
        MINLC           = 1,
-       MAXIO           = 8192,
-       MAXHIST         = 40,                           /* limit of path elements for history symbols */
 };
 
 #pragma        varargck        type    "I"     uchar*
@@ -72,7 +67,6 @@ EXTERN        char*   rpath;
 EXTERN int32   spsize;
 EXTERN LSym*   symlist;
 EXTERN int32   symsize;
-EXTERN int32   textsize;
 
 int    Iconv(Fmt *fp);
 void   adddynlib(char *lib);
@@ -85,7 +79,6 @@ int   elfreloc1(Reloc *r, vlong sectoff);
 void   elfsetupplt(void);
 void   listinit(void);
 int    machoreloc1(Reloc *r, vlong sectoff);
-void   main(int argc, char *argv[]);
 int32  rnd(int32 v, int32 r);
 void   s8put(char *n);
 char*  xsymname(LSym *s);
index 6ce880ea9ef30430e13be82bbc5c80a237821434..4094dfa6b1f849f873320d5d896661587ff8ed59 100644 (file)
 // A section further describes the pieces of that block for
 // use in debuggers and such.
 
+enum {
+       MAXIO           = 8192,
+};
+
 typedef struct Segment Segment;
 typedef struct Section Section;
 
diff --git a/src/cmd/ld/pass.c b/src/cmd/ld/pass.c
deleted file mode 100644 (file)
index 788b7c7..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-// Inferno utils/6l/pass.c
-// http://code.google.com/p/inferno-os/source/browse/utils/6l/pass.c
-//
-//     Copyright © 1994-1999 Lucent Technologies Inc.  All rights reserved.
-//     Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net)
-//     Portions Copyright © 1997-1999 Vita Nuova Limited
-//     Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com)
-//     Portions Copyright © 2004,2006 Bruce Ellis
-//     Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net)
-//     Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others
-//     Portions Copyright © 2009 The Go Authors.  All rights reserved.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-// Code and data passes.
-
-#include       "l.h"
-#include       "../ld/lib.h"
-#include "../../pkg/runtime/stack.h"
-
-void
-follow(void)
-{
-       LSym *s;
-
-       if(debug['v'])
-               Bprint(&bso, "%5.2f follow\n", cputime());
-       Bflush(&bso);
-       
-       for(s = ctxt->textp; s != nil; s = s->next)
-               ctxt->arch->follow(ctxt, s);
-}
-
-void
-patch(void)
-{
-       LSym *s;
-
-       if(debug['v'])
-               Bprint(&bso, "%5.2f mkfwd\n", cputime());
-       Bflush(&bso);
-       for(s = ctxt->textp; s != nil; s = s->next)
-               mkfwd(s);
-       if(debug['v'])
-               Bprint(&bso, "%5.2f patch\n", cputime());
-       Bflush(&bso);
-
-       if(flag_shared) {
-               s = linklookup(ctxt, "init_array", 0);
-               s->type = SINITARR;
-               s->reachable = 1;
-               s->hide = 1;
-               addaddr(ctxt, s, linklookup(ctxt, INITENTRY, 0));
-       }
-       
-       for(s = ctxt->textp; s != nil; s = s->next)
-               linkpatch(ctxt, s);
-}
-
-void
-dostkoff(void)
-{
-       LSym *s;
-
-       for(s = ctxt->textp; s != nil; s = s->next)
-               ctxt->arch->addstacksplit(ctxt, s);
-}
-
-void
-span(void)
-{
-       LSym *s;
-
-       if(debug['v'])
-               Bprint(&bso, "%5.2f span\n", cputime());
-
-       for(s = ctxt->textp; s != nil; s = s->next)
-               ctxt->arch->assemble(ctxt, s);
-}
-
-void
-pcln(void)
-{
-       LSym *s;
-
-       for(s = ctxt->textp; s != nil; s = s->next)
-               linkpcln(ctxt, s);
-}