Update from trunk.

--HG--
branch : dtrg-videocore
This commit is contained in:
David Given 2013-05-29 15:03:48 +01:00
commit d3e3e72860
11 changed files with 47 additions and 24 deletions

8
README
View file

@ -46,6 +46,10 @@ Requirements:
- an ANSI C compiler. This defaults to gcc. You can change this by setting - an ANSI C compiler. This defaults to gcc. You can change this by setting
the CC make variable. the CC make variable.
- flex and yacc.
- GNU make.
- about 40MB free in /tmp (or some other temporary directory). - about 40MB free in /tmp (or some other temporary directory).
- about 6MB in the target directory. - about 6MB in the target directory.
@ -58,14 +62,14 @@ Instructions:
- Run: - Run:
make make # or gmake
...from the command line. This will do the build. ...from the command line. This will do the build.
The make system is fully parallelisable. If you have a multicore system, The make system is fully parallelisable. If you have a multicore system,
you probably want to do: you probably want to do:
make -j8 make -j8 # or gmake -j8
...instead (substituting the right number of cores, of course). You can ...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. also shave a few seconds of the build time by using the -r flag.

View file

@ -101,13 +101,19 @@ struct outname {
/* /*
* structure format strings * 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_HEAD "22222244"
#define SF_SECT "44444" #define SF_SECT "44444"
#define SF_RELO "1124" #define SF_RELO "1124"
#define SF_NAME "4224" #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_HEAD 20
#define SZ_SECT 20 #define SZ_SECT 20

View file

@ -6,6 +6,7 @@
/* PARSER ERROR ADMINISTRATION */ /* PARSER ERROR ADMINISTRATION */
#include <alloc.h> #include <alloc.h>
#include "idf.h"
#include "arith.h" #include "arith.h"
#include "LLlex.h" #include "LLlex.h"
#include "Lpars.h" #include "Lpars.h"

View file

@ -11,6 +11,7 @@
#include <alloc.h> #include <alloc.h>
#include "class.h" #include "class.h"
#include "macro.h" #include "macro.h"
#include "idf.h"
#include "arith.h" #include "arith.h"
#include "sizes.h" #include "sizes.h"
#include "align.h" #include "align.h"

View file

@ -26,9 +26,9 @@ item_t keytab[] = {
0, EXTERN, 0, ".define", 0, EXTERN, 0, ".define",
0, EXTERN, 0, ".extern", 0, EXTERN, 0, ".extern",
0, DOT, 0, ".", 0, DOT, 0, ".",
0, DATA, 1, ".data1", 0, DATA, RELO1, ".data1",
0, DATA, 2, ".data2", 0, DATA, RELO2, ".data2",
0, DATA, 4, ".data4", 0, DATA, RELO4, ".data4",
0, ASCII, 0, ".ascii", 0, ASCII, 0, ".ascii",
0, ASCII, 1, ".asciz", 0, ASCII, 1, ".asciz",
0, ALIGN, 0, ".align", 0, ALIGN, 0, ".align",

View file

@ -293,16 +293,16 @@ valu_t val;
int n; int n;
{ {
switch (n) { switch (n) {
case 1: case RELO1:
emit1((int)val); break; emit1((int)val); break;
case 2: case RELO2:
#ifdef BYTES_REVERSED #ifdef BYTES_REVERSED
emit1(((int)val>>8)); emit1((int)val); emit1(((int)val>>8)); emit1((int)val);
#else #else
emit1((int)val); emit1(((int)val>>8)); emit1((int)val); emit1(((int)val>>8));
#endif #endif
break; break;
case 4: case RELO4:
#ifdef WORDS_REVERSED #ifdef WORDS_REVERSED
emit2((int)(val>>16)); emit2((int)(val)); emit2((int)(val>>16)); emit2((int)(val));
#else #else

View file

@ -5,9 +5,13 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h>
#include "libsys.h" #include "libsys.h"
int brk(void* end) 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;
} }

View file

@ -1,32 +1,39 @@
/* $Source: /cvsroot/tack/Ack/plat/linux386/libsys/sbrk.c,v $ /* $Source$
* $State: Exp $ * $State$
* $Revision: 1.1 $ * $Revision$
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h>
#include "libsys.h" #include "libsys.h"
#define OUT_OF_MEMORY (void*)(-1) /* sbrk returns this on failure */ #define OUT_OF_MEMORY (void*)(-1) /* sbrk returns this on failure */
extern char _end[1]; static char* current = NULL;
static char* current = _end;
void* sbrk(intptr_t increment) void* sbrk(intptr_t increment)
{ {
char* old; char* old;
char* new; char* new;
char* actual;
if (!current)
current = (char*) _syscall(__NR_brk, 0, 0, 0);
if (increment == 0) if (increment == 0)
return current; return current;
old = current; old = current;
new = old + increment; 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; return OUT_OF_MEMORY;
}
current = new; current = actual;
return old; return old;
} }

View file

@ -45,9 +45,9 @@ $(eval CLEANABLES += $o $1/Lpars.h)
$o: $1/Lpars.h $o: $1/Lpars.h
$1/Lpars.h: $2 $(LLGEN) $1/Lpars.h: $2 $(LLGEN)
@echo LLGEN $1/Lpars.c @echo LLGEN $1/Lpars.c
@mkdir -p $(dir $o) @mkdir -p $1
$(hide) $(RM) $o $1/Lpars.h $(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)) $(foreach f,$o,$(call cfile,$f))

View file

@ -5,8 +5,8 @@ $(eval g := $(OBJDIR)/$D/dmach.c $(OBJDIR)/$D/intable.c)
$(wordlist 2, $(words $g), $g): $(firstword $g) $(wordlist 2, $(words $g), $g): $(firstword $g)
$(firstword $g): $(util-ack-mktables) $(firstword $g): $(util-ack-mktables)
@echo MKTABLES @echo MKTABLES
@mkdir -p $(dir $g) @mkdir -p $(OBJDIR)/$D
$(hide) cd $(dir $g) && $(util-ack-mktables) $(INSDIR)/share $(hide) cd $(OBJDIR)/$D && $(util-ack-mktables) $(INSDIR)/share
$(eval CLEANABLES += $g) $(eval CLEANABLES += $g)
endef endef

View file

@ -70,7 +70,7 @@ show(headp)
/* /*
* We get all struct outname's and the strings in core first. * 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); string = myalloc((unsigned) headp->oh_nchar);
rd_name(name, headp->oh_nname); rd_name(name, headp->oh_nname);
for (np = &name[0]; np < &name[headp->oh_nname]; np++) { for (np = &name[0]; np < &name[headp->oh_nname]; np++) {