]> Cypherpunks repositories - gostls13.git/commitdiff
6l: more invalid input files
authorRuss Cox <rsc@golang.org>
Tue, 27 Jul 2010 00:34:02 +0000 (17:34 -0700)
committerRuss Cox <rsc@golang.org>
Tue, 27 Jul 2010 00:34:02 +0000 (17:34 -0700)
Fixes #963.
Fixes #964.

R=r
CC=golang-dev
https://golang.org/cl/1874045

src/cmd/6l/obj.c
src/cmd/ld/lib.c

index d0661c720ddb9cfbb1579b363a7052667f613cf1..724f11296ac3912aa03352d53de27ecd4b2b19cd 100644 (file)
@@ -427,21 +427,15 @@ zaddr(char *pn, Biobuf *f, Adr *a, Sym *h[])
        }
        if(t & T_TYPE)
                a->type = Bgetc(f);
+       if(a->type < 0 || a->type >= D_SIZE)
+               mangle(pn);
        adrgotype = S;
        if(t & T_GOTYPE)
                adrgotype = zsym(pn, f, h);
        s = a->sym;
-       if(s == S) {
-               switch(a->type) {
-               case D_SIZE:
-                       mangle(pn);
-               }
-               return;
-       }
-
        t = a->type;
        if(t != D_AUTO && t != D_PARAM) {
-               if(adrgotype)
+               if(s && adrgotype)
                        s->gotype = adrgotype;
                return;
        }
@@ -581,6 +575,15 @@ loop:
        zaddr(pn, f, &p->from, h);
        fromgotype = adrgotype;
        zaddr(pn, f, &p->to, h);
+       
+       switch(p->as) {
+       case ATEXT:
+       case ADATA:
+       case AGLOBL:
+               if(p->from.sym == S)
+                       mangle(pn);
+               break;
+       }
 
        if(debug['W'])
                print("%P\n", p);
index 982ff6b4dd7f5917f2a876d398c0616960ceb453..808708c2c392ea83286ad0f4cd43c29055cdfb61 100644 (file)
@@ -904,6 +904,6 @@ iconv(Fmt *fp)
 void
 mangle(char *file)
 {
-       fprint(2, "%s; mangled input file\n", file);
+       fprint(2, "%s: mangled input file\n", file);
        errorexit();
 }