diff options
author | Russ Cox <rsc@golang.org> | 2014-08-13 18:14:13 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2014-08-13 18:14:13 -0400 |
commit | f14ac88830638f1031ed0339d4db6e7e635385e6 (patch) | |
tree | a63565f4f99eca7a937946648c2cc844d37d5664 /src/liblink/asm9.c | |
parent | 21fcf4f8d49df1546e6655b8228e779593df0945 (diff) | |
download | go-f14ac88830638f1031ed0339d4db6e7e635385e6.tar.gz |
[dev.power64] liblink: fix handling of MOVD with large constants
LGTM=minux
R=golang-codereviews, minux
CC=golang-codereviews
https://codereview.appspot.com/122540043
Committer: Shenghou Ma <minux@golang.org>
Diffstat (limited to 'src/liblink/asm9.c')
-rw-r--r-- | src/liblink/asm9.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/liblink/asm9.c b/src/liblink/asm9.c index 886edf347..f1889a92c 100644 --- a/src/liblink/asm9.c +++ b/src/liblink/asm9.c @@ -488,12 +488,12 @@ span9(Link *ctxt, LSym *cursym) p = cursym->text; if(p == nil || p->link == nil) // handle external functions and ELF section symbols return; - + ctxt->cursym = cursym; + ctxt->autosize = (int32)(p->to.offset & 0xffffffffll) + 8; + if(oprange[AANDN].start == nil) buildop(ctxt); - ctxt->cursym = cursym; - bflag = 0; c = 0; p->pc = c; @@ -571,12 +571,10 @@ span9(Link *ctxt, LSym *cursym) if(ctxt->tlsg == nil) ctxt->tlsg = linklookup(ctxt, "runtime.tlsg", 0); - p = cursym->text; - ctxt->autosize = (int32)(p->to.offset & 0xffffffffll) + 8; symgrow(ctxt, cursym, cursym->size); bp = cursym->p; - for(p = p->link; p != nil; p = p->link) { + for(p = cursym->text->link; p != nil; p = p->link) { ctxt->pc = p->pc; ctxt->curp = p; o = oplook(ctxt, p); @@ -1464,12 +1462,17 @@ asmout(Link *ctxt, Prog *p, Optab *o, int32 *out) ctxt->diag("literal operation on R0\n%P", p); a = OP_ADDI; if(o->a1 == C_UCON) { + if((d&0xffff) != 0) + sysfatal("invalid handling of %P", p); v >>= 16; if(r == REGZERO && isuint32(d)){ o1 = LOP_IRR(OP_ORIS, p->to.reg, REGZERO, v); break; } a = OP_ADDIS; + } else { + if((int16)d != d) + sysfatal("invalid handling of %P", p); } o1 = AOP_IRR(a, p->to.reg, r, v); break; |