ref: 58d89cfed95d30bcd7fdfed4973237121803ad70
parent: c34f7840a5c1984deb9bedf2817aa0c8d4b09b83
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Aug 20 07:38:26 EDT 2015
Update Plan 9 build for new ABI.
--- a/6/isel.c
+++ b/6/isel.c
@@ -89,6 +89,7 @@
return tymode(n->decl.type);
else
die("invalid node type");
+ return ModeNone;
}
static Loc *loc(Isel *s, Node *n)
--- a/6/ra.c
+++ b/6/ra.c
@@ -945,7 +945,6 @@
/* FIXME: pick a better heuristic for spilling */
m = NULL;
_isel = s;
- qsort(s->wlspill, s->nwlspill, sizeof s->wlspill[0], loccmp);
for (i = 0; i < s->nwlspill; i++) {
if (!bshas(s->shouldspill, s->wlspill[i]->reg.id))
continue;
--- a/libstd/syscall+plan9-x64.s
+++ b/libstd/syscall+plan9-x64.s
@@ -10,39 +10,24 @@
and we have 256 bytes of gap if we get a note.
*/
TEXT sys$syscall+0(SB),1,$0
- MOVQ BX,-16(SP)
- MOVQ CX,-24(SP)
- MOVQ DX,-32(SP)
- MOVQ SI,-40(SP)
- MOVQ DI,-48(SP)
+ MOVQ R11,-16(SP)
+ MOVQ R12,-24(SP)
+ MOVQ R13,-32(SP)
+ MOVQ R14,-40(SP)
+ MOVQ R15,-48(SP)
MOVQ BP,-56(SP)
- MOVQ R8,-64(SP)
- MOVQ R9,-72(SP)
- MOVQ R10,-80(SP)
- MOVQ R11,-88(SP)
- MOVQ R12,-104(SP)
- MOVQ R13,-112(SP)
- MOVQ R14,-120(SP)
- MOVQ R15,-128(SP)
MOVQ 8(SP),RARG
- ADDQ $16,SP
+ ADDQ $8,SP
+ MOVQ DI, RARG
SYSCALL
+ SUBQ $8,SP
- SUBQ $16,SP
- MOVQ -16(SP),BX
- MOVQ -24(SP),CX
- MOVQ -32(SP),DX
- MOVQ -40(SP),SI
- MOVQ -48(SP),DI
+ MOVQ -16(SP),R11
+ MOVQ -24(SP),R12
+ MOVQ -32(SP),R13
+ MOVQ -40(SP),R14
+ MOVQ -48(SP),R15
MOVQ -56(SP),BP
- MOVQ -64(SP),R8
- MOVQ -72(SP),R9
- MOVQ -80(SP),R10
- MOVQ -88(SP),R11
- MOVQ -104(SP),R12
- MOVQ -112(SP),R13
- MOVQ -120(SP),R14
- MOVQ -128(SP),R15
RET
--- a/libstd/util+plan9-x64.s
+++ b/libstd/util+plan9-x64.s
@@ -46,27 +46,15 @@
TEXT sys$alloca+0(SB),$0
/* save registers */
- MOVQ SP,AX
- SUBQ $32,SP
- MOVQ BP,-8(AX)
- MOVQ R15,-16(AX)
- MOVQ BX,-24(AX)
- MOVQ AX,BP
+ MOVQ (SP),R10 /* ret addr */
- MOVQ (BP),R15 /* ret addr */
- MOVQ 8(BP),BX /* len */
-
/* get stack space */
- SUBQ BX,SP /* get stack space */
+ SUBQ DI,SP /* get stack space */
MOVQ SP,AX /* top of stack (return value) */
- SUBQ $32,SP /* "unpop" the args, and make room for ret addr */
ANDQ $(~15),SP /* align */
+ SUBQ $32,SP /* "unpop" the args, and make room for ret addr */
- MOVQ R15,0(SP) /* place ret addr */
- /* restore registers */
- MOVQ -16(BP),R15
- MOVQ -24(SP),BX
- MOVQ -8(BP),BP
+ MOVQ R10,(SP) /* place ret addr */
RET
GLOBL sys$tosptr+0(SB),$8
--- a/mbld/opts.myr
+++ b/mbld/opts.myr
@@ -42,11 +42,6 @@
var opt_ar = "ar"
var opt_genasm = false
-/* derived */
-var sysarchstr = ""
-var archstr = ""
-var sysstr = ""
-
const initopts = {
var si
@@ -75,9 +70,5 @@
if opt_runtime.len == 0
opt_runtime = std.pathjoin([opt_instroot, config.Libpath, config.Runtime][:])
;;
-
- sysarchstr = std.fmt("+{}-{}", opt_sys, opt_arch)
- sysstr = std.fmt("+{}", opt_sys)
- archstr = std.fmt("+{}", opt_arch)
}
--- a/mbld/parse.myr
+++ b/mbld/parse.myr
@@ -337,9 +337,9 @@
failparse(p, "expected '=' after '{} {}'\n", targ, name)
;;
+ fsel = mksyssel(p.fname, p.line, name)
match inputlist(p)
| `std.Some (wl, libs):
- fsel = mksyssel(p.fname, p.line, targ)
libdeps = libs
for w in wl
sysseladd(fsel, w)
--- a/mk/bootstrap/bootstrap+Plan9-amd64.sh
+++ b/mk/bootstrap/bootstrap+Plan9-amd64.sh
@@ -96,7 +96,7 @@
echo ../6/6.out -I ../libregex -I ../libbio -I ../libstd types.myr ; ../6/6.out -I ../libregex -I ../libbio -I ../libstd types.myr
echo ../6/6.out -I ../libregex -I ../libbio -I ../libstd util.myr ; ../6/6.out -I ../libregex -I ../libbio -I ../libstd util.myr
echo ../6/6.out -I ../libregex -I ../libbio -I ../libstd deps.myr ; ../6/6.out -I ../libregex -I ../libbio -I ../libstd deps.myr
-echo ../6/6.out -I ../libregex -I ../libbio -I ../libstd fsel.myr ; ../6/6.out -I ../libregex -I ../libbio -I ../libstd fsel.myr
+echo ../6/6.out -I ../libregex -I ../libbio -I ../libstd syssel.myr ; ../6/6.out -I ../libregex -I ../libbio -I ../libstd syssel.myr
echo ../6/6.out -I ../libregex -I ../libbio -I ../libstd parse.myr ; ../6/6.out -I ../libregex -I ../libbio -I ../libstd parse.myr
echo ../6/6.out -I ../libregex -I ../libbio -I ../libstd build.myr ; ../6/6.out -I ../libregex -I ../libbio -I ../libstd build.myr
echo ../6/6.out -I ../libregex -I ../libbio -I ../libstd install.myr ; ../6/6.out -I ../libregex -I ../libbio -I ../libstd install.myr
@@ -103,7 +103,7 @@
echo ../6/6.out -I ../libregex -I ../libbio -I ../libstd clean.myr ; ../6/6.out -I ../libregex -I ../libbio -I ../libstd clean.myr
echo ../6/6.out -I ../libregex -I ../libbio -I ../libstd test.myr ; ../6/6.out -I ../libregex -I ../libbio -I ../libstd test.myr
echo ../6/6.out -I ../libregex -I ../libbio -I ../libstd main.myr ; ../6/6.out -I ../libregex -I ../libbio -I ../libstd main.myr
-echo 6l -lo mbld ../rt/_myrrt.6 clean.6 types.6 deps.6 fsel.6 util.6 parse.6 main.6 build.6 opts.6 config.6 install.6 test.6 ../libregex/libregex.a ../libbio/libbio.a ../libstd/libstd.a ../libstd/libsys.a ; 6l -lo mbld ../rt/_myrrt.6 clean.6 types.6 deps.6 fsel.6 util.6 parse.6 main.6 build.6 opts.6 config.6 install.6 test.6 ../libregex/libregex.a ../libbio/libbio.a ../libstd/libstd.a ../libstd/libsys.a
+echo 6l -lo mbld ../rt/_myrrt.6 clean.6 types.6 deps.6 syssel.6 util.6 parse.6 main.6 build.6 opts.6 config.6 install.6 test.6 ../libregex/libregex.a ../libbio/libbio.a ../libstd/libstd.a ../libstd/libsys.a ; 6l -lo mbld ../rt/_myrrt.6 clean.6 types.6 deps.6 syssel.6 util.6 parse.6 main.6 build.6 opts.6 config.6 install.6 test.6 ../libregex/libregex.a ../libbio/libbio.a ../libstd/libstd.a ../libstd/libsys.a
echo cd $pwd; cd $pwd
echo cd $pwd/libregex; cd $pwd/libregex
echo ../6/6.out -I . -I ../libbio -I ../libstd redump.myr ; ../6/6.out -I . -I ../libbio -I ../libstd redump.myr