From 4f33c88a51587681b7be1ae57cfbc43b627c6bc4 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Mon, 30 Jul 2012 19:11:16 +0200 Subject: import updated compilers from sources --- sys/src/cmd/5l/obj.c | 53 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 11 deletions(-) (limited to 'sys/src/cmd/5l/obj.c') diff --git a/sys/src/cmd/5l/obj.c b/sys/src/cmd/5l/obj.c index 5b6712175..162012842 100644 --- a/sys/src/cmd/5l/obj.c +++ b/sys/src/cmd/5l/obj.c @@ -12,11 +12,13 @@ char thechar = '5'; char *thestring = "arm"; /* + * -H0 no header * -H1 -T0x10005000 -R4 is aif for risc os * -H2 -T4128 -R4096 is plan9 format * -H3 -T0xF0000020 -R4 is NetBSD format * -H4 is IXP1200 (raw) * -H5 -T0xC0008010 -R1024 is ipaq + * -H6 -R4096 no header with segments padded to pages */ static int @@ -127,6 +129,7 @@ main(int argc, char *argv[]) diag("unknown -H option"); errorexit(); case 0: /* no header */ + case 6: /* no header, padded segments */ HEADR = 0L; if(INITTEXT == -1) INITTEXT = 0; @@ -1226,6 +1229,8 @@ doprof1(void) s->value = n*4; } +static int brcond[] = {ABEQ, ABNE, ABCS, ABCC, ABMI, ABPL, ABVS, ABVC, ABHI, ABLS, ABGE, ABLT, ABGT, ABLE}; + void doprof2(void) { @@ -1280,7 +1285,7 @@ doprof2(void) } /* - * BL profin, R2 + * BL profin */ q = prg(); q->line = p->line; @@ -1320,6 +1325,7 @@ doprof2(void) p->link = q; p = q; } + /* * RET */ @@ -1327,21 +1333,46 @@ doprof2(void) q->as = ARET; q->from = p->from; q->to = p->to; + q->cond = p->cond; q->link = p->link; + q->reg = p->reg; p->link = q; - /* - * BL profout - */ - p->as = ABL; - p->from = zprg.from; - p->to = zprg.to; - p->to.type = D_BRANCH; - p->cond = ps4; - p->to.sym = s4; + if(p->scond != 14) { + q = prg(); + q->as = ABL; + q->from = zprg.from; + q->to = zprg.to; + q->to.type = D_BRANCH; + q->cond = ps4; + q->to.sym = s4; + q->link = p->link; + p->link = q; - p = q; + p->as = brcond[p->scond^1]; /* complement */ + p->scond = 14; + p->from = zprg.from; + p->to = zprg.to; + p->to.type = D_BRANCH; + p->cond = q->link->link; /* successor of RET */ + p->to.offset = q->link->link->pc; + + p = q->link->link; + } else { + + /* + * BL profout + */ + p->as = ABL; + p->from = zprg.from; + p->to = zprg.to; + p->to.type = D_BRANCH; + p->cond = ps4; + p->to.sym = s4; + p->scond = 14; + p = q; + } continue; } } -- cgit v1.2.3