From: John Hodge Date: Fri, 1 Mar 2013 08:02:12 +0000 (+0800) Subject: Externals/cross-compiler - Magic patchfiles X-Git-Tag: rel0.15~546 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=5fc2955d2f3e3ffcc10ce713317771b72842d910;p=tpg%2Facess2.git Externals/cross-compiler - Magic patchfiles --- diff --git a/Externals/cross-compiler/Makefile b/Externals/cross-compiler/Makefile new file mode 100644 index 00000000..0326b449 --- /dev/null +++ b/Externals/cross-compiler/Makefile @@ -0,0 +1,64 @@ + +-include ../../Makefile.cfg + +GCC_ARCHIVE:=$(lastword $(sort $(wildcard gcc-*.tar.bz2))) +GCC_DIR:=$(GCC_ARCHIVE:%.tar.bz2=%) +BINUTILS_ARCHIVE:=$(lastword $(sort $(wildcard binutils-*.tar.bz2))) +BINUTILS_DIR:=$(BINUTILS_ARCHIVE:%.tar.bz2=%) + +BINUTILS_CHANGES := config.sub bfd/config.bfd gas/configure.tgt ld/configure.tgt ld/emulparams/acess2_i386.sh ld/Makefile.in +GCC_CHANGES := config.sub gcc/config.gcc gcc/config/acess2.h libgcc/config.host + +ARCH?=i586 +PARLEVEL ?= 3 + +TARGET=$(ARCH)-pc-acess2 +PREFIX=$(shell pwd)/cross + +.PHONY: all clean binutils gcc include + +all: include binutils gcc + +include: + mkdir -p $(PREFIX) + rm -r $(PREFIX)/include + ln -s $(ACESSDIR)/Usermode/include $(PREFIX)/include + +gcc: $(GCC_DIR) $(PREFIX)/bin/$(TARGET)-gcc + +binutils: $(BINUTILS_DIR) $(PREFIX)/bin/$(TARGET)-ld + +clean: + $(RM) -rf $(BINUTILS_DIR) build-*-$(ARCH) + +$(BINUTILS_DIR) $(GCC_DIR): %: %.tar.bz2 + tar -xf $< +$(warning $(BINUTILS_DIR) $(GCC_DIR)) + +$(GCC_DIR)/%: patches/gcc/%.patch + @echo [PATCH] $@ + @tar -xf $(GCC_ARCHIVE) $@ + @patch $@ $< +$(GCC_DIR)/%: patches/gcc/% + @echo [CP] $@ + @cp $< $@ + +$(BINUTILS_DIR)/%: patches/binutils/%.patch + @echo [PATCH] $@ + @tar -xf $(BINUTILS_ARCHIVE) $@ + @patch $@ $< +$(BINUTILS_DIR)/%: patches/binutils/% + @echo [CP] $@ + @cp $< $@ + +$(PREFIX)/bin/$(TARGET)-ld: $(addprefix $(BINUTILS_DIR)/,$(BINUTILS_CHANGES)) + @mkdir -p build-binutils-$(ARCH) + @cd build-binutils-$(ARCH) && ../$(BINUTILS_DIR)/configure --target=$(TARGET) --prefix=$(PREFIX) --disable-nls + @cd build-binutils-$(ARCH) && make all install -j $(PARLEVEL) + +$(PREFIX)/bin/$(TARGET)-gcc: $(addprefix $(GCC_DIR)/,$(GCC_CHANGES)) + @mkdir -p build-gcc-$(ARCH) + cd build-gcc-$(ARCH) && PATH=$(PREFIX)/bin:$$PATH ../$(GCC_DIR)/configure --target=$(TARGET) --prefix=$(PREFIX) --disable-nls --enable-langs=c,c++ --includedir=$(ACESSDIR)/Usermode/include --libdir=$(ACESSDIR)/Usermode/Output/$(ARCH)/Lib + @cd build-gcc-$(ARCH) && PATH=$(PREFIX)/bin:$$PATH make all-gcc all-target-libgcc install-gcc install-target-libgcc -j $(PARLEVEL) + + diff --git a/Externals/cross-compiler/patches/binutils/bfd/config.bfd.patch b/Externals/cross-compiler/patches/binutils/bfd/config.bfd.patch new file mode 100644 index 00000000..f3b8d3e3 --- /dev/null +++ b/Externals/cross-compiler/patches/binutils/bfd/config.bfd.patch @@ -0,0 +1,14 @@ +--- bfd/config.bfd 2011-07-29 00:00:00.000000 +0000 ++++ bfd/config.bfd 2013-03-01 10:45:00.000000 +0800 +@@ -1576,2 +1576,11 @@ + ;; ++ i[3-7]86-*-acess2) ++ targ_defvec=bfd_elf32_i386_vec ++ targ_selvecs=i386coff_vec ++ ;; ++ x86_64-*-acess2) ++ targ_defvec=bfd_elf64_x86_64_vec ++ targ_selvecs="bfd_elf32_i386_vec bfd_elf32_x86_64_vec i386linux_vec i386pei_vec x86_64pei_vec bfd_elf64_l1om_vec bfd_elf64_k1om_vec" ++ want64=true ++ ;; + # END OF targmatch.h diff --git a/Externals/cross-compiler/patches/binutils/config.sub.patch b/Externals/cross-compiler/patches/binutils/config.sub.patch new file mode 100644 index 00000000..d6814f0d --- /dev/null +++ b/Externals/cross-compiler/patches/binutils/config.sub.patch @@ -0,0 +1,6 @@ +--- config.sub ++++ config.sub +@@ -1325,1 +1325,2 @@ ++ | -acess2 \ + | -aos* | -aros* \ + diff --git a/Externals/cross-compiler/patches/binutils/gas/configure.tgt.patch b/Externals/cross-compiler/patches/binutils/gas/configure.tgt.patch new file mode 100644 index 00000000..a024c080 --- /dev/null +++ b/Externals/cross-compiler/patches/binutils/gas/configure.tgt.patch @@ -0,0 +1,6 @@ +--- gas/configure.tgt 2011-07-29 00:00:00.000000 +0000 ++++ gas/configure.tgt 2013-03-01 10:45:00.000000 +0800 +@@ -173,2 +173,3 @@ + i386-sequent-bsd*) fmt=aout em=dynix ;; ++ i386-*-acess2*) fmt=elf ;; + i386-*-beospe*) fmt=coff em=pe ;; diff --git a/Externals/cross-compiler/patches/binutils/ld/Makefile.in.patch b/Externals/cross-compiler/patches/binutils/ld/Makefile.in.patch new file mode 100644 index 00000000..f47e9f79 --- /dev/null +++ b/Externals/cross-compiler/patches/binutils/ld/Makefile.in.patch @@ -0,0 +1,7 @@ +--- ld/Makefile.in ++++ ld/Makefile.in +@@ -2627,2 +2627,4 @@ + ${GENSCRIPTS} elf32xtensa "$(tdir_elf32xtensa)" ++eacess2_i386.c: $(srcdir)/emulparams/acess2_i386.sh $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ++ ${GENSCRIPTS} acess2_i386 "$(tdir_acess2_i386)" + eelf_i386.c: $(srcdir)/emulparams/elf_i386.sh \ diff --git a/Externals/cross-compiler/patches/binutils/ld/configure.tgt.patch b/Externals/cross-compiler/patches/binutils/ld/configure.tgt.patch new file mode 100644 index 00000000..828b07c1 --- /dev/null +++ b/Externals/cross-compiler/patches/binutils/ld/configure.tgt.patch @@ -0,0 +1,6 @@ +--- ld/configure.tgt ++++ ld/configure.tgt +@@ -167,1 +167,2 @@ + i[3-7]86-*-nto-qnx*) targ_emul=i386nto ;; ++i[3-7]86-*-acess2*) targ_emul=acess2_i386 ;; + diff --git a/Externals/cross-compiler/patches/binutils/ld/emulparams/acess2_i386.sh b/Externals/cross-compiler/patches/binutils/ld/emulparams/acess2_i386.sh new file mode 100644 index 00000000..fef69914 --- /dev/null +++ b/Externals/cross-compiler/patches/binutils/ld/emulparams/acess2_i386.sh @@ -0,0 +1,17 @@ +SCRIPT_NAME=elf +OUTPUT_FORMAT=elf32-i386 +TEXT_START_ADDR=0x08048000 +MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" +COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" + +ARCH=i386 +MACHINE= +NOP=0x90909090 +GENERATE_SHLIB_SCRIPT=yes +GENERATE_PIE_SCRIPT=yes + +NO_SMALL_DATA=yes +SEPARATE_GOTPLT=12 + +ELF_INTERPRETER_NAME=\"/Acess/Libs/ld-acess.so\" + diff --git a/Externals/cross-compiler/patches/gcc/config.sub.patch b/Externals/cross-compiler/patches/gcc/config.sub.patch new file mode 100644 index 00000000..24a68c1b --- /dev/null +++ b/Externals/cross-compiler/patches/gcc/config.sub.patch @@ -0,0 +1,5 @@ +--- config.sub ++++ config.sub +@@ -1336,1 +1336,2 @@ + | -aos* | -aros* \ ++ | -acess2* \ diff --git a/Externals/cross-compiler/patches/gcc/gcc/config.gcc.patch b/Externals/cross-compiler/patches/gcc/gcc/config.gcc.patch new file mode 100644 index 00000000..c304125d --- /dev/null +++ b/Externals/cross-compiler/patches/gcc/gcc/config.gcc.patch @@ -0,0 +1,21 @@ +--- gcc/config.gcc ++++ gcc/config.gcc +@@ -519,3 +519,9 @@ + # Common parts for widely ported systems. + case ${target} in ++*-*-acess2*) ++ extra_parts="crt0.o crtbegin.o crtend.o" ++ gas=yes ++ gnu_ld=yes ++ default_use_cxa_atexit=yes ++ ;; + *-*-darwin*) + +@@ -1192,2 +1196,7 @@ + ;; ++i[3-7]86-*-acess2*) ++ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h acess2.h" ++ tmake_file="i386/t-i386elf t-svr4" ++ use_fixproto=yes ++ ;; + i[34567]86-*-elf*) diff --git a/Externals/cross-compiler/patches/gcc/gcc/config/acess2.h b/Externals/cross-compiler/patches/gcc/gcc/config/acess2.h new file mode 100644 index 00000000..8e998f91 --- /dev/null +++ b/Externals/cross-compiler/patches/gcc/gcc/config/acess2.h @@ -0,0 +1,14 @@ +#undef TARGET_OS_CPP_BUILTINS +#define TARGET_OS_CPP_BUILTINS() \ + do { \ + builtin_define_std ("acess2"); \ + builtin_define_std ("unix"); \ + builtin_assert ("system=acess2"); \ + builtin_assert ("system=unix"); \ + } while(0); + +/* +#undef TARGET_VERSION // note that adding these two lines cause an error in gcc-4.7.0 +#define TARGET_VERSION fprintf(stderr, " (i386 acess2)"); // the build process works fine without them until someone can work out an alternative +*/ + diff --git a/Externals/cross-compiler/patches/gcc/libgcc/config.host.patch b/Externals/cross-compiler/patches/gcc/libgcc/config.host.patch new file mode 100644 index 00000000..1ad2b3e3 --- /dev/null +++ b/Externals/cross-compiler/patches/gcc/libgcc/config.host.patch @@ -0,0 +1,16 @@ +--- libgcc/config.host ++++ libgcc/config.host +@@ -523,4 +523,12 @@ + x86_64-*-elf*) + tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic" + ;; ++i[3-7]86-*-acess2*) ++ extra_parts="crt0.o crtbegin.o crtend.o" ++ tmake_file="$tmake_file i386/t-crtstuff" ++ ;; ++x86_64-*-acess2*) ++ extra_parts="crt0.o crtbegin.o crtend.o" ++ tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic" ++ ;; + i[34567]86-*-freebsd*) +