From: Russ Cox Date: Tue, 27 Jul 2010 00:34:02 +0000 (-0700) Subject: 6l: more invalid input files X-Git-Tag: weekly.2010-07-29~29 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9a442211c6972c2d35a64562db864bb499b5915e;p=gostls13.git 6l: more invalid input files Fixes #963. Fixes #964. R=r CC=golang-dev https://golang.org/cl/1874045 --- diff --git a/src/cmd/6l/obj.c b/src/cmd/6l/obj.c index d0661c720d..724f11296a 100644 --- a/src/cmd/6l/obj.c +++ b/src/cmd/6l/obj.c @@ -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); diff --git a/src/cmd/ld/lib.c b/src/cmd/ld/lib.c index 982ff6b4dd..808708c2c3 100644 --- a/src/cmd/ld/lib.c +++ b/src/cmd/ld/lib.c @@ -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(); }