ref: 0556b63c0c444d2d77b270c7d51beb7e94f0d30a
parent: 16c6e1242f50320bf8531e979bcb75ecfe88f9b5
author: Ori Bernstein <[email protected]>
date: Tue Nov 6 16:14:09 EST 2018
Create the output directory when assembling. Easier to bootstrap.
--- a/6/main.c
+++ b/6/main.c
@@ -70,8 +70,8 @@
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 @@
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 @@
}
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);
--- a/lib/thread/bld.sub
+++ b/lib/thread/bld.sub
@@ -66,6 +66,8 @@
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
--- a/rt/_myrrt-plan9.s
+++ b/rt/_myrrt-plan9.s
@@ -37,12 +37,8 @@
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 @@
GLOBL argv0(SB), $8
GLOBL sys$tosptr(SB), $8
-GLOBL _privates(SB), $8
-GLOBL _nprivates(SB), $4