diff options
| author | Russ Cox <rsc@golang.org> | 2015-01-26 15:14:23 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2015-01-30 03:15:44 +0000 |
| commit | 5a2771e286433c64a20fbe5ae6252080418dfa5c (patch) | |
| tree | 8f17c55da751ecb0ee1b8af0906faafd39ff1dae /src/liblink | |
| parent | 2ec293123f5769ea679ed547455e6f2b41838196 (diff) | |
| download | go-5a2771e286433c64a20fbe5ae6252080418dfa5c.tar.xz | |
cmd/gc, cmd/ld, liblink: update for portable Prog, Addr changes
Change-Id: Ia6f8badca56565b9df80c8dbe28c47f6cf7e653f
Reviewed-on: https://go-review.googlesource.com/3515
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Diffstat (limited to 'src/liblink')
| -rw-r--r-- | src/liblink/data.c | 8 | ||||
| -rw-r--r-- | src/liblink/objfile.c | 26 | ||||
| -rw-r--r-- | src/liblink/pass.c | 6 | ||||
| -rw-r--r-- | src/liblink/pcln.c | 2 |
4 files changed, 19 insertions, 23 deletions
diff --git a/src/liblink/data.c b/src/liblink/data.c index e5efa2eb2d..3de86fe050 100644 --- a/src/liblink/data.c +++ b/src/liblink/data.c @@ -87,7 +87,7 @@ savedata(Link *ctxt, LSym *s, Prog *p, char *pn) ctxt->diag("data out of order (already have %d)\n%P", p); symgrow(ctxt, s, off+siz); - if(p->to.type == ctxt->arch->D_FCONST) { + if(p->to.type == TYPE_FCONST) { switch(siz) { default: case 4: @@ -102,10 +102,10 @@ savedata(Link *ctxt, LSym *s, Prog *p, char *pn) s->p[off+i] = cast[fnuxi8[i]]; break; } - } else if(p->to.type == ctxt->arch->D_SCONST) { + } else if(p->to.type == TYPE_SCONST) { for(i=0; i<siz; i++) s->p[off+i] = p->to.u.sval[i]; - } else if(p->to.type == ctxt->arch->D_CONST) { + } else if(p->to.type == TYPE_CONST) { if(p->to.sym) goto addr; o = p->to.offset; @@ -132,7 +132,7 @@ savedata(Link *ctxt, LSym *s, Prog *p, char *pn) s->p[off+i] = cast[inuxi8[i]]; break; } - } else if(p->to.type == ctxt->arch->D_ADDR) { + } else if(p->to.type == TYPE_ADDR) { addr: r = addrel(s); r->off = off; diff --git a/src/liblink/objfile.c b/src/liblink/objfile.c index f29ebbc517..bdd63ccb64 100644 --- a/src/liblink/objfile.c +++ b/src/liblink/objfile.c @@ -167,7 +167,7 @@ writeobj(Link *ctxt, Biobuf *b) a = emallocz(sizeof *a); a->asym = p->from.sym; a->aoffset = p->from.offset; - a->type = ctxt->arch->symtype(&p->from); + a->name = p->from.name; a->gotype = p->from.gotype; a->link = curtext->autom; curtext->autom = a; @@ -240,7 +240,7 @@ writeobj(Link *ctxt, Biobuf *b) if(curtext == nil) // func _() {} continue; if(strcmp(p->to.sym->name, "go_args_stackmap") == 0) { - if(p->from.type != ctxt->arch->D_CONST || p->from.offset != FUNCDATA_ArgsPointerMaps) + if(p->from.type != TYPE_CONST || p->from.offset != FUNCDATA_ArgsPointerMaps) ctxt->diag("FUNCDATA use of go_args_stackmap(SB) without FUNCDATA_ArgsPointerMaps"); p->to.sym = linklookup(ctxt, smprint("%s.args_stackmap", curtext->name), curtext->version); } @@ -260,7 +260,7 @@ writeobj(Link *ctxt, Biobuf *b) continue; found = 0; for(p = s->text; p != nil; p = p->link) { - if(p->as == ctxt->arch->AFUNCDATA && p->from.type == ctxt->arch->D_CONST && p->from.offset == FUNCDATA_ArgsPointerMaps) { + if(p->as == ctxt->arch->AFUNCDATA && p->from.type == TYPE_CONST && p->from.offset == FUNCDATA_ArgsPointerMaps) { found = 1; break; } @@ -268,14 +268,10 @@ writeobj(Link *ctxt, Biobuf *b) if(!found) { p = appendp(ctxt, s->text); p->as = ctxt->arch->AFUNCDATA; - p->from.type = ctxt->arch->D_CONST; + p->from.type = TYPE_CONST; p->from.offset = FUNCDATA_ArgsPointerMaps; - if(ctxt->arch->thechar == '6' || ctxt->arch->thechar == '8') - p->to.type = ctxt->arch->D_EXTERN; - else { - p->to.type = ctxt->arch->D_OREG; - p->to.name = ctxt->arch->D_EXTERN; - } + p->to.type = TYPE_MEM; + p->to.name = NAME_EXTERN; p->to.sym = linklookup(ctxt, smprint("%s.args_stackmap", s->name), s->version); } } @@ -285,7 +281,7 @@ writeobj(Link *ctxt, Biobuf *b) mkfwd(s); linkpatch(ctxt, s); ctxt->arch->follow(ctxt, s); - ctxt->arch->addstacksplit(ctxt, s); + ctxt->arch->preprocess(ctxt, s); ctxt->arch->assemble(ctxt, s); linkpcln(ctxt, s); } @@ -407,12 +403,12 @@ writesym(Link *ctxt, Biobuf *b, LSym *s) for(a = s->autom; a != nil; a = a->link) { wrsym(b, a->asym); wrint(b, a->aoffset); - if(a->type == ctxt->arch->D_AUTO) + if(a->name == NAME_AUTO) wrint(b, A_AUTO); - else if(a->type == ctxt->arch->D_PARAM) + else if(a->name == NAME_PARAM) wrint(b, A_PARAM); else - sysfatal("%s: invalid local variable type %d", s->name, a->type); + sysfatal("%s: invalid local variable type %d", s->name, a->name); wrsym(b, a->gotype); } @@ -649,7 +645,7 @@ overwrite: a = emallocz(sizeof *a); a->asym = rdsym(ctxt, f, pkg); a->aoffset = rdint(f); - a->type = rdint(f); + a->name = rdint(f); a->gotype = rdsym(ctxt, f, pkg); a->link = s->autom; s->autom = a; diff --git a/src/liblink/pass.c b/src/liblink/pass.c index 6d4db2757a..edc4d9ba73 100644 --- a/src/liblink/pass.c +++ b/src/liblink/pass.c @@ -77,7 +77,7 @@ linkpatch(Link *ctxt, LSym *sym) for(p = sym->text; p != nil; p = p->link) { if(ctxt->arch->progedit) ctxt->arch->progedit(ctxt, p); - if(p->to.type != ctxt->arch->D_BRANCH) + if(p->to.type != TYPE_BRANCH) continue; if(p->to.u.branch != nil) { // TODO: Remove to.u.branch in favor of p->pcond. @@ -100,7 +100,7 @@ linkpatch(Link *ctxt, LSym *sym) if(p->to.sym) name = p->to.sym->name; ctxt->diag("branch out of range (%#ux)\n%P [%s]", c, p, name); - p->to.type = ctxt->arch->D_NONE; + p->to.type = TYPE_NONE; } p->to.u.branch = q; p->pcond = q; @@ -111,7 +111,7 @@ linkpatch(Link *ctxt, LSym *sym) if(p->pcond != nil) { p->pcond = brloop(ctxt, p->pcond); if(p->pcond != nil) - if(p->to.type == ctxt->arch->D_BRANCH) + if(p->to.type == TYPE_BRANCH) p->to.offset = p->pcond->pc; } } diff --git a/src/liblink/pcln.c b/src/liblink/pcln.c index f0ee1dc672..0ab1581e1d 100644 --- a/src/liblink/pcln.c +++ b/src/liblink/pcln.c @@ -291,7 +291,7 @@ linkpcln(Link *ctxt, LSym *cursym) if(p->as == ctxt->arch->AFUNCDATA) { i = p->from.offset; pcln->funcdataoff[i] = p->to.offset; - if(p->to.type != ctxt->arch->D_CONST) { + if(p->to.type != TYPE_CONST) { // TODO: Dedup. //funcdata_bytes += p->to.sym->size; pcln->funcdata[i] = p->to.sym; |
