Get the pcc ARM backend building.
authorDavid Given <dg@cowlark.com>
Fri, 18 Mar 2016 22:37:09 +0000 (23:37 +0100)
committerDavid Given <dg@cowlark.com>
Fri, 18 Mar 2016 22:37:09 +0000 (23:37 +0100)
--HG--
branch : default-branch

Makefile
first/core.mk
lang/pcc/build.mk [new file with mode: 0644]
lang/pcc/config.h [new file with mode: 0644]
man/powerpc_as.6 [new file with mode: 0644]
plat/build.mk
plat/linuxarm/build.mk [new file with mode: 0644]

index dbac9ca..98922cd 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -91,6 +91,7 @@ include lang/cem/build.mk
 include lang/basic/build.mk
 include lang/pc/build.mk
 include lang/m2/build.mk
+include lang/pcc/build.mk
 
 include mach/proto/as/build.mk
 include mach/proto/ncg/build.mk
@@ -102,7 +103,7 @@ include mach/i80/build.mk
 include mach/i386/build.mk
 include mach/i86/build.mk
 include mach/m68020/build.mk
-include mach/powerpc/build.mk
+include mach/powerpc/build.mk
 include mach/vc4/build.mk
 
 include plat/build.mk
@@ -110,7 +111,8 @@ 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
+include plat/linuxarm/build.mk
 include plat/rpi/build.mk
 
 .PHONY: installables
index 6c386d0..b9d9434 100644 (file)
@@ -14,8 +14,8 @@ define cfile-rule
 $o: $s
        @echo CC $o
        @mkdir -p $(dir $o)
-       @$(CC) $(CFLAGS) $(cflags) -MM -MQ $o -o $d $s
        $(hide) $(CC) $(CFLAGS) $(cflags) -c -o $o $s
+       @$(CC) $(CFLAGS) $(cflags) -MM -MQ $o -o $d $s
 endef
 
 define cfile
diff --git a/lang/pcc/build.mk b/lang/pcc/build.mk
new file mode 100644 (file)
index 0000000..cc932ad
--- /dev/null
@@ -0,0 +1,96 @@
+D := lang/pcc
+
+define pcc-cfile-impl
+       $(call cfile, $1)
+       $(call dependson, $(OBJDIR)/$D/external.h)
+endef
+pcc-cfile = $(eval $(pcc-cfile-impl))
+
+define build-pcc-impl
+
+$(eval pcc-cflags = \
+       -Ilang/pcc \
+       -I$(OBJDIR)/$D \
+       -Ilang/pcc/pcc/common \
+       -Ilang/pcc/pcc/mip \
+       -Ilang/pcc/pcc/cc/ccom \
+       -Ilang/pcc/pcc/arch/$(PCCARCH) \
+       -D_DEFAULT_SOURCE \
+       -DGCC_COMPAT \
+       -DPCC_DEBUG \
+       -DNATIVE_FLOATING_POINT \
+       -D_ISOC99_SOURCE \
+       -Dos_ack \
+       -Dmach_$(PCCMACH) \
+)
+
+$(call reset)
+$(eval cflags += $(pcc-cflags))
+
+$(call pcc-cfile, $(OBJDIR)/$D/external.c)
+$(call pcc-cfile, lang/pcc/pcc/arch/$(PCCARCH)/code.c)
+$(call pcc-cfile, lang/pcc/pcc/arch/$(PCCARCH)/local.c)
+$(call pcc-cfile, lang/pcc/pcc/arch/$(PCCARCH)/local2.c)
+$(call pcc-cfile, lang/pcc/pcc/arch/$(PCCARCH)/order.c)
+$(call pcc-cfile, lang/pcc/pcc/arch/$(PCCARCH)/table.c)
+$(call pcc-cfile, lang/pcc/pcc/cc/ccom/builtins.c)
+$(call pcc-cfile, lang/pcc/pcc/cc/ccom/dwarf.c)
+$(call pcc-cfile, lang/pcc/pcc/cc/ccom/init.c)
+$(call pcc-cfile, lang/pcc/pcc/cc/ccom/inline.c)
+$(call pcc-cfile, lang/pcc/pcc/cc/ccom/main.c)
+$(call pcc-cfile, lang/pcc/pcc/cc/ccom/optim.c)
+$(call pcc-cfile, lang/pcc/pcc/cc/ccom/stabs.c)
+$(call pcc-cfile, lang/pcc/pcc/cc/ccom/symtabs.c)
+$(call pcc-cfile, lang/pcc/pcc/cc/ccom/trees.c)
+$(call pcc-cfile, lang/pcc/pcc/common/compat.c)
+$(call pcc-cfile, lang/pcc/pcc/common/unicode.c)
+$(call pcc-cfile, lang/pcc/pcc/mip/common.c)
+$(call pcc-cfile, lang/pcc/pcc/mip/match.c)
+$(call pcc-cfile, lang/pcc/pcc/mip/optim2.c)
+$(call pcc-cfile, lang/pcc/pcc/mip/reader.c)
+$(call pcc-cfile, lang/pcc/pcc/mip/regs.c)
+
+$(call pcc-cfile, lang/pcc/pcc/cc/ccom/gcc_compat.c)
+$(call dependson, $(OBJDIR)/$D/cgram.h)
+
+$(call pcc-cfile, lang/pcc/pcc/cc/ccom/pftn.c)
+$(call dependson, $(OBJDIR)/$D/cgram.h)
+
+$(call yacc, $(OBJDIR)/$D, lang/pcc/pcc/cc/ccom/cgram.y)
+
+$(call flex, $(OBJDIR)/$D, lang/pcc/pcc/cc/ccom/scan.l)
+$(call dependson, $(OBJDIR)/$D/cgram.h)
+
+$(call cprogram, $(BINDIR)/$(PLATFORM)/pcc_ccom)
+$(call installto, $(PLATDEP)/$(PLATFORM)/pcc_ccom)
+
+
+$(call reset)
+$(call rawfile, $(OBJDIR)/$D/y.tab.h)
+$(call installto, $(OBJDIR)/$D/cgram.h)
+
+
+$(call reset)
+$(eval cflags += $(pcc-cflags))
+
+
+$(call reset)
+$(eval objdir := mkext)
+$(eval cflags += $(pcc-cflags) -DMKEXT)
+$(call cfile, lang/pcc/pcc/mip/mkext.c)
+$(call cfile, lang/pcc/pcc/mip/common.c)
+$(call cfile, lang/pcc/pcc/arch/$(PCCARCH)/table.c)
+$(call cprogram, $(OBJDIR)/$D/mkext)
+$(eval pcc_mkext := $o)
+
+$(OBJDIR)/$D/external.h: $(OBJDIR)/$D/external.c
+$(OBJDIR)/$D/external.c: $(pcc_mkext)
+       @echo MKEXT
+       @mkdir -p $$(dir $$@)
+       $(hide) (cd $$(dir $$@) && $(pcc_mkext))
+
+endef
+
+
+build-pcc = $(eval $(build-pcc-impl))
+
diff --git a/lang/pcc/config.h b/lang/pcc/config.h
new file mode 100644 (file)
index 0000000..72b011c
--- /dev/null
@@ -0,0 +1,188 @@
+/* config.h.  Generated MANUALLY (but based on Debian's autoconf result). */
+
+/* Define if building universal (internal helper macro) */
+/* #undef AC_APPLE_UNIVERSAL_BUILD */
+
+/* Using a.out ABI */
+/* #undef AOUTABI */
+
+/* Define path to alternate assembler */
+/* #undef ASSEMBLER */
+
+/* Using Classic 68k ABI */
+/* #undef CLASSIC68K */
+
+/* Using COFF ABI */
+/* #undef COFFABI */
+
+/* Define path to alternate compiler */
+/* #undef COMPILER */
+
+/* Using ECOFF ABI */
+/* #undef ECOFFABI */
+
+/* Using ELF ABI */
+#define ELFABI 1
+
+/* Define to 1 if printf supports C99 size specifiers */
+#define HAVE_C99_FORMAT 1
+
+/* Define to 1 if you have the `ffs' function. */
+#define HAVE_FFS 1
+
+/* Define to 1 if you have the `getopt' function. */
+#define HAVE_GETOPT 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <libgen.h> header file. */
+#define HAVE_LIBGEN_H 1
+
+/* Define to 1 if you have the <malloc.h> header file. */
+#define HAVE_MALLOC_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mkstemp' function. */
+#define HAVE_MKSTEMP 1
+
+/* Define to 1 if you have the `snprintf' function. */
+#define HAVE_SNPRINTF 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strlcat' function. */
+/* #undef HAVE_STRLCAT */
+
+/* Define to 1 if you have the `strlcpy' function. */
+/* #undef HAVE_STRLCPY */
+
+/* Define to 1 if you have the `strtold' function. */
+#define HAVE_STRTOLD 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#define HAVE_SYS_WAIT_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `vfork' function. */
+#define HAVE_VFORK 1
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#define HAVE_VSNPRINTF 1
+
+/* Define if host is BIG endian */
+/* #undef HOST_BIG_ENDIAN */
+
+/* Define if host is LITTLE endian */
+#define HOST_LITTLE_ENDIAN 1
+
+/* Define alternate standard lib directory */
+/* #undef LIBDIR */
+
+/* Define path to alternate linker */
+/* #undef LINKER */
+
+/* Using Mach-O ABI */
+/* #undef MACHOABI */
+
+/* Define target Multi-Arch path */
+#define MULTIARCH_PATH "x86_64-linux-gnu"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "pcc@lists.ludd.ltu.se"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "Portable C Compiler"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "Portable C Compiler 1.2.0.DEVEL"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "pcc"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL "http://pcc.ludd.ltu.se/"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.2.0.DEVEL"
+
+/* Major version no */
+#define PCC_MAJOR 1
+
+/* Minor version no */
+#define PCC_MINOR 2
+
+/* Minor minor version no */
+#define PCC_MINORMINOR 0
+
+/* Using PE/COFF ABI */
+/* #undef PECOFFABI */
+
+/* Define path to alternate preprocessor */
+/* #undef PREPROCESSOR */
+
+/* Enable STABS debugging output */
+#define STABS 1
+
+/* Enable DWARF debugging output */
+/* #undef DWARF */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define alternate standard include directory */
+/* #undef STDINC */
+
+/* Define if target defaults to BIG endian */
+/* #undef TARGET_BIG_ENDIAN */
+
+/* Define if target defaults to LITTLE endian */
+#define TARGET_LITTLE_ENDIAN 1
+
+/* Enable thread-local storage (TLS). */
+/* #undef TLS */
+
+/* Version string */
+#define VERSSTR "Portable C Compiler 1.2.0.DEVEL 20160315 for x86_64-unknown-linux-gnu"
+
+/* Size of wide-character type in chars */
+#define WCHAR_SIZE 4
+
+/* Type to use for wide characters */
+#define WCHAR_TYPE INT
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+#  define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+/* #  undef WORDS_BIGENDIAN */
+# endif
+#endif
+
+/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
+   `char[]'. */
+#define YYTEXT_POINTER 1
diff --git a/man/powerpc_as.6 b/man/powerpc_as.6
new file mode 100644 (file)
index 0000000..d85167c
--- /dev/null
@@ -0,0 +1,25 @@
+.\" $Header$
+.TH POWERPC_AS 1
+.ad
+.SH NAME
+powerpc_as \- assembler for Motorola PowerPC
+
+.SH SYNOPSIS
+/usr/em/lib/powerpc_as [options] argument ...
+
+.SH DESCRIPTION
+This assembler is made with the general framework
+described in \fIuni_ass\fP(6).
+
+.SH SYNTAX
+TODO. Sorry.
+
+.SH "SEE ALSO"
+uni_ass(6),
+ack(1),
+
+.SH EXAMPLE
+.nf
+.ta 8n 16n 24n 32n 40n 48n
+TODO.
+.fi
index 623658b..f710203 100644 (file)
@@ -65,4 +65,13 @@ endef
 
 build-platform = $(eval $(call build-platform-impl, $1))
 
+define build-pcc-platform-impl
+       $(eval PLATFORM_$(PLATFORM) := \
+                       $(PLATDEP)/$(PLATFORM)/pcc_ccom \
+       )
+
+       $(call build-pcc)
+endef
+
+build-pcc-platform = $(eval $(call build-pcc-platform-impl, $1))
 
diff --git a/plat/linuxarm/build.mk b/plat/linuxarm/build.mk
new file mode 100644 (file)
index 0000000..bb93e2a
--- /dev/null
@@ -0,0 +1,9 @@
+ARCH := arm
+PCCARCH := arm
+PLATFORM := linuxarm
+OPTIMISATION := -O6
+
+D := plat/linuxarm/
+
+$(eval $(call build-pcc-platform))
+