summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2018-11-06 21:14:09 -0800
committerOri Bernstein <ori@eigenstate.org>2018-11-06 21:14:09 -0800
commit0556b63c0c444d2d77b270c7d51beb7e94f0d30a (patch)
tree38a687d669e54b7d783cee0f7a317653ab9fbfe3
parent16c6e1242f50320bf8531e979bcb75ecfe88f9b5 (diff)
downloadmc-0556b63c0c444d2d77b270c7d51beb7e94f0d30a.tar.gz
Create the output directory when assembling.
Easier to bootstrap.
-rw-r--r--6/main.c13
-rw-r--r--lib/thread/bld.sub2
-rw-r--r--rt/_myrrt-plan9.s8
3 files changed, 13 insertions, 10 deletions
diff --git a/6/main.c b/6/main.c
index b770222..e699f3f 100644
--- a/6/main.c
+++ b/6/main.c
@@ -70,8 +70,8 @@ static void
assemble(char *asmsrc, char *path)
{
char *asmcmd[] = Asmcmd;
- char objfile[1024];
- char *psuffix;
+ char objfile[256], dirpath[256];
+ char *psuffix, *e;
char **p, **cmd;
size_t ncmd, i;
int pid, status;
@@ -88,6 +88,13 @@ assemble(char *asmsrc, char *path)
else
swapsuffix(objfile + i, sizeof objfile - i, path, ".myr", Objsuffix);
}
+ e = objfile;
+ while ((e = strstr(e, "/")) != NULL) {
+ memcpy(dirpath, objfile, (e - objfile));
+ mkdir(dirpath, 0755);
+ e++;
+ }
+
cmd = NULL;
ncmd = 0;
for (p = asmcmd; *p != NULL; p++)
@@ -184,7 +191,7 @@ genuse(char *path)
}
f = fopen(buf, "w");
if (!f) {
- fprintf(stderr, "Could not open path %s\n", buf);
+ fprintf(stderr, "could not open path %s\n", buf);
exit(1);
}
writeuse(f, file);
diff --git a/lib/thread/bld.sub b/lib/thread/bld.sub
index 5cc94a1..598984c 100644
--- a/lib/thread/bld.sub
+++ b/lib/thread/bld.sub
@@ -66,6 +66,8 @@ lib thread =
ncpu+plan9.myr
sem+plan9.myr
spawn+plan9.myr
+ tls+plan9.myr
+ types+plan9.myr
# openbsd impl of thread primitives
condvar+openbsd:6.2.myr
diff --git a/rt/_myrrt-plan9.s b/rt/_myrrt-plan9.s
index e52e160..9e2a08e 100644
--- a/rt/_myrrt-plan9.s
+++ b/rt/_myrrt-plan9.s
@@ -37,12 +37,8 @@ TEXT cvt(SB),$0
RET
-TEXT _main(SB), 1, $(2*8+NPRIVATES*8)
+TEXT _main(SB), 1, $(72+NPRIVATES*8)
MOVQ AX, sys$tosptr(SB)
- LEAQ 16(SP), AX
- MOVQ AX, _privates(SB)
- MOVL $NPRIVATES, _nprivates(SB)
-
MOVL inargc-8(FP), R13
LEAQ inargv+0(FP), R14
MOVQ R13, AX
@@ -78,5 +74,3 @@ broke:
GLOBL argv0(SB), $8
GLOBL sys$tosptr(SB), $8
-GLOBL _privates(SB), $8
-GLOBL _nprivates(SB), $4