diff options
author | Russ Cox <rsc@golang.org> | 2009-03-31 00:20:07 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-03-31 00:20:07 -0700 |
commit | fd21f3e9459fc5ea52ade3608dcdbb5b37f95bc9 (patch) | |
tree | 54067b164aad36719d9c529a5a4220b710080d2c /src/cmd/8l/obj.c | |
parent | 00407c2e3e23432ae43ce3282396836189120039 (diff) | |
download | golang-fd21f3e9459fc5ea52ade3608dcdbb5b37f95bc9.tar.gz |
* move go-specific loader code
into gc directory, where it gets included as ../gc/ldbody
this is similar to the assemblers including ../cc/lexbody
and ../cc/macbody.
* hook go-specific loader code into 8l.
* make current 8.out.h and 6.out.h backward compatible
with plan 9's versions. i had added some constants in
the middle of enums and have now moved them to the end.
this keeps us from invalidating old .8 and .6 files.
not sure how much it really matters, but easy to do.
R=r
DELTA=1314 (667 added, 623 deleted, 24 changed)
OCL=26938
CL=26941
Diffstat (limited to 'src/cmd/8l/obj.c')
-rw-r--r-- | src/cmd/8l/obj.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/cmd/8l/obj.c b/src/cmd/8l/obj.c index c4aa3486b..a14f52d6f 100644 --- a/src/cmd/8l/obj.c +++ b/src/cmd/8l/obj.c @@ -333,6 +333,10 @@ main(int argc, char *argv[]) sprint(a, "%s/lib/lib_%s_%s.a", goroot, goarch, goos); objfile(a); } + definetypestrings(); + definetypesigs(); + deadcode(); + firstp = firstp->link; if(firstp == P) errorexit(); @@ -848,7 +852,7 @@ ldobj(Biobuf *f, int32 len, char *pn) import1 = Boffset(f); Bseek(f, import0, 0); -// ldpkg(f, import1 - import0 - 2, pn); // -2 for !\n + ldpkg(f, import1 - import0 - 2, pn); // -2 for !\n Bseek(f, import1, 0); newloop: @@ -1017,6 +1021,20 @@ loop: case ADATA: data: + // Assume that AGLOBL comes after ADATA. + // If we've seen an AGLOBL that said this sym was DUPOK, + // ignore any more ADATA we see, which must be + // redefinitions. + s = p->from.sym; + if(s != S && s->dupok) { + if(debug['v']) + Bprint(&bso, "skipping %s in %s: dupok", s->name, pn); + goto loop; + } + if(s != S) { + p->dlink = s->data; + s->data = p; + } if(edatap == P) datap = p; else @@ -1056,19 +1074,7 @@ loop: } diag("%s: redefinition: %s\n%P", pn, s->name, p); } - s->type = STEXT; - s->value = pc; - lastp->link = p; - lastp = p; - p->pc = pc; - pc++; - if(textp == P) { - textp = p; - etextp = p; - goto loop; - } - etextp->pcond = p; - etextp = p; + newtext(p, s); goto loop; case AFMOVF: |