]> Cypherpunks repositories - gostls13.git/commitdiff
heuristic to stop pulling .6 in from .a
authorRuss Cox <rsc@golang.org>
Thu, 5 Feb 2009 21:58:43 +0000 (13:58 -0800)
committerRuss Cox <rsc@golang.org>
Thu, 5 Feb 2009 21:58:43 +0000 (13:58 -0800)
is not right if the .6 is only for data and
the init function.

instead of that, pick up everything and
let the dead code/data eliminator throw
away the parts that weren't useful.

R=r
DELTA=25  (0 added, 22 deleted, 3 changed)
OCL=24446
CL=24446

src/cmd/6l/go.c
src/cmd/6l/l.h
src/cmd/6l/obj.c

index a1a515fb3e2cacdbc1db588bba0ac1c6dd168594..961a3320b0ef857117243437152dc2d7044663ef 100644 (file)
@@ -503,22 +503,6 @@ isinitfunc(Sym *s)
        return 0;
 }
 
-void
-ignoreoptfuncs(void)
-{
-       Prog *p;
-
-       // nop out calls to optional functions
-       // that were not pulled in from libraries.
-       for(p=firstp; p != P; p=p->link) {
-               if(p->to.sym != S && p->to.sym->type == SOPT) {
-                       if(p->as != ACALL)
-                               diag("bad use of optional function: %P", p);
-                       nopout(p);
-               }
-       }
-}
-
 static void mark(Sym*);
 static int markdepth;
 
index 6382203a5964cdac25d873c5855d0abbf2371a0d..83c28bd4b7bf9c7ea8e26c4f42258db291d72230 100644 (file)
@@ -150,7 +150,6 @@ enum
        SFILE,
        SCONST,
        SUNDEF,
-       SOPT,
 
        SIMPORT,
        SEXPORT,
@@ -386,7 +385,6 @@ void        ckoff(Sym*, int32);
 Prog*  copyp(Prog*);
 double cputime(void);
 void   datblk(int32, int32);
-void   ignoreoptfuncs(void);
 void   deadcode(void);
 void   definetypestrings(void);
 void   definetypesigs(void);
index a23e030f597a6b21a43dff99610352fdd17141a1..b682ab1b1b3c12f8a35a55aa86c8e513271d00a7 100644 (file)
@@ -368,7 +368,6 @@ main(int argc, char *argv[])
                sprint(a, "%s/lib/lib_%s_%s.a", goroot, goarch, goos);
                objfile(a);
        }
-       ignoreoptfuncs();
        definetypestrings();
        definetypesigs();
        deadcode();
@@ -950,11 +949,8 @@ loop:
                if(debug['W'])
                        print(" ANAME   %s\n", s->name);
                h[o] = s;
-               if((v == D_EXTERN || v == D_STATIC) && s->type == 0) {
+               if((v == D_EXTERN || v == D_STATIC) && s->type == 0)
                        s->type = SXREF;
-                       if(isinitfunc(s))
-                               s->type = SOPT; // optional function; don't pull in an object file just for s.
-               }
                if(v == D_FILE) {
                        if(s->type != SFILE) {
                                histgen++;
@@ -1096,7 +1092,7 @@ loop:
 
        case ATEXT:
                s = p->from.sym;
-               if(ntext++ == 0 && s->type != 0 && s->type != SXREF && s->type != SOPT) {
+               if(ntext++ == 0 && s->type != 0 && s->type != SXREF) {
                        /* redefinition, so file has probably been seen before */
                        if(debug['v'])
                                Bprint(&bso, "skipping: %s: redefinition: %s", pn, s->name);
@@ -1113,7 +1109,7 @@ loop:
                        diag("%s: no TEXT symbol: %P", pn, p);
                        errorexit();
                }
-               if(s->type != 0 && s->type != SXREF && s->type != SOPT) {
+               if(s->type != 0 && s->type != SXREF) {
                        if(p->from.scale & DUPOK) {
                                skip = 1;
                                goto casdef;