Commit 36f21e00 authored by Ken Thompson's avatar Ken Thompson

mode elf tossing

SVN=121962
parent 4ff63a47
......@@ -1154,10 +1154,10 @@ optoas(int op, Type *t)
case CASE(OEQ, TUINT32):
case CASE(OEQ, TINT64):
case CASE(OEQ, TUINT64):
case CASE(OEQ, TFLOAT32):
case CASE(OEQ, TFLOAT64):
case CASE(OEQ, TPTR32):
case CASE(OEQ, TPTR64):
case CASE(OEQ, TFLOAT32):
case CASE(OEQ, TFLOAT64):
a = AJEQ;
break;
......@@ -1170,10 +1170,10 @@ optoas(int op, Type *t)
case CASE(ONE, TUINT32):
case CASE(ONE, TINT64):
case CASE(ONE, TUINT64):
case CASE(ONE, TFLOAT32):
case CASE(ONE, TFLOAT64):
case CASE(ONE, TPTR32):
case CASE(ONE, TPTR64):
case CASE(ONE, TFLOAT32):
case CASE(ONE, TFLOAT64):
a = AJNE;
break;
......@@ -1181,8 +1181,6 @@ optoas(int op, Type *t)
case CASE(OLT, TINT16):
case CASE(OLT, TINT32):
case CASE(OLT, TINT64):
case CASE(OLT, TFLOAT32):
case CASE(OLT, TFLOAT64):
a = AJLT;
break;
......@@ -1190,6 +1188,8 @@ optoas(int op, Type *t)
case CASE(OLT, TUINT16):
case CASE(OLT, TUINT32):
case CASE(OLT, TUINT64):
case CASE(OGE, TFLOAT32):
case CASE(OGE, TFLOAT64):
a = AJCS;
break;
......@@ -1197,8 +1197,6 @@ optoas(int op, Type *t)
case CASE(OLE, TINT16):
case CASE(OLE, TINT32):
case CASE(OLE, TINT64):
case CASE(OLE, TFLOAT32):
case CASE(OLE, TFLOAT64):
a = AJLE;
break;
......@@ -1206,6 +1204,8 @@ optoas(int op, Type *t)
case CASE(OLE, TUINT16):
case CASE(OLE, TUINT32):
case CASE(OLE, TUINT64):
case CASE(OGT, TFLOAT32):
case CASE(OGT, TFLOAT64):
a = AJLS;
break;
......@@ -1213,8 +1213,6 @@ optoas(int op, Type *t)
case CASE(OGT, TINT16):
case CASE(OGT, TINT32):
case CASE(OGT, TINT64):
case CASE(OGT, TFLOAT32):
case CASE(OGT, TFLOAT64):
a = AJGT;
break;
......@@ -1222,6 +1220,8 @@ optoas(int op, Type *t)
case CASE(OGT, TUINT16):
case CASE(OGT, TUINT32):
case CASE(OGT, TUINT64):
case CASE(OLE, TFLOAT32):
case CASE(OLE, TFLOAT64):
a = AJHI;
break;
......@@ -1229,8 +1229,6 @@ optoas(int op, Type *t)
case CASE(OGE, TINT16):
case CASE(OGE, TINT32):
case CASE(OGE, TINT64):
case CASE(OGE, TFLOAT32):
case CASE(OGE, TFLOAT64):
a = AJGE;
break;
......@@ -1238,6 +1236,8 @@ optoas(int op, Type *t)
case CASE(OGE, TUINT16):
case CASE(OGE, TUINT32):
case CASE(OGE, TUINT64):
case CASE(OLT, TFLOAT32):
case CASE(OLT, TFLOAT64):
a = AJCC;
break;
......
......@@ -120,10 +120,10 @@ void
asmb(void)
{
Prog *p;
long v, magic, w;
long v, magic;
int a;
uchar *op1;
vlong vl, va;
vlong vl, va, fo, w;
if(debug['v'])
Bprint(&bso, "%5.2f asmb\n", cputime());
......@@ -166,6 +166,8 @@ asmb(void)
cbc -= a;
}
cflush();
switch(HEADTYPE) {
default:
diag("unknown header type %ld", HEADTYPE);
......@@ -183,9 +185,10 @@ asmb(void)
}
cflush();
break;
case 7:
v = rnd(HEADR+textsize, INITRND);
seek(cout, v, 0);
myseek(cout, v);
break;
}
......@@ -402,23 +405,31 @@ debug['s'] = 1;
wputl(5); /* # of Shdrs */
wputl(4); /* Shdr with strings */
fo = 0;
va = INITRND;
w = HEADR+textsize;
linuxphdr(1, /* text - type = PT_LOAD */
1L+4L, /* text - flags = PF_X+PF_R */
HEADR, /* file offset */
INITTEXT, /* vaddr */
INITTEXT, /* paddr */
textsize, /* file size */
textsize, /* memory size */
0, /* file offset */
va, /* vaddr */
va, /* paddr */
w, /* file size */
w, /* memory size */
INITRND); /* alignment */
v = rnd(HEADR+textsize, INITRND);
fo = rnd(fo+w, INITRND);
va = rnd(va+w, INITRND);
w = datsize;
linuxphdr(1, /* data - type = PT_LOAD */
1L+2L+4L, /* data - flags = PF_X+PF_W+PF_R */
v, /* file offset */
INITDAT, /* vaddr */
INITDAT, /* paddr */
datsize, /* file size */
datsize+bsssize, /* memory size */
2L+4L, /* data - flags = PF_W+PF_R */
fo, /* file offset */
va, /* vaddr */
va, /* paddr */
w, /* file size */
w+bsssize, /* memory size */
INITRND); /* alignment */
linuxphdr(0x6474e551, /* gok - type = gok */
......@@ -441,69 +452,80 @@ debug['s'] = 1;
0, /* align */
0); /* entsize */
stroffset = 1;
v = HEADR;
stroffset = 1;
fo = 0;
va = INITRND;
w = HEADR+textsize;
linuxshdr(".text", /* name */
1, /* type */
6, /* flags */
INITTEXT, /* addr */
v, /* off */
textsize, /* size */
va, /* addr */
fo, /* off */
w, /* size */
0, /* link */
0, /* info */
4, /* align */
8, /* align */
0); /* entsize */
v += textsize;
fo = rnd(fo+w, INITRND);
va = rnd(va+w, INITRND);
w = datsize;
linuxshdr(".data", /* name */
1, /* type */
3, /* flags */
INITDAT, /* addr */
v, /* off */
datsize, /* size */
va, /* addr */
fo, /* off */
w, /* size */
0, /* link */
0, /* info */
4, /* align */
8, /* align */
0); /* entsize */
v += datsize;
fo += w;
va += w;
w = bsssize;
linuxshdr(".bss", /* name */
8, /* type */
3, /* flags */
INITDAT, /* addr */
v, /* off */
bsssize, /* size */
va, /* addr */
fo, /* off */
w, /* size */
0, /* link */
0, /* info */
4, /* align */
8, /* align */
0); /* entsize */
v += 0;
va = stroffset +
strlen(".shstrtab")+1 +
strlen(".gosymtab")+1;
fo = HEADR+textsize+datsize;
w = stroffset +
strlen(".shstrtab")+1;
// strlen(".gosymtab")+1;
linuxshdr(".shstrtab", /* name */
3, /* type */
0, /* flags */
0, /* addr */
v, /* off */
va, /* size */
fo, /* off */
w, /* size */
0, /* link */
0, /* info */
4, /* align */
8, /* align */
0); /* entsize */
v += va;
linuxshdr(".gosymtab", /* name */
2, /* type */
0, /* flags */
0, /* addr */
v, /* off */
0, /* size */
0, /* link */
0, /* info */
4, /* align */
0); /* entsize */
//fo += w;
//
// linuxshdr(".gosymtab", /* name */
// 2, /* type */
// 0, /* flags */
// 0, /* addr */
// fo, /* off */
// 0, /* size */
// 0, /* link */
// 0, /* info */
// 8, /* align */
// 0); /* entsize */
break;
}
cflush();
......@@ -775,7 +797,7 @@ linuxheadr(void)
a += 64; /* .data seg */
a += 64; /* .bss sect */
a += 64; /* .shstrtab sect - strings for headers */
a += 64; /* .gosymtab sect */
// a += 64; /* .gosymtab sect */
return a;
}
......@@ -831,6 +853,6 @@ linuxstrtable(void)
strnput(name, strlen(name)+1);
name = ".shstrtab";
strnput(name, strlen(name)+1);
name = ".gosymtab";
strnput(name, strlen(name)+1);
// name = ".gosymtab";
// strnput(name, strlen(name)+1);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment