Skip to content

Commit b653a23

Browse files
committed
liblink: always use ZR instead of $0 for constants
Fixes golang#14 Change-Id: I3737ba4e11b34e7275c840bfe9f8996a5acac88f
1 parent c229d85 commit b653a23

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/liblink/asm7.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,10 @@ span7(Link *ctxt, LSym *cursym)
605605
if(p->as == ADWORD && ((c & 7)) != 0)
606606
c += 4;
607607
p->pc = c;
608+
if (p->from.type == D_CONST && p->from.offset == 0)
609+
p->from.reg = REGZERO;
610+
if (p->to.type == D_CONST && p->to.offset == 0)
611+
p->to.reg = REGZERO;
608612
o = oplook(ctxt, p);
609613
m = o->size;
610614
if(m == 0) {

0 commit comments

Comments
 (0)