diff options
| author | Russ Cox <rsc@golang.org> | 2015-01-29 23:35:14 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2015-02-04 16:50:06 +0000 |
| commit | 1f2d7bf44fd20d06c21d16df485fa17137fe79f6 (patch) | |
| tree | c94e9493475cd1d6bafb92cecffe02c9b64757ac /src/liblink/obj5.c | |
| parent | 3e9ed273a244da5d96472656af911a6d2714a9e8 (diff) | |
| download | go-1f2d7bf44fd20d06c21d16df485fa17137fe79f6.tar.xz | |
liblink: require use of TYPE_ADDR, not TYPE_CONST
Add Addr-checking for all Progs on input to liblink, in liblink/pass.c,
including requiring use of TYPE_ADDR, not TYPE_CONST.
Update compilers and assemblers to satisfy checks.
Change-Id: Idac36b9f6805f0451cb541d2338992ca5eaf3963
Reviewed-on: https://go-review.googlesource.com/3801
Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/liblink/obj5.c')
| -rw-r--r-- | src/liblink/obj5.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/liblink/obj5.c b/src/liblink/obj5.c index 805b2b921d..805d7a59c2 100644 --- a/src/liblink/obj5.c +++ b/src/liblink/obj5.c @@ -151,9 +151,9 @@ progedit(Link *ctxt, Prog *p) if(ctxt->tlsg == nil) ctxt->tlsg = linklookup(ctxt, "runtime.tlsg", 0); - if(p->from.type == TYPE_CONST && p->from.name == NAME_EXTERN && p->from.sym == ctxt->tlsg) + if(p->from.type == TYPE_ADDR && p->from.name == NAME_EXTERN && p->from.sym == ctxt->tlsg) p->from.type = TYPE_MEM; - if(p->to.type == TYPE_CONST && p->to.name == NAME_EXTERN && p->to.sym == ctxt->tlsg) + if(p->to.type == TYPE_ADDR && p->to.name == NAME_EXTERN && p->to.sym == ctxt->tlsg) p->to.type = TYPE_MEM; } } @@ -227,7 +227,7 @@ preprocess(Link *ctxt, LSym *cursym) // MOVW $4(R13), R1 p = appendp(ctxt, p); p->as = AMOVW; - p->from.type = TYPE_CONST; + p->from.type = TYPE_ADDR; p->from.reg = REG_R13; p->from.offset = 4; p->to.type = TYPE_REG; @@ -236,7 +236,7 @@ preprocess(Link *ctxt, LSym *cursym) // MOVW $n(R13), R2 p = appendp(ctxt, p); p->as = AMOVW; - p->from.type = TYPE_CONST; + p->from.type = TYPE_ADDR; p->from.reg = REG_R13; p->from.offset = 4 + autoffset; p->to.type = TYPE_REG; @@ -631,7 +631,7 @@ preprocess(Link *ctxt, LSym *cursym) p->spadj = -p->to.offset; if((p->scond & C_PBIT) && p->from.type == TYPE_MEM && p->from.reg == REGSP && p->to.reg != REGPC) p->spadj = -p->from.offset; - if(p->from.type == TYPE_CONST && p->from.reg == REGSP && p->to.type == TYPE_REG && p->to.reg == REGSP) + if(p->from.type == TYPE_ADDR && p->from.reg == REGSP && p->to.type == TYPE_REG && p->to.reg == REGSP) p->spadj = -p->from.offset; break; } @@ -747,7 +747,7 @@ stacksplit(Link *ctxt, Prog *p, int32 framesize, int noctxt) // CMP stackguard, R2 p = appendp(ctxt, p); p->as = AMOVW; - p->from.type = TYPE_CONST; + p->from.type = TYPE_ADDR; p->from.reg = REGSP; p->from.offset = -framesize; p->to.type = TYPE_REG; @@ -777,7 +777,7 @@ stacksplit(Link *ctxt, Prog *p, int32 framesize, int noctxt) p = appendp(ctxt, p); p->as = AMOVW; - p->from.type = TYPE_CONST; + p->from.type = TYPE_ADDR; p->from.reg = REGSP; p->from.offset = StackGuard; p->to.type = TYPE_REG; @@ -794,7 +794,7 @@ stacksplit(Link *ctxt, Prog *p, int32 framesize, int noctxt) p = appendp(ctxt, p); p->as = AMOVW; - p->from.type = TYPE_CONST; + p->from.type = TYPE_ADDR; p->from.offset = framesize + (StackGuard - StackSmall); p->to.type = TYPE_REG; p->to.reg = REG_R3; |
