ref: 99cfcabc52f10877bbeb3bcdbb1cded0cb3cd9a7
parent: 314c3c94556aa09b38282a450783db776e92b4e4
author: Ori Bernstein <[email protected]>
date: Wed Dec 24 15:49:36 EST 2014
Make myrbuild a tad friendlier to plan9.
--- a/6/genp9.c
+++ b/6/genp9.c
@@ -242,8 +242,8 @@
{
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,6 +419,7 @@
static void genstrings(FILE *fd, Htab *strtab)
{
void **k;
+ char *lbl;
Str *s;
size_t i, nk;
@@ -425,8 +426,9 @@
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);
}
}
--- a/configure
+++ b/configure
@@ -36,7 +36,8 @@
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
--- a/libstd/alloc.myr
+++ b/libstd/alloc.myr
@@ -138,7 +138,7 @@
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 */
--- a/myrbuild/myrbuild.c
+++ b/myrbuild/myrbuild.c
@@ -25,10 +25,10 @@
/* 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 @@
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 @@
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"))