Merge updates from trunk.

--HG--
branch : dtrg-buildsystem
This commit is contained in:
David Given 2013-05-13 12:37:27 +01:00
commit 81778b603f
22 changed files with 75 additions and 55 deletions

View file

@ -63,7 +63,7 @@ include plat/pc86/build.mk
include plat/cpm/build.mk include plat/cpm/build.mk
include plat/linux386/build.mk include plat/linux386/build.mk
include plat/linux68k/build.mk include plat/linux68k/build.mk
include plat/linuxppc/build.mk # include plat/linuxppc/build.mk
.PHONY: installables .PHONY: installables
installables: $(INSTALLABLES) installables: $(INSTALLABLES)

View file

@ -39,7 +39,6 @@
#define DO_TOSTACK 23 #define DO_TOSTACK 23
#define DO_KILLREG 24 #define DO_KILLREG 24
#define DO_LABDEF 25 #define DO_LABDEF 25
#define DO_STACKADJUST 26
#ifndef MAXATT #ifndef MAXATT
#define MAXATT TOKENSIZE #define MAXATT TOKENSIZE
@ -134,7 +133,6 @@ typedef struct exprnode *node_p;
#define EX_ISROM 44 #define EX_ISROM 44
#define EX_TOPELTSIZE 45 #define EX_TOPELTSIZE 45
#define EX_FALLTHROUGH 46 #define EX_FALLTHROUGH 46
#define EX_STACKOFFSET 47
typedef struct { /* to stack coercions */ typedef struct { /* to stack coercions */

View file

@ -59,7 +59,9 @@ name led
(.ocm:{TAIL}={PLATFORMDIR}/liboccam.a) \ (.ocm:{TAIL}={PLATFORMDIR}/liboccam.a) \
(.ocm.b.mod.c.p:{TAIL}={PLATFORMDIR}/libc.a) \ (.ocm.b.mod.c.p:{TAIL}={PLATFORMDIR}/libc.a) \
{FLOATS?} \ {FLOATS?} \
(.e:{TAIL}={PLATFORMDIR}/libem.a \ (.e:{TAIL}={PLATFORMDIR}/liblinux.a \
{PLATFORMDIR}/libem.a \
{PLATFORMDIR}/liblinux.a \
{PLATFORMDIR}/libsys.a \ {PLATFORMDIR}/libsys.a \
{PLATFORMDIR}/libend.a) {PLATFORMDIR}/libend.a)
linker linker

View file

@ -5,6 +5,7 @@
local d = ROOTDIR.."plat/linux386/" local d = ROOTDIR.."plat/linux386/"
include (d.."libsys/pmfile") include (d.."libsys/pmfile")
include "plat/linux/liblinux/pmfile"
local bootsector = ackfile { local bootsector = ackfile {
file (d.."boot.s"), file (d.."boot.s"),
@ -41,6 +42,7 @@ platform_linux386 = group {
-- Build the PC standalone syscall library. -- Build the PC standalone syscall library.
liblinux,
libsys_linux386, libsys_linux386,
bootsector, bootsector,
} }

View file

@ -69,6 +69,6 @@ name cv
from .out from .out
to .exe to .exe
program {EM}/bin/aelflod program {EM}/bin/aelflod
args 4 1 < > args -m4 -b < >
outfile linux68k.exe outfile linux68k.exe
end end

View file

@ -76,6 +76,6 @@ name cv
from .out from .out
to .exe to .exe
program {EM}/bin/aelflod program {EM}/bin/aelflod
args 20 1 < > args -m20 -b < >
outfile linuxppc.exe outfile linuxppc.exe
end end

2
pmfile
View file

@ -186,7 +186,7 @@ default = group {
platform_pc86, platform_pc86,
platform_linux386, platform_linux386,
platform_linuxppc, -- platform_linuxppc,
platform_linux68k, platform_linux68k,
platform_cpm, platform_cpm,
} }

View file

@ -32,7 +32,8 @@
/* Global settings. */ /* Global settings. */
int bigendian = 0; int bigendian = 0;
int elfmachine; int elfabi = 3; /* abi = Linux */
int elfmachine = 3; /* machine = EM_386 */
/* Header and section table of an ack object file. */ /* Header and section table of an ack object file. */
@ -116,7 +117,7 @@ int follows(struct outsect* pa, struct outsect* pb)
{ {
/* return 1 if pa follows pb */ /* return 1 if pa follows pb */
return (pa->os_base == align(pb->os_base+pb->os_size, pa->os_lign)); return (pa->os_base >= align(pb->os_base+pb->os_size, pa->os_lign));
} }
/* Writes a byte. */ /* Writes a byte. */
@ -276,11 +277,27 @@ int main(int argc, char* argv[])
{ {
switch (argv[1][1]) switch (argv[1][1])
{ {
case 'a':
elfabi = atoi(&argv[1][2]);
break;
case 'b':
bigendian = 1;
break;
case 'h': case 'h':
fprintf(stderr, "%s: Syntax: aelflod [-h] <inputfile> <outputfile>\n", fprintf(stderr, "%s: Syntax: aelflod [-a<number>] [-b] [-h] [-l]\n\t[-m<number>] <inputfile> <outputfile>\n",
program); program);
exit(0); exit(0);
case 'l':
bigendian = 0;
break;
case 'm':
elfmachine = atoi(&argv[1][2]);
break;
default: default:
syntaxerror: syntaxerror:
fatal("syntax error --- try -h for help"); fatal("syntax error --- try -h for help");
@ -382,13 +399,13 @@ int main(int argc, char* argv[])
emit8(1); /* class = ELFCLASS32 */ emit8(1); /* class = ELFCLASS32 */
emit8(bigendian ? 2 : 1); /* endianness */ emit8(bigendian ? 2 : 1); /* endianness */
emit8(1); /* ELF version */ emit8(1); /* ELF version */
emit8(3); /* ABI = Linux */ emit8(elfabi); /* ABI */
emit8(0); /* ABI version */ emit8(0); /* ABI version */
emit8(0); emit16(0); /* padding... */ emit8(0); emit16(0); /* padding... */
emit32(0); /* ...to offset 0x10 */ emit32(0); /* ...to offset 0x10 */
emit16(2); /* type = ET_EXEC */ emit16(2); /* type = ET_EXEC */
emit16(3); /* machine = EM_386 */ emit16(elfmachine); /* machine */
emit32(1); /* ELF version again */ emit32(1); /* ELF version again */
emit32(outsect[TEXT].os_base); /* entry point */ emit32(outsect[TEXT].os_base); /* entry point */
emit32(ELF_HEADER_SIZE); /* program header offset */ emit32(ELF_HEADER_SIZE); /* program header offset */

View file

@ -1,4 +1,5 @@
#!/bin/sh #!/bin/sh
set -e
em_table=$1 em_table=$1
h=${2-.} h=${2-.}

View file

@ -38,7 +38,7 @@ int Xstackflag=0; /* set in coercions, moves, and tests. %1 means something
*/ */
struct varinfo *gen_inst(),*gen_move(),*gen_test(),*gen_preturn(),*gen_tlab(); struct varinfo *gen_inst(),*gen_move(),*gen_test(),*gen_preturn(),*gen_tlab();
struct varinfo *gen_label(), *gen_stackadjust(), *make_erase(); struct varinfo *gen_label(), *make_erase();
expr_t make_expr(),ident_expr(),subreg_expr(),tokm_expr(),all_expr(); expr_t make_expr(),ident_expr(),subreg_expr(),tokm_expr(),all_expr();
expr_t perc_ident_expr(),sum_expr(),regvar_expr(); expr_t perc_ident_expr(),sum_expr(),regvar_expr();
@ -74,9 +74,9 @@ iocc_t iops[20];
%token TOPELTSIZE FALLTHROUGH LABELDEF %token TOPELTSIZE FALLTHROUGH LABELDEF
%token PROC CALL EXAMPLE %token PROC CALL EXAMPLE
%token FROM TO %token FROM TO
%token TEST MOVE STACK RETURN STACKADJUST %token TEST MOVE STACK RETURN
%token PATTERNS PAT WITH EXACT KILLS USES REUSING GEN YIELDS LEAVING %token PATTERNS PAT WITH EXACT KILLS USES REUSING GEN YIELDS LEAVING
%token DEFINED SAMESIGN SFIT UFIT ROM LOWW HIGHW ISROM STACKOFFSET %token DEFINED SAMESIGN SFIT UFIT ROM LOWW HIGHW ISROM
%token CMPEQ CMPNE CMPLT CMPGT CMPLE CMPGE OR2 AND2 LSHIFT RSHIFT NOT COMP %token CMPEQ CMPNE CMPLT CMPGT CMPLE CMPGE OR2 AND2 LSHIFT RSHIFT NOT COMP
%token INREG REGVAR REG_ANY REG_FLOAT REG_LOOP REG_POINTER %token INREG REGVAR REG_ANY REG_FLOAT REG_LOOP REG_POINTER
%token <yy_int> ADORNACCESS %token <yy_int> ADORNACCESS
@ -635,8 +635,8 @@ coderule
maxempatlen=empatlen; maxempatlen=empatlen;
} }
patterns patterns
{ /* if (!saferulefound) { if (!saferulefound)
error("Previous rule impossible on empty stack"); */ error("Previous rule impossible on empty stack");
outpatterns(); outpatterns();
} }
| PROC IDENT example | PROC IDENT example
@ -849,8 +849,6 @@ gen_instruction
{ $$ = gen_label($2-1); use_tes++; } { $$ = gen_label($2-1); use_tes++; }
| RETURN | RETURN
{ $$ = gen_preturn(); } { $$ = gen_preturn(); }
| STACKADJUST expr
{ $$ = gen_stackadjust($2.ex_index); use_noframepointer++; }
; ;
optstar optstar
: /* empty */ : /* empty */
@ -1030,8 +1028,6 @@ expr
{ $$ = make_expr(TYPINT,EX_LOWW,$3-1,0); } { $$ = make_expr(TYPINT,EX_LOWW,$3-1,0); }
| HIGHW '(' emarg ')' | HIGHW '(' emarg ')'
{ $$ = make_expr(TYPINT,EX_HIGHW,$3-1,0); } { $$ = make_expr(TYPINT,EX_HIGHW,$3-1,0); }
| STACKOFFSET '(' ')'
{ $$ = make_expr(TYPINT,EX_STACKOFFSET, 0, 0); }
/* Excluded, because it causes a shift-reduce conflict /* Excluded, because it causes a shift-reduce conflict
(problems with a tokenset_no followed by an optexpr) (problems with a tokenset_no followed by an optexpr)
| '-' expr %prec UMINUS | '-' expr %prec UMINUS

View file

@ -127,15 +127,6 @@ struct varinfo *gen_preturn() {
return(vp); return(vp);
} }
struct varinfo *gen_stackadjust(int expr) {
register struct varinfo *vp;
NEW(vp,struct varinfo);
vp->vi_int[0] = INSSTACKADJUST;
vp->vi_int[1] = expr;
return(vp);
}
struct varinfo *gen_tlab(n) { struct varinfo *gen_tlab(n) {
register struct varinfo *vp; register struct varinfo *vp;

View file

@ -10,6 +10,7 @@ static char rcsid[]= "$Id$";
#include <string.h> #include <string.h>
#include "param.h" #include "param.h"
#include "expr.h" #include "expr.h"
#include "extern.h"
#include <em_spec.h> #include <em_spec.h>
#include <em_flag.h> #include <em_flag.h>

View file

@ -8,6 +8,8 @@ static char rcsid[]= "$Id$";
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdarg.h>
#include "extern.h"
int nerrors=0; int nerrors=0;
@ -24,24 +26,38 @@ goodbye() {
#endif #endif
} }
/*VARARGS1*/ void errorv(const char* s, va_list ap)
fatal(s,a,b,c,d) char *s; { {
extern int lineno;
extern char *filename;
fprintf(stderr, "\"%s\", line %d:", filename, lineno);
vfprintf(stderr, s, ap);
fprintf(stderr, "\n");
nerrors++;
}
void fatal(const char* s, ...)
{
va_list ap;
va_start(ap, s);
errorv(s, ap);
va_end(ap);
error(s,a,b,c,d);
errorexit(); errorexit();
goodbye(); goodbye();
exit(-1); exit(-1);
} }
/*VARARGS1*/ void error(const char* s, ...)
error(s,a,b,c,d) char *s; { {
extern int lineno; va_list ap;
extern char *filename;
fprintf(stderr,"\"%s\", line %d:",filename,lineno); va_start(ap, s);
fprintf(stderr,s,a,b,c,d); errorv(s, ap);
fprintf(stderr,"\n"); va_end(ap);
nerrors++;
} }
#ifndef NDEBUG #ifndef NDEBUG

View file

@ -37,7 +37,10 @@ extern int regclass;
extern int maxtokensize; extern int maxtokensize;
extern int nprocargs, maxprocargs; extern int nprocargs, maxprocargs;
extern int use_tes; extern int use_tes;
extern int use_noframepointer;
extern char *mystrcpy(); extern char *mystrcpy();
extern char *myalloc(); extern char *myalloc();
extern void error(const char* s, ...);
extern void fatal(const char* s, ...);

View file

@ -9,6 +9,7 @@ static char rcsid[]= "$Id$";
#include "assert.h" #include "assert.h"
#include "param.h" #include "param.h"
#include "set.h" #include "set.h"
#include "extern.h"
#include <stdio.h> #include <stdio.h>
/* /*

View file

@ -43,8 +43,6 @@ reusing REUSING
rom ROM rom ROM
samesign SAMESIGN samesign SAMESIGN
sfit SFIT sfit SFIT
stackadjust STACKADJUST
stackoffset STACKOFFSET
topeltsize TOPELTSIZE topeltsize TOPELTSIZE
test TEST test TEST
to TO to TO

View file

@ -9,6 +9,7 @@ static char rcsid[]= "$Id$";
#include "assert.h" #include "assert.h"
#include "param.h" #include "param.h"
#include "lookup.h" #include "lookup.h"
#include "extern.h"
char *myalloc(); char *myalloc();
char *mystrcpy(); char *mystrcpy();

View file

@ -8,6 +8,7 @@ static char rcsid[]= "$Id$";
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "extern.h"
char *filename; char *filename;
char *beg_sbrk; char *beg_sbrk;

View file

@ -12,8 +12,6 @@ int tabledebug=0; /* do not generate code for table debugging */
#endif #endif
int verbose=0; /* print all statistics */ int verbose=0; /* print all statistics */
int use_tes; /* use top element size information */ int use_tes; /* use top element size information */
int use_noframepointer; /* use stackadjust mechanism to remove requirement
for frame pointer */
char *c_file= "tables.c"; char *c_file= "tables.c";
char *h_file= "tables.H"; char *h_file= "tables.H";
char *cd_file= "code"; char *cd_file= "code";
@ -614,8 +612,6 @@ outdefs() {
cdef("TABLEDEBUG",1); cdef("TABLEDEBUG",1);
if (use_tes) if (use_tes)
cdef("USE_TES",1); cdef("USE_TES",1);
if (use_noframepointer)
cdef("USE_NOFRAMEPOINTER",1);
} }
outars() { outars() {
@ -856,11 +852,6 @@ varinfo *kills,*allocates,*generates,*yields,*leaving;
codeint(vp->vi_int[1]); codeint(vp->vi_int[1]);
codenl(); codenl();
break; break;
case INSSTACKADJUST:
code8(DO_STACKADJUST);
codeint(vp->vi_int[1]);
codenl();
break;
} }
} }
codecoco(cocono); codecoco(cocono);

View file

@ -12,4 +12,3 @@
#define INSERASE (-6) #define INSERASE (-6)
#define INSREMOVE (-7) #define INSREMOVE (-7)
#define INSLABDEF (-8) #define INSLABDEF (-8)
#define INSSTACKADJUST (-9)

View file

@ -7,6 +7,7 @@ static char rcsid[]= "$Id$";
#endif #endif
#include "param.h" #include "param.h"
#include "extern.h"
int nstrings=0; int nstrings=0;
char *l_strings[MAXSTRINGS]; char *l_strings[MAXSTRINGS];

View file

@ -13,6 +13,7 @@ static char rcsid[]= "$Id$";
#include "set.h" #include "set.h"
#include "instruct.h" #include "instruct.h"
#include "lookup.h" #include "lookup.h"
#include "extern.h"
#include <cgg_cg.h> #include <cgg_cg.h>
int wordsize; int wordsize;