summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--6/genp9.c10
-rwxr-xr-xconfigure3
-rw-r--r--libstd/alloc.myr2
-rw-r--r--myrbuild/myrbuild.c14
4 files changed, 16 insertions, 13 deletions
diff --git a/6/genp9.c b/6/genp9.c
index d775333..3d3ffe2 100644
--- a/6/genp9.c
+++ b/6/genp9.c
@@ -242,8 +242,8 @@ static size_t writebytes(FILE *fd, char *name, size_t off, char *p, size_t sz)
{
size_t i, len;
- if (sz == 0)
- fprintf(fd, "DATA %s<>+%zd(SB)/0,$\"\"\n", name, off, sz);
+ if (sz == 0)
+ fprintf(fd, "DATA %s<>+%zd(SB)/%zd,$\"\"\n", name, off, sz);
for (i = 0; i < sz; i++) {
len = min(sz - i, 8);
if (i % 8 == 0)
@@ -419,14 +419,16 @@ static size_t writeblob(FILE *fd, char *name, size_t off, Htab *globls, Htab *st
static void genstrings(FILE *fd, Htab *strtab)
{
void **k;
+ char *lbl;
Str *s;
size_t i, nk;
k = htkeys(strtab, &nk);
for (i = 0; i < nk; i++) {
s = k[i];
- fprintf(fd, "GLOBL %s<>+0(SB),$%lld\n", htget(strtab, k[i]), (vlong)s->len);
- writebytes(fd, htget(strtab, k[i]), 0, s->buf, s->len);
+ lbl = htget(strtab, k[i]);
+ fprintf(fd, "GLOBL %s<>+0(SB),$%lld\n", lbl, (vlong)s->len);
+ writebytes(fd, lbl, 0, s->buf, s->len);
}
}
diff --git a/configure b/configure
index f6f509f..d8f61f3 100755
--- a/configure
+++ b/configure
@@ -36,7 +36,8 @@ echo export INST_ROOT=$prefix > config.mk
echo '#define Instroot "'$prefix'"' > config.h
echo '#define Asmcmd {"as", "-g", "-o", NULL}' >> config.h
-echo '#define Linkcmd {"ar", "-rcs", NULL}' >> config.h
+echo '#define Arcmd {"ar", "-rcs", NULL}' >> config.h
+echo '#define Ldcmd {"ld", "-o", NULL}' >> config.h
echo '#define Defaultasm Gnugas' >> config.h
echo 'export SYSCLASS=posixy' >> config.mk
case $OS in
diff --git a/libstd/alloc.myr b/libstd/alloc.myr
index 4fd826c..e65ca98 100644
--- a/libstd/alloc.myr
+++ b/libstd/alloc.myr
@@ -138,7 +138,7 @@ const checkhdr = {p
addr = p castto(size)
addr -= align(sizeof(slheader), Align)
phdr = addr castto(slheader#)
- assert(phdr.magic == (0xdeadbeef2badf00d castto(size)), "corrupt memory\n")
+ assert(phdr.magic == (0xdeadbeefbadf00d castto(size)), "corrupt memory\n")
}
/* Frees a slice */
diff --git a/myrbuild/myrbuild.c b/myrbuild/myrbuild.c
index 668c48d..dd1e501 100644
--- a/myrbuild/myrbuild.c
+++ b/myrbuild/myrbuild.c
@@ -25,10 +25,10 @@ int genasm = 0;
/* binaries we call out to */
char *mc = "6m";
-char *as[] = Asmcmd;
-char *ar[] = Linkcmd;
-char *ld = "ld";
char *muse = "muse";
+char *as[] = Asmcmd;
+char *ar[] = Arcmd;
+char *ld[] = Ldcmd;
char *runtime = Instroot "/lib/myr/_myrrt.o";
/* the name of the output file */
char *libname;
@@ -431,8 +431,8 @@ void linkobj(char **files, size_t nfiles)
nargs = 0;
/* ld -T ldscript -o outfile */
- lappend(&args, &nargs, strdup(ld));
- lappend(&args, &nargs, strdup("-o"));
+ for (i = 0; ld[i]; i++)
+ lappend(&args, &nargs, strdup(ld[i]));
lappend(&args, &nargs, strdup(binname));
/* ld -T ldscript */
@@ -502,9 +502,9 @@ int main(int argc, char **argv)
case 's': ldscript = ctx.optarg; break;
case 'S': genasm = 1; break;
case 'C': mc = ctx.optarg; break;
- case 'A': as[0] = ctx.optarg; break;
case 'M': muse = ctx.optarg; break;
- case 'L': ld = ctx.optarg; break;
+ case 'A': as[0] = ctx.optarg; break;
+ case 'L': ld[0] = ctx.optarg; break;
case 'R': ar[0] = ctx.optarg; break;
case 'r':
if (!strcmp(ctx.optarg, "none"))