summaryrefslogtreecommitdiff
path: root/sys/src/cmd/5l/obj.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2012-07-30 19:11:16 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2012-07-30 19:11:16 +0200
commit4f33c88a51587681b7be1ae57cfbc43b627c6bc4 (patch)
tree25560404dc80007e5dc268811242c9071f6a1017 /sys/src/cmd/5l/obj.c
parentfcc5e75d07e5bc6cb3ddac6d9a437e7ec62d0d95 (diff)
import updated compilers from sources
Diffstat (limited to 'sys/src/cmd/5l/obj.c')
-rw-r--r--sys/src/cmd/5l/obj.c53
1 files changed, 42 insertions, 11 deletions
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;
}
}