6g/6l: add go type information to symbol table.
archive size +70%
binary size +30%
old
wreck.mtv=; ls -l /Users/rsc/bin/{godoc,gofmt}
-rwxr-xr-x 1 rsc eng 1487922 Aug 13 13:21 /Users/rsc/bin/godoc
-rwxr-xr-x 1 rsc eng 995995 Aug 13 13:21 /Users/rsc/bin/gofmt
wreck.mtv=; du -sh $GOROOT/pkg/
9.5M /home/rsc/go/pkg/
wreck.mtv=;
new
wreck.mtv=; ls -l /Users/rsc/bin/{godoc,gofmt}
-rwxr-xr-x 1 rsc eng 2014390 Aug 13 14:25 /Users/rsc/bin/godoc
-rwxr-xr-x 1 rsc eng 1268705 Aug 13 14:25 /Users/rsc/bin/gofmt
wreck.mtv=; du -sh $GOROOT/pkg
16M /home/rsc/go/pkg
wreck.mtv=;
R=ken
OCL=33217
CL=33220
diff --git a/src/cmd/6l/obj.c b/src/cmd/6l/obj.c
index f3c12d7..d9630fe3 100644
--- a/src/cmd/6l/obj.c
+++ b/src/cmd/6l/obj.c
@@ -614,14 +614,19 @@
return;
t = a->type;
- if(t != D_AUTO && t != D_PARAM)
+ if(t != D_AUTO && t != D_PARAM) {
+ if(a->gotype)
+ s->gotype = a->gotype;
return;
+ }
l = a->offset;
for(u=curauto; u; u=u->link) {
if(u->asym == s)
if(u->type == t) {
if(u->aoffset > l)
u->aoffset = l;
+ if(a->gotype)
+ u->gotype = a->gotype;
return;
}
}
@@ -632,6 +637,7 @@
u->asym = s;
u->aoffset = l;
u->type = t;
+ u->gotype = a->gotype;
}
void
@@ -1062,7 +1068,7 @@
s = p->from.sym;
if(s != S && s->dupok) {
if(debug['v'])
- Bprint(&bso, "skipping %s in %s: dupok", s->name, pn);
+ Bprint(&bso, "skipping %s in %s: dupok\n", s->name, pn);
goto loop;
}
if(s != S) {
@@ -1108,6 +1114,11 @@
}
diag("%s: redefinition: %s\n%P", pn, s->name, p);
}
+ if(p->from.gotype) {
+ if(s->gotype && s->gotype != p->from.gotype)
+ diag("%s: type mismatch for %s", pn, s->name);
+ s->gotype = p->from.gotype;
+ }
newtext(p, s);
goto loop;