Toolchain adaptation for ARM MINIX support

This commit is contained in:
Lionel Sambuc 2013-01-13 17:20:59 +01:00
parent 13c63491af
commit b86af8be0b
12 changed files with 146 additions and 57 deletions

View file

@ -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

View file

@ -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

View file

@ -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

69
external/gpl3/gcc/files/arm-minix.h vendored Normal file
View file

@ -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 <obrien@FreeBSD.org> 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
<http://www.gnu.org/licenses/>. */
#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 <machine/ansi.h>. GCC defaults come from c-decl.c,
c-common.c, and config/<arch>/<arch>.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);

View file

@ -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<<LOG
bytes if it is within MAX_SKIP bytes.
@ -130,3 +93,5 @@ Boston, MA 02110-1301, USA. */
#undef DEFAULT_PCC_STRUCT_RETURN
#define DEFAULT_PCC_STRUCT_RETURN 0
#define SUBTARGET32_DEFAULT_CPU "i586"

View file

@ -90,13 +90,40 @@ Boston, MA 02110-1301, USA. */
(similar to the default, except no -lg, and no -p). */
#define MINIX_LIB_SPEC " \
%{pthread: %eThe -pthread option is only supported on FreeBSD when gcc \
%{pthread: %eThe -pthread option is only supported on MINIX when gcc \
is built with the --enable-threads configure-time option.} \
%{!shared: \
%{!pg: -lc} \
%{pg: -lc_p} \
}"
/* 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. */
#define MINIX_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}"
/* Under MINIX, just like on NetBSD, the normal location of the various
* *crt*.o files is the /usr/lib directory. */
@ -106,3 +133,6 @@ is built with the --enable-threads configure-time option.} \
#define STANDARD_STARTFILE_PREFIX_1 "/usr/lib/"
#define MINIX_DYNAMIC_LINKER "/libexec/ld-elf.so.1"
#define MINIX_SUBTARGET_EXTRA_SPECS \
{ "minix_dynamic_linker", MINIX_DYNAMIC_LINKER }

View file

@ -52,6 +52,14 @@ Boston, MA 02110-1301, USA. */
#undef LIB_SPEC
#define LIB_SPEC MINIX_LIB_SPEC
#undef LINK_SPEC
#define LINK_SPEC MINIX_LINK_SPEC
#undef SUBTARGET_EXTRA_SPECS
#define SUBTARGET_EXTRA_SPECS MINIX_SUBTARGET_EXTRA_SPECS
#undef SUBTARGET_CPP_SPEC
#define SUBTARGET_CPP_SPEC MINIX_CPP_SPEC
/************************[ Target stuff ]***********************************/
@ -69,3 +77,4 @@ Boston, MA 02110-1301, USA. */
This ensures the configuration knows our system correctly so we can link
with libraries compiled with the native cc. */
#undef NO_DOLLAR_IN_LABEL

View file

@ -4,11 +4,19 @@
#
G_INCLUDES=-I. -I. -I${GNUHOSTDIST}/gcc -I${GNUHOSTDIST}/gcc/. -I${GNUHOSTDIST}/gcc/../include -I./../intl -I${GNUHOSTDIST}/gcc/../libcpp/include -I${GNUHOSTDIST}/gcc/../libdecnumber -I${GNUHOSTDIST}/gcc/../libdecnumber/dpd -I../libdecnumber
G_LIB2ADD=${GNUHOSTDIST}/gcc/config/arm/bpabi-netbsd.c ${GNUHOSTDIST}/gcc/config/arm/unaligned-funcs.c
.if !defined(__MINIX)
G_LIB2ADDEH=${GNUHOSTDIST}/gcc/config/arm/unwind-arm.c ${GNUHOSTDIST}/gcc/config/arm/libunwind.S ${GNUHOSTDIST}/gcc/config/arm/pr-support.c ${GNUHOSTDIST}/gcc/unwind-c.c
.endif # !defined(__MINIX)
G_LIB2ADD_ST=
.if !defined(__MINIX)
G_LIB1ASMFUNCS=_thumb1_case_sqi _thumb1_case_uqi _thumb1_case_shi _thumb1_case_uhi _thumb1_case_si _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func _call_via_rX _interwork_call_via_rX _lshrdi3 _ashrdi3 _ashldi3 _arm_negdf2 _arm_addsubdf3 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 _arm_negsf2 _arm_addsubsf3 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 _arm_fixsfsi _arm_fixunssfsi _arm_floatdidf _arm_floatdisf _arm_floatundidf _arm_floatundisf _clzsi2 _clzdi2 _aeabi_lcmp _aeabi_ulcmp _aeabi_ldivmod _aeabi_uldivmod _floatundisf
.else
G_LIB1ASMFUNCS=_thumb1_case_sqi _thumb1_case_uqi _thumb1_case_shi _thumb1_case_uhi _thumb1_case_si _umodsi3 _modsi3 _dvmd_tls _bb_init_func _call_via_rX _interwork_call_via_rX _lshrdi3 _ashrdi3 _ashldi3 _arm_negdf2 _arm_cmpdf2 _arm_unorddf2 _arm_fixunsdfsi _arm_negsf2 _arm_cmpsf2 _arm_unordsf2 _arm_fixunssfsi _arm_floatdidf _arm_floatdisf _arm_floatundidf _arm_floatundisf _clzsi2 _clzdi2 _aeabi_lcmp _aeabi_ulcmp _aeabi_ldivmod _aeabi_uldivmod _floatundisf
.endif # !defined(__MINIX)
G_LIB1ASMSRC=arm/lib1funcs.asm
.if !defined(__MINIX)
G_LIB2_DIVMOD_FUNCS=_divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
.endif # !defined(__MINIX)
G_LIB2FUNCS_ST=_eprintf __gcc_bcmp
G_LIB2FUNCS_EXTRA=${GNUHOSTDIST}/gcc/config/arm/bpabi-netbsd.c ${GNUHOSTDIST}/gcc/config/arm/unaligned-funcs.c
G_LIBGCC2_CFLAGS=-O2 -DIN_GCC -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fno-inline -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED

View file

@ -10,23 +10,25 @@ diff -r -x CVS -N -U 3 dist.orig/gcc/config.gcc dist/gcc/config.gcc
# The BPABI long long divmod functions return a 128-bit value in
# registers r0-r3. Correctly modeling that requires the use of
# TImode.
@@ -808,7 +808,7 @@
tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/bpabi.h"
tmake_file="arm/t-arm arm/t-arm-elf"
case ${target} in
- arm*-*-eabi*)
+ arm*-*-eabi* | arm*-*-minix*)
tm_file="$tm_file arm/eabi.h newlib-stdint.h"
tmake_file="${tmake_file} arm/t-bpabi"
@@ -814,6 +814,12 @@
extra_options="${extra_options} arm/eabi.opt"
@@ -1148,6 +1148,14 @@
use_gcc_stdint=wrap
;;
+ arm*-*-minix*)
+ tm_file="$tm_file arm/eabi.h newlib-stdint.h minix-spec.h minix.h arm/minix.h"
+ tmake_file="${tmake_file} arm/t-bpabi"
+ extra_options="${extra_options} arm/eabi.opt"
+ use_gcc_stdint=wrap
+ ;;
arm*-*-symbianelf*)
tm_file="${tm_file} arm/symbian.h"
# We do not include t-bpabi for Symbian OS because the system
@@ -1148,6 +1154,12 @@
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/x86-64.h i386/freebsd.h i386/freebsd64.h"
tmake_file="${tmake_file} i386/t-crtstuff"
;;
+i[34567]86-*-minix)
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h minix-spec.h minix.h i386/minix.h"
+# tmake_file="t-slibgcc-elf-ver t-minix i386/t-minix"
+# use_fixproto=yes
+ gas=yes
+ gnu_ld=yes
+ extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"

View file

@ -28,10 +28,9 @@ AFLAGS+=-D__ASSEMBLY__
CPPFLAGS+= -fno-builtin -Wall -Wno-sign-compare
.if ${MACHINE_ARCH} == "i386"
CPPFLAGS+= -march=i586
CPUFLAGS+= -march=i586
.elif ${MACHINE_ARCH} == "arm"
CPPFLAGS+= -march=armv7-a
CPPFLAGS+= -D__minix
CPUFLAGS+= -march=armv7-a -mfloat-abi=softfp
.endif
# LSC In the current state there is too much to be done

View file

@ -713,10 +713,13 @@ SHLIB_VERSION_FILE?= ${.CURDIR}/shlib_version
# GNU sources and packages sometimes see architecture names differently.
#
GNU_ARCH.coldfire=m68k
# MINIX/arm default
GNU_ARCH.earm=arm
GCC_CONFIG_ARCH.earm=armv7-a
GNU_ARCH.earmeb=armeb
GNU_ARCH.i386=i486
GCC_CONFIG_ARCH.i386=i486
# MINIX/intel default
GNU_ARCH.i386=i586
GCC_CONFIG_ARCH.i386=i586
GCC_CONFIG_TUNE.i386=nocona
GCC_CONFIG_TUNE.x86_64=nocona
GNU_ARCH.m68000=m68010

View file

@ -2,6 +2,9 @@
.include <bsd.own.mk>
# 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