Merge from default.

--HG--
branch : dtrg-videocore-branch-branch
This commit is contained in:
David Given
2016-03-13 21:13:09 +01:00
30 changed files with 328 additions and 167 deletions

View File

@@ -38,7 +38,7 @@ $(OBJDIR)/$D/preprocessed-comm2.y: mach/proto/as/comm2.y $(CPPANSI) \
-Ih \
mach/proto/as/comm2.y > $$@
$(call file, $(LIBOBJECT))
$(call rawfile, $(LIBOBJECT))
$(call cprogram, $(BINDIR)/$(PLATFORM)/as)
$(call installto, $(PLATDEP)/$(PLATFORM)/as)

View File

@@ -265,3 +265,4 @@ typedef struct sect_t sect_t;
#endif
extern FILE *fopen(); /* some systems don't have this in stdio.h */

View File

@@ -116,6 +116,10 @@ extern valu_t load();
extern FILE *ffcreat();
extern FILE *fftemp();
extern void fatal(const char* s, ...);
extern void serror(const char* s, ...);
extern void warning(const char* s, ...);
/* ========== Machine dependent C declarations ========== */
#include "mach1.c"

View File

@@ -11,6 +11,7 @@
#include "comm0.h"
#include "comm1.h"
#include "y.tab.h"
#include <stdarg.h>
valu_t
load(ip)
@@ -27,7 +28,7 @@ register item_t *ip;
if ((ip->i_type & S_TYP) == S_UND || (ip->i_type & S_COM)) {
if (pass == PASS_3) {
if (relonami != 0)
serror("relocation error");
serror("relocation error (relonami=%d, type=%08x)", relonami, ip->i_type);
relonami = ip->i_valu+1;
}
return(0);
@@ -380,13 +381,28 @@ wr_fatal()
fatal("write error");
}
/* VARARGS1 */
fatal(s, a1, a2, a3, a4)
char *s;
void diag(const char* tail, const char* s, va_list ap)
{
fflush(stdout);
if (modulename)
fprintf(stderr, "\"%s\", line %ld: ", modulename, lineno);
else
fprintf(stderr, "%s: ", progname);
vfprintf(stderr, s, ap);
fprintf(stderr, "%s", tail);
}
/* VARARGS1 */
void fatal(const char* s, ...)
{
va_list ap;
va_start(ap, s);
nerrors++;
diag(" (fatal)\n", s, a1, a2, a3, a4);
diag(" (fatal)\n", s, ap);
stop();
va_end(ap);
}
#if DEBUG == 2
@@ -400,37 +416,34 @@ char *file;
#if DEBUG == 1
assert1()
{
diag(" (fatal)\n", "assertion failed");
fatal("assertion failed");
abort();
}
#endif
/* VARARGS1 */
serror(s, a1, a2, a3, a4)
char *s;
void serror(const char* s, ...)
{
va_list ap;
va_start(ap, s);
nerrors++;
diag("\n", s, a1, a2, a3, a4);
diag("\n", s, ap);
stop();
va_end(ap);
}
/* VARARGS1 */
warning(s, a1, a2, a3, a4)
char *s;
void warning(const char* s, ...)
{
diag(" (warning)\n", s, a1, a2, a3, a4);
}
va_list ap;
va_start(ap, s);
/* VARARGS1 */
diag(tail, s, a1, a2, a3, a4)
char *tail, *s;
{
fflush(stdout);
if (modulename)
fprintf(stderr, "\"%s\", line %ld: ", modulename, lineno);
else
fprintf(stderr, "%s: ", progname);
fprintf(stderr, s, a1, a2, a3, a4);
fprintf(stderr, tail);
nerrors++;
diag(" (warning)\n", s, ap);
stop();
va_end(ap);
}
nofit()

46
mach/proto/cg/build.mk Normal file
View File

@@ -0,0 +1,46 @@
define build-cg-impl
$(call reset)
$(eval cflags += -Imach/$(ARCH)/cg -I$(OBJDIR)/$D -Imach/proto/cg)
$(eval objdir := $(ARCH))
$(call cfile, mach/proto/cg/codegen.c)
$(call cfile, mach/proto/cg/compute.c)
$(call cfile, mach/proto/cg/equiv.c)
$(call cfile, mach/proto/cg/fillem.c)
$(call cfile, mach/proto/cg/gencode.c)
$(call cfile, mach/proto/cg/glosym.c)
$(call cfile, mach/proto/cg/main.c)
$(call cfile, mach/proto/cg/move.c)
$(call cfile, mach/proto/cg/nextem.c)
$(call cfile, mach/proto/cg/reg.c)
$(call cfile, mach/proto/cg/regvar.c)
$(call cfile, mach/proto/cg/salloc.c)
$(call cfile, mach/proto/cg/state.c)
$(call cfile, mach/proto/cg/subr.c)
$(call cfile, mach/proto/cg/var.c)
$(eval $q: $(OBJDIR)/$D/tables.h)
$(eval CLEANABLES += $(OBJDIR)/$D/tables.h $(OBJDIR)/$D/tables.c)
$(OBJDIR)/$D/tables.c: $(OBJDIR)/$D/tables.h
$(OBJDIR)/$D/tables.h: $(CGG) $(CPPANSI) mach/$(ARCH)/cg/table
@echo CGG $$@
@mkdir -p $$(dir $$@)
$(hide) cd $$(dir $$@) && \
$(abspath $(CPPANSI)) -I$(abspath mach/$(ARCH)/cg) $(abspath mach/$(ARCH)/cg/table) | $(abspath $(CGG))
$(call cfile, $(OBJDIR)/$D/tables.c)
$(eval $q: $(INCDIR)/flt_arith.h)
$(call rawfile, $(LIBEM_DATA))
$(call rawfile, $(LIBFLT_ARITH))
$(call cprogram, $(BINDIR)/$(PLATFORM)/cg)
$(call installto, $(PLATDEP)/$(PLATFORM)/cg)
endef
build-cg = $(eval $(build-cg-impl))

View File

@@ -36,8 +36,8 @@ $(call cfile, $(OBJDIR)/$D/tables.c)
$(eval $q: $(INCDIR)/flt_arith.h)
$(call file, $(LIBEM_DATA))
$(call file, $(LIBFLT_ARITH))
$(call rawfile, $(LIBEM_DATA))
$(call rawfile, $(LIBFLT_ARITH))
$(call cprogram, $(BINDIR)/$(PLATFORM)/ncg)
$(call installto, $(PLATDEP)/$(PLATFORM)/ncg)