diff options
| author | Russ Cox <rsc@golang.org> | 2014-04-14 15:54:20 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2014-04-14 15:54:20 -0400 |
| commit | 8d39e55c6516be5ee3267b8ce101b324a4f09986 (patch) | |
| tree | acc342d354cf6456d4cf9b60afea3fc0a0547979 /src/liblink/data.c | |
| parent | b53bb2cae512ce4abbc1587a903171a9da6201cf (diff) | |
| download | go-8d39e55c6516be5ee3267b8ce101b324a4f09986.tar.xz | |
liblink: remove arch-specific constants from file format
The relocation and automatic variable types were using
arch-specific numbers. Introduce portable enumerations
instead.
To the best of my knowledge, these are the only arch-specific
bits left in the new object file format.
Remove now, before Go 1.3, because file formats are forever.
LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/87670044
Diffstat (limited to 'src/liblink/data.c')
| -rw-r--r-- | src/liblink/data.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/liblink/data.c b/src/liblink/data.c index 58d6d6b5e8..4504f4171e 100644 --- a/src/liblink/data.c +++ b/src/liblink/data.c @@ -130,15 +130,13 @@ 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 || p->to.type == ctxt->arch->D_SIZE) { + } else if(p->to.type == ctxt->arch->D_ADDR) { addr: r = addrel(s); r->off = off; r->siz = siz; r->sym = p->to.sym; - r->type = p->to.type; - if(r->type != ctxt->arch->D_SIZE) - r->type = ctxt->arch->D_ADDR; + r->type = R_ADDR; r->add = p->to.offset; } else { ctxt->diag("bad data: %P", p); @@ -271,7 +269,7 @@ addaddrplus(Link *ctxt, LSym *s, LSym *t, vlong add) r->sym = t; r->off = i; r->siz = ctxt->arch->ptrsize; - r->type = ctxt->arch->D_ADDR; + r->type = R_ADDR; r->add = add; return i + r->siz; } @@ -292,7 +290,7 @@ addpcrelplus(Link *ctxt, LSym *s, LSym *t, vlong add) r->sym = t; r->off = i; r->add = add; - r->type = ctxt->arch->D_PCREL; + r->type = R_PCREL; r->siz = 4; return i + r->siz; } @@ -319,7 +317,7 @@ setaddrplus(Link *ctxt, LSym *s, vlong off, LSym *t, vlong add) r->sym = t; r->off = off; r->siz = ctxt->arch->ptrsize; - r->type = ctxt->arch->D_ADDR; + r->type = R_ADDR; r->add = add; return off + r->siz; } @@ -346,7 +344,7 @@ addsize(Link *ctxt, LSym *s, LSym *t) r->sym = t; r->off = i; r->siz = ctxt->arch->ptrsize; - r->type = ctxt->arch->D_SIZE; + r->type = R_SIZE; return i + r->siz; } @@ -366,7 +364,7 @@ addaddrplus4(Link *ctxt, LSym *s, LSym *t, vlong add) r->sym = t; r->off = i; r->siz = 4; - r->type = ctxt->arch->D_ADDR; + r->type = R_ADDR; r->add = add; return i + r->siz; } |
