diff --git a/README b/README index 52abe73be..74ca13b55 100644 --- a/README +++ b/README @@ -46,6 +46,10 @@ Requirements: - an ANSI C compiler. This defaults to gcc. You can change this by setting the CC make variable. +- flex and yacc. + +- GNU make. + - about 40MB free in /tmp (or some other temporary directory). - about 6MB in the target directory. @@ -58,14 +62,14 @@ Instructions: - Run: - make + make # or gmake ...from the command line. This will do the build. The make system is fully parallelisable. If you have a multicore system, you probably want to do: - make -j8 + make -j8 # or gmake -j8 ...instead (substituting the right number of cores, of course). You can also shave a few seconds of the build time by using the -r flag. diff --git a/h/out.h b/h/out.h index 2c97219e5..cf6ef7776 100644 --- a/h/out.h +++ b/h/out.h @@ -101,13 +101,19 @@ struct outname { /* * structure format strings */ +#if 0 +/* The following strings only make sense on 32-bit platforms, so we're going + * to try and deprecate them. */ #define SF_HEAD "22222244" #define SF_SECT "44444" #define SF_RELO "1124" #define SF_NAME "4224" +#endif /* - * structure sizes (bytes in file; add digits in SF_*) + * structure sizes on disk (bytes in file; add digits in SF_*) + * Note! These are NOT the sizes in memory (64-bit architectures will have + * a different layout). */ #define SZ_HEAD 20 #define SZ_SECT 20 diff --git a/lang/cem/cemcom.ansi/LLmessage.c b/lang/cem/cemcom.ansi/LLmessage.c index 9010ce45d..c88c5eb24 100644 --- a/lang/cem/cemcom.ansi/LLmessage.c +++ b/lang/cem/cemcom.ansi/LLmessage.c @@ -6,6 +6,7 @@ /* PARSER ERROR ADMINISTRATION */ #include +#include "idf.h" #include "arith.h" #include "LLlex.h" #include "Lpars.h" diff --git a/lang/cem/cemcom.ansi/options.c b/lang/cem/cemcom.ansi/options.c index a8f382302..a23ff3405 100644 --- a/lang/cem/cemcom.ansi/options.c +++ b/lang/cem/cemcom.ansi/options.c @@ -11,6 +11,7 @@ #include #include "class.h" #include "macro.h" +#include "idf.h" #include "arith.h" #include "sizes.h" #include "align.h" diff --git a/mach/proto/as/comm3.c b/mach/proto/as/comm3.c index a5490e249..f35d1818c 100644 --- a/mach/proto/as/comm3.c +++ b/mach/proto/as/comm3.c @@ -26,9 +26,9 @@ item_t keytab[] = { 0, EXTERN, 0, ".define", 0, EXTERN, 0, ".extern", 0, DOT, 0, ".", - 0, DATA, 1, ".data1", - 0, DATA, 2, ".data2", - 0, DATA, 4, ".data4", + 0, DATA, RELO1, ".data1", + 0, DATA, RELO2, ".data2", + 0, DATA, RELO4, ".data4", 0, ASCII, 0, ".ascii", 0, ASCII, 1, ".asciz", 0, ALIGN, 0, ".align", diff --git a/mach/proto/as/comm7.c b/mach/proto/as/comm7.c index fbbe42392..d0a147bdb 100644 --- a/mach/proto/as/comm7.c +++ b/mach/proto/as/comm7.c @@ -293,16 +293,16 @@ valu_t val; int n; { switch (n) { - case 1: + case RELO1: emit1((int)val); break; - case 2: + case RELO2: #ifdef BYTES_REVERSED emit1(((int)val>>8)); emit1((int)val); #else emit1((int)val); emit1(((int)val>>8)); #endif break; - case 4: + case RELO4: #ifdef WORDS_REVERSED emit2((int)(val>>16)); emit2((int)(val)); #else diff --git a/plat/linux/liblinux/brk.c b/plat/linux/liblinux/brk.c index 8bb53d31d..7ce5c5fc8 100644 --- a/plat/linux/liblinux/brk.c +++ b/plat/linux/liblinux/brk.c @@ -5,9 +5,13 @@ #include #include +#include #include "libsys.h" int brk(void* end) { - return _syscall(__NR_brk, (quad) end, 0, 0); + int e = _syscall(__NR_brk, (quad) end, 0, 0); + if (e == -1) + errno = ENOMEM; + return e; } diff --git a/plat/linux/liblinux/sbrk.c b/plat/linux/liblinux/sbrk.c index 17b273f42..35810ef89 100644 --- a/plat/linux/liblinux/sbrk.c +++ b/plat/linux/liblinux/sbrk.c @@ -1,32 +1,39 @@ -/* $Source: /cvsroot/tack/Ack/plat/linux386/libsys/sbrk.c,v $ - * $State: Exp $ - * $Revision: 1.1 $ +/* $Source$ + * $State$ + * $Revision$ */ #include -#include #include +#include #include "libsys.h" #define OUT_OF_MEMORY (void*)(-1) /* sbrk returns this on failure */ -extern char _end[1]; - -static char* current = _end; +static char* current = NULL; void* sbrk(intptr_t increment) { char* old; char* new; + char* actual; + + if (!current) + current = (char*) _syscall(__NR_brk, 0, 0, 0); if (increment == 0) return current; old = current; new = old + increment; - if (brk(new) < 0) + + actual = (char*) _syscall(__NR_brk, (quad) new, 0, 0); + if (actual < new) + { + errno = ENOMEM; return OUT_OF_MEMORY; + } - current = new; + current = actual; return old; } diff --git a/util/LLgen/build.mk b/util/LLgen/build.mk index 3c40d1886..28da2d715 100644 --- a/util/LLgen/build.mk +++ b/util/LLgen/build.mk @@ -45,9 +45,9 @@ $(eval CLEANABLES += $o $1/Lpars.h) $o: $1/Lpars.h $1/Lpars.h: $2 $(LLGEN) @echo LLGEN $1/Lpars.c - @mkdir -p $(dir $o) + @mkdir -p $1 $(hide) $(RM) $o $1/Lpars.h - $(hide) cd $(dir $o) && $(LLGEN) $(abspath $2) + $(hide) cd $1 && $(LLGEN) $(abspath $2) $(foreach f,$o,$(call cfile,$f)) diff --git a/util/ack/build.mk b/util/ack/build.mk index 1b4fc146c..36e505c12 100644 --- a/util/ack/build.mk +++ b/util/ack/build.mk @@ -5,8 +5,8 @@ $(eval g := $(OBJDIR)/$D/dmach.c $(OBJDIR)/$D/intable.c) $(wordlist 2, $(words $g), $g): $(firstword $g) $(firstword $g): $(util-ack-mktables) @echo MKTABLES - @mkdir -p $(dir $g) - $(hide) cd $(dir $g) && $(util-ack-mktables) $(INSDIR)/share + @mkdir -p $(OBJDIR)/$D + $(hide) cd $(OBJDIR)/$D && $(util-ack-mktables) $(INSDIR)/share $(eval CLEANABLES += $g) endef diff --git a/util/amisc/ashow.c b/util/amisc/ashow.c index 67e785ecc..b11e60e76 100644 --- a/util/amisc/ashow.c +++ b/util/amisc/ashow.c @@ -70,7 +70,7 @@ show(headp) /* * We get all struct outname's and the strings in core first. */ - name = (struct outname *) myalloc(headp->oh_nname * SZ_NAME); + name = (struct outname *) myalloc(headp->oh_nname * sizeof(struct outname)); string = myalloc((unsigned) headp->oh_nchar); rd_name(name, headp->oh_nname); for (np = &name[0]; np < &name[headp->oh_nname]; np++) {