From b86af8be0be1a62e182faf3677a637d21b24e289 Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Sun, 13 Jan 2013 17:20:59 +0100 Subject: [PATCH] Toolchain adaptation for ARM MINIX support --- drivers/memory/Makefile | 2 +- .../gpl3/binutils/patches/0001-minix.patch | 2 +- external/gpl3/gcc/fetch.sh | 1 + external/gpl3/gcc/files/arm-minix.h | 69 +++++++++++++++++++ external/gpl3/gcc/files/i386-minix.h | 41 +---------- external/gpl3/gcc/files/minix-spec.h | 32 ++++++++- external/gpl3/gcc/files/minix.h | 9 +++ external/gpl3/gcc/lib/libgcc/arch/earm.mk | 8 +++ external/gpl3/gcc/patches/0001-minix.patch | 24 ++++--- share/mk/bsd.gcc.mk | 5 +- share/mk/bsd.own.mk | 7 +- share/mk/minix.bootprog.mk | 3 + 12 files changed, 146 insertions(+), 57 deletions(-) create mode 100644 external/gpl3/gcc/files/arm-minix.h diff --git a/drivers/memory/Makefile b/drivers/memory/Makefile index 1f7b89ec8..ce0debae4 100644 --- a/drivers/memory/Makefile +++ b/drivers/memory/Makefile @@ -26,7 +26,7 @@ touch-genfiles: .mfs.o: ${_MKTARGET_CREATE} - ${OBJCOPY} -Ibinary -B${MACHINE_ARCH} -O${MACHINE_GNU_PLATFORM} $< $@ + ${OBJCOPY} -Ibinary -B${MACHINE_CPU} -O${MACHINE_GNU_PLATFORM} $< $@ CLEANFILES+= ../ramdisk/image ../ramdisk/image: .PHONY diff --git a/external/gpl3/binutils/patches/0001-minix.patch b/external/gpl3/binutils/patches/0001-minix.patch index 6b02e8cfe..8f69b79d6 100644 --- a/external/gpl3/binutils/patches/0001-minix.patch +++ b/external/gpl3/binutils/patches/0001-minix.patch @@ -168,7 +168,7 @@ diff -r -x CVS -N -U 3 dist.orig/ld/emulparams/armelf_minix.sh dist/ld/emulparam @@ -0,0 +1,3 @@ +. ${srcdir}/emulparams/armelf.sh +. ${srcdir}/emulparams/elf_minix.sh -+OUTPUT_FORMAT="elf32-littlearm-minix" ++OUTPUT_FORMAT="elf32-littlearm" diff -r -x CVS -N -U 3 dist.orig/ld/emulparams/elf_i386_minix.sh dist/ld/emulparams/elf_i386_minix.sh --- dist.orig/ld/emulparams/elf_i386_minix.sh 1970-01-01 01:00:00.000000000 +0100 +++ dist/ld/emulparams/elf_i386_minix.sh 2012-10-31 17:47:37.869917589 +0100 diff --git a/external/gpl3/gcc/fetch.sh b/external/gpl3/gcc/fetch.sh index b67e9b343..bd414a8fa 100755 --- a/external/gpl3/gcc/fetch.sh +++ b/external/gpl3/gcc/fetch.sh @@ -39,6 +39,7 @@ then cat ../patches/* | patch -p1 && \ cp ../files/minix.h gcc/config/ && \ cp ../files/minix-spec.h gcc/config/ && \ + cp ../files/arm-minix.h gcc/config/arm/minix.h && \ cp ../files/i386-minix.h gcc/config/i386/minix.h && \ cp ../files/gcov-minix-fs-wrapper.h gcc/ fi diff --git a/external/gpl3/gcc/files/arm-minix.h b/external/gpl3/gcc/files/arm-minix.h new file mode 100644 index 000000000..398279ef5 --- /dev/null +++ b/external/gpl3/gcc/files/arm-minix.h @@ -0,0 +1,69 @@ +/* Definitions for StrongARM running FreeBSD using the ELF format + Copyright (C) 2001, 2004, 2007 Free Software Foundation, Inc. + Contributed by David E. O'Brien and BSDi. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + + +#undef MINIX_TARGET_CPU_CPP_BUILTINS +#define MINIX_TARGET_CPU_CPP_BUILTINS() \ + do \ + { \ + TARGET_BPABI_CPP_BUILTINS(); \ + } \ + while (0) + +/************************[ Target stuff ]***********************************/ + +/* Define the actual types of some ANSI-mandated types. + Needs to agree with . GCC defaults come from c-decl.c, + c-common.c, and config//.h. */ + +/* arm.h gets this wrong for FreeBSD. We use the GCC defaults instead. */ + +#undef SIZE_TYPE +#define SIZE_TYPE "unsigned int" + +#undef PTRDIFF_TYPE +#define PTRDIFF_TYPE "int" + +#undef WCHAR_TYPE +#define WCHAR_TYPE "int" + +/* Little endian by default */ +#undef TARGET_ENDIAN_DEFAULT +#define TARGET_ENDIAN_DEFAULT 0 + +/* Use by default the new abi and calling standard */ +#undef ARM_DEFAULT_ABI +#define ARM_DEFAULT_ABI ARM_ABI_AAPCS + +/* Fixed-sized enum by default (-fno-short-enums) */ +#undef CC1_SPEC +#define CC1_SPEC \ + "%{!fshort-enums:%{!fno-short-enums:-fno-short-enums}} " + +/* This defaults us to little-endian. */ +#ifndef TARGET_ENDIAN_DEFAULT +#define TARGET_ENDIAN_DEFAULT 0 +#endif + +#undef SUBTARGET_CPU_DEFAULT +#define SUBTARGET_CPU_DEFAULT TARGET_CPU_cortexa8 + +#undef TARGET_VERSION +#define TARGET_VERSION fputs (" (MINIX/arm ELF EABI)", stderr); diff --git a/external/gpl3/gcc/files/i386-minix.h b/external/gpl3/gcc/files/i386-minix.h index 0276f3a7b..cef452dc9 100644 --- a/external/gpl3/gcc/files/i386-minix.h +++ b/external/gpl3/gcc/files/i386-minix.h @@ -36,7 +36,7 @@ Boston, MA 02110-1301, USA. */ } \ while (0) -#define TARGET_VERSION fprintf (stderr, " (i386 MINIX/ELF)"); +#define TARGET_VERSION fprintf (stderr, " (MINIX/i586 ELF)"); /* Override the default comment-starter of "/". */ #undef ASM_COMMENT_START @@ -71,43 +71,6 @@ Boston, MA 02110-1301, USA. */ #undef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE (TARGET_64BIT ? 32 : BITS_PER_WORD) -#undef SUBTARGET_EXTRA_SPECS /* i386.h bogusly defines it. */ -#define SUBTARGET_EXTRA_SPECS \ - { "minix_dynamic_linker", MINIX_DYNAMIC_LINKER } - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC MINIX_STARTFILE_SPEC - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC MINIX_ENDFILE_SPEC - -/* Provide a LINK_SPEC appropriate for MINIX. Here we provide support - for the special GCC options -static and -shared, which allow us to - link things in one of these three modes by applying the appropriate - combinations of options at link-time. We like to support here for - as many of the other GNU linker options as possible. But I don't - have the time to search for those flags. I am sure how to add - support for -soname shared_object_name. H.J. - - I took out %{v:%{!V:-V}}. It is too much :-(. They can use - -Wl,-V. - - When the -shared link option is used a final link is not being - done. */ - -#undef LINK_SPEC -#define LINK_SPEC "\ - %{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \ - %{v:-V} \ - %{assert*} %{R*} %{rpath*} %{defsym*} \ - %{shared:-Bshareable %{h*} %{soname*}} \ - %{!shared: \ - %{!static: \ - %{rdynamic:-export-dynamic} \ - %{!dynamic-linker:-dynamic-linker %(minix_dynamic_linker) }} \ - %{static:-Bstatic}} \ - %{symbolic:-Bsymbolic}" - /* A C statement to output to the stdio stream FILE an assembler command to advance the location counter to a multiple of 1< # LSC Static linking, order matters! +# We can't use --start-group/--end-group as they are not supported by our +# version of clang. + # 1. No default libs LDADD+= -nodefaultlibs -- 2.44.0