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/linux386/build.mk
include plat/linux68k/build.mk
include plat/linuxppc/build.mk
# include plat/linuxppc/build.mk
.PHONY: installables
installables: $(INSTALLABLES)

View file

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

View file

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

View file

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

View file

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

View file

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

2
pmfile
View file

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

View file

@ -32,7 +32,8 @@
/* Global settings. */
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. */
@ -116,7 +117,7 @@ int follows(struct outsect* pa, struct outsect* 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. */
@ -276,11 +277,27 @@ int main(int argc, char* argv[])
{
switch (argv[1][1])
{
case 'a':
elfabi = atoi(&argv[1][2]);
break;
case 'b':
bigendian = 1;
break;
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);
exit(0);
case 'l':
bigendian = 0;
break;
case 'm':
elfmachine = atoi(&argv[1][2]);
break;
default:
syntaxerror:
fatal("syntax error --- try -h for help");
@ -382,13 +399,13 @@ int main(int argc, char* argv[])
emit8(1); /* class = ELFCLASS32 */
emit8(bigendian ? 2 : 1); /* endianness */
emit8(1); /* ELF version */
emit8(3); /* ABI = Linux */
emit8(elfabi); /* ABI */
emit8(0); /* ABI version */
emit8(0); emit16(0); /* padding... */
emit32(0); /* ...to offset 0x10 */
emit16(2); /* type = ET_EXEC */
emit16(3); /* machine = EM_386 */
emit16(elfmachine); /* machine */
emit32(1); /* ELF version again */
emit32(outsect[TEXT].os_base); /* entry point */
emit32(ELF_HEADER_SIZE); /* program header offset */

View file

@ -1,4 +1,5 @@
#!/bin/sh
set -e
em_table=$1
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_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 perc_ident_expr(),sum_expr(),regvar_expr();
@ -74,9 +74,9 @@ iocc_t iops[20];
%token TOPELTSIZE FALLTHROUGH LABELDEF
%token PROC CALL EXAMPLE
%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 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 INREG REGVAR REG_ANY REG_FLOAT REG_LOOP REG_POINTER
%token <yy_int> ADORNACCESS
@ -635,8 +635,8 @@ coderule
maxempatlen=empatlen;
}
patterns
{ /* if (!saferulefound)
error("Previous rule impossible on empty stack"); */
{ if (!saferulefound)
error("Previous rule impossible on empty stack");
outpatterns();
}
| PROC IDENT example
@ -849,8 +849,6 @@ gen_instruction
{ $$ = gen_label($2-1); use_tes++; }
| RETURN
{ $$ = gen_preturn(); }
| STACKADJUST expr
{ $$ = gen_stackadjust($2.ex_index); use_noframepointer++; }
;
optstar
: /* empty */
@ -1030,8 +1028,6 @@ expr
{ $$ = make_expr(TYPINT,EX_LOWW,$3-1,0); }
| HIGHW '(' emarg ')'
{ $$ = make_expr(TYPINT,EX_HIGHW,$3-1,0); }
| STACKOFFSET '(' ')'
{ $$ = make_expr(TYPINT,EX_STACKOFFSET, 0, 0); }
/* Excluded, because it causes a shift-reduce conflict
(problems with a tokenset_no followed by an optexpr)
| '-' expr %prec UMINUS

View file

@ -127,15 +127,6 @@ struct varinfo *gen_preturn() {
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) {
register struct varinfo *vp;

View file

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

View file

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

View file

@ -37,7 +37,10 @@ extern int regclass;
extern int maxtokensize;
extern int nprocargs, maxprocargs;
extern int use_tes;
extern int use_noframepointer;
extern char *mystrcpy();
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 "param.h"
#include "set.h"
#include "extern.h"
#include <stdio.h>
/*

View file

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

View file

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

View file

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

View file

@ -12,8 +12,6 @@ int tabledebug=0; /* do not generate code for table debugging */
#endif
int verbose=0; /* print all statistics */
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 *h_file= "tables.H";
char *cd_file= "code";
@ -614,8 +612,6 @@ outdefs() {
cdef("TABLEDEBUG",1);
if (use_tes)
cdef("USE_TES",1);
if (use_noframepointer)
cdef("USE_NOFRAMEPOINTER",1);
}
outars() {
@ -856,11 +852,6 @@ varinfo *kills,*allocates,*generates,*yields,*leaving;
codeint(vp->vi_int[1]);
codenl();
break;
case INSSTACKADJUST:
code8(DO_STACKADJUST);
codeint(vp->vi_int[1]);
codenl();
break;
}
}
codecoco(cocono);

View file

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

View file

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

View file

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