Commits

dtrg committed dacb9bc Merge

Update from trunk.

Comments (0)

Files changed (11)

 - 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.
 
 - 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.
 /*
  * 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

lang/cem/cemcom.ansi/LLmessage.c

 /*		PARSER ERROR ADMINISTRATION		*/
 
 #include	<alloc.h>
+#include	"idf.h"
 #include	"arith.h"
 #include	"LLlex.h"
 #include	"Lpars.h"

lang/cem/cemcom.ansi/options.c

 #include	<alloc.h>
 #include	"class.h"
 #include	"macro.h"
+#include	"idf.h"
 #include	"arith.h"
 #include	"sizes.h"
 #include	"align.h"

mach/proto/as/comm3.c

 	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",

mach/proto/as/comm7.c

 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

plat/linux/liblinux/brk.c

 
 #include <stdlib.h>
 #include <unistd.h>
+#include <errno.h>
 #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;
 }

plat/linux/liblinux/sbrk.c

-/* $Source: /cvsroot/tack/Ack/plat/linux386/libsys/sbrk.c,v $
- * $State: Exp $
- * $Revision: 1.1 $
+/* $Source$
+ * $State$
+ * $Revision$
  */
 
 #include <stdlib.h>
-#include <stdio.h>
 #include <unistd.h>
+#include <errno.h>
 #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;
 }

util/LLgen/build.mk

 $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))
 

util/ack/build.mk

 $(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

util/amisc/ashow.c

 	/*
 	 * 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++) {