Add our ARM backend to prepare for later gnat cross-compile adventures.
Rein damit pascal@
This commit is contained in:
parent
eca6c378a6
commit
ec81b8ac15
@ -1,6 +1,6 @@
|
||||
# $OpenBSD: Makefile,v 1.89 2012/12/28 14:32:00 espie Exp $
|
||||
# $OpenBSD: Makefile,v 1.90 2013/01/27 15:00:23 tobiasu Exp $
|
||||
|
||||
ONLY_FOR_ARCHS = alpha i386 m68k sparc sparc64 powerpc vax amd64
|
||||
ONLY_FOR_ARCHS = alpha i386 m68k sparc sparc64 powerpc vax amd64 arm
|
||||
#BROKEN=adjust for types changes
|
||||
DPB_PROPERTIES = parallel
|
||||
|
||||
|
23
lang/gcc/4.2/patches/patch-gcc_config_arm_arm_c
Normal file
23
lang/gcc/4.2/patches/patch-gcc_config_arm_arm_c
Normal file
@ -0,0 +1,23 @@
|
||||
$OpenBSD: patch-gcc_config_arm_arm_c,v 1.1 2013/01/27 15:00:23 tobiasu Exp $
|
||||
--- gcc/config/arm/arm.c.orig Sat Jan 26 16:31:12 2013
|
||||
+++ gcc/config/arm/arm.c Sat Jan 26 16:32:40 2013
|
||||
@@ -3216,7 +3216,8 @@ legitimize_pic_address (rtx orig, enum machine_mode mo
|
||||
gcc_assert (!no_new_pseudos);
|
||||
if (arm_pic_register != INVALID_REGNUM)
|
||||
{
|
||||
- cfun->machine->pic_reg = gen_rtx_REG (Pmode, arm_pic_register);
|
||||
+ if (!cfun->machine->pic_reg)
|
||||
+ cfun->machine->pic_reg = gen_rtx_REG (Pmode, arm_pic_register);
|
||||
|
||||
/* Play games to avoid marking the function as needing pic
|
||||
if we are being called as part of the cost-estimation
|
||||
@@ -3228,7 +3229,8 @@ legitimize_pic_address (rtx orig, enum machine_mode mo
|
||||
{
|
||||
rtx seq;
|
||||
|
||||
- cfun->machine->pic_reg = gen_reg_rtx (Pmode);
|
||||
+ if (!cfun->machine->pic_reg)
|
||||
+ cfun->machine->pic_reg = gen_reg_rtx (Pmode);
|
||||
|
||||
/* Play games to avoid marking the function as needing pic
|
||||
if we are being called as part of the cost-estimation
|
238
lang/gcc/4.2/patches/patch-gcc_config_arm_openbsd_h
Normal file
238
lang/gcc/4.2/patches/patch-gcc_config_arm_openbsd_h
Normal file
@ -0,0 +1,238 @@
|
||||
$OpenBSD: patch-gcc_config_arm_openbsd_h,v 1.1 2013/01/27 15:00:23 tobiasu Exp $
|
||||
--- gcc/config/arm/openbsd.h.orig Sat Jan 26 16:08:59 2013
|
||||
+++ gcc/config/arm/openbsd.h Sat Jan 26 16:08:49 2013
|
||||
@@ -0,0 +1,234 @@
|
||||
+/* Definitions of target machine for GNU compiler, OpenBSD/arm ELF version.
|
||||
+ Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
+ Contributed by Wasabi Systems, Inc.
|
||||
+
|
||||
+This file is part of GNU CC.
|
||||
+
|
||||
+GNU CC 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 2, or (at your option)
|
||||
+any later version.
|
||||
+
|
||||
+GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
+the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
+Boston, MA 02111-1307, USA. */
|
||||
+
|
||||
+/* Run-time Target Specification. */
|
||||
+#undef TARGET_VERSION
|
||||
+#define TARGET_VERSION fputs (" (OpenBSD/arm)", stderr);
|
||||
+
|
||||
+/* This is used in ASM_FILE_START. */
|
||||
+#undef ARM_OS_NAME
|
||||
+#define ARM_OS_NAME "OpenBSD"
|
||||
+
|
||||
+/* Unsigned chars produces much better code than signed. */
|
||||
+#define DEFAULT_SIGNED_CHAR 0
|
||||
+
|
||||
+
|
||||
+/* This defaults us to little-endian. */
|
||||
+#ifndef TARGET_ENDIAN_DEFAULT
|
||||
+#define TARGET_ENDIAN_DEFAULT 0
|
||||
+#endif
|
||||
+
|
||||
+#undef MULTILIB_DEFAULTS
|
||||
+
|
||||
+/* strongarm family default cpu. */
|
||||
+#define SUBTARGET_CPU_DEFAULT TARGET_CPU_strongarm
|
||||
+
|
||||
+/* Default is to use APCS-32 mode. */
|
||||
+
|
||||
+/* Default it to use ATPCS with soft-VFP. */
|
||||
+#undef TARGET_DEFAULT
|
||||
+#define TARGET_DEFAULT \
|
||||
+ (MASK_APCS_FRAME \
|
||||
+ | TARGET_ENDIAN_DEFAULT)
|
||||
+
|
||||
+
|
||||
+#define TARGET_OS_CPP_BUILTINS() \
|
||||
+ do \
|
||||
+ { \
|
||||
+ OPENBSD_OS_CPP_BUILTINS_ELF(); \
|
||||
+ } \
|
||||
+ while (0)
|
||||
+
|
||||
+#undef SUBTARGET_CPP_SPEC
|
||||
+#define SUBTARGET_CPP_SPEC OBSD_CPP_SPEC
|
||||
+
|
||||
+/* OBSD_LINK_SPEC appropriate for OpenBSD. Support for GCC options
|
||||
+ -static, -assert, and -nostdlib. */
|
||||
+#undef OBSD_LINK_SPEC
|
||||
+#ifdef OBSD_NO_DYNAMIC_LIBRARIES
|
||||
+#define OBSD_LINK_SPEC \
|
||||
+ "%{!nostdlib:%{!r*:%{!e*:-e __start}}} %{assert*}"
|
||||
+#else
|
||||
+#define OBSD_LINK_SPEC \
|
||||
+ "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e __start}}}} \
|
||||
+ %{shared:-shared} %{R*} \
|
||||
+ %{static:-Bstatic} \
|
||||
+ %{!static:-Bdynamic} \
|
||||
+ %{rdynamic:-export-dynamic} \
|
||||
+ %{assert*} \
|
||||
+ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}"
|
||||
+#endif
|
||||
+
|
||||
+#undef SUBTARGET_EXTRA_ASM_SPEC
|
||||
+#define SUBTARGET_EXTRA_ASM_SPEC \
|
||||
+ "-matpcs %{fpic|fPIC|fpie|fPIE:-k}"
|
||||
+
|
||||
+/* Default floating point model is soft-VFP.
|
||||
+ FIXME: -mhard-float currently implies FPA. */
|
||||
+#undef SUBTARGET_ASM_FLOAT_SPEC
|
||||
+#define SUBTARGET_ASM_FLOAT_SPEC \
|
||||
+ "%{mhard-float:-mfpu=fpa} \
|
||||
+ %{msoft-float:-mfpu=softvfp} \
|
||||
+ %{!mhard-float: \
|
||||
+ %{!msoft-float:-mfpu=softvfp}}"
|
||||
+
|
||||
+#undef SUBTARGET_EXTRA_SPECS
|
||||
+#define SUBTARGET_EXTRA_SPECS \
|
||||
+ { "subtarget_extra_asm_spec", SUBTARGET_EXTRA_ASM_SPEC }, \
|
||||
+ { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, \
|
||||
+ { "openbsd_link_spec", OBSD_LINK_SPEC }, \
|
||||
+ { "openbsd_entry_point", OPENBSD_ENTRY_POINT },
|
||||
+
|
||||
+#define OPENBSD_ENTRY_POINT "__start"
|
||||
+
|
||||
+/* Pass -X to the linker so that it will strip symbols starting with 'L' */
|
||||
+#undef LINK_SPEC
|
||||
+#define LINK_SPEC \
|
||||
+ "-X %{mbig-endian:-EB} %{mlittle-endian:-EL} \
|
||||
+ %(openbsd_link_spec)"
|
||||
+
|
||||
+/* Make GCC agree with <machine/_types.h>. */
|
||||
+
|
||||
+#undef SIZE_TYPE
|
||||
+#define SIZE_TYPE "long unsigned int"
|
||||
+
|
||||
+#undef PTRDIFF_TYPE
|
||||
+#define PTRDIFF_TYPE "long int"
|
||||
+
|
||||
+#undef INTMAX_TYPE
|
||||
+#define INTMAX_TYPE "long long int"
|
||||
+
|
||||
+#undef UINTMAX_TYPE
|
||||
+#define UINTMAX_TYPE "long long unsigned int"
|
||||
+
|
||||
+#undef WCHAR_TYPE
|
||||
+#define WCHAR_TYPE "int"
|
||||
+
|
||||
+#undef WCHAR_TYPE_SIZE
|
||||
+#define WCHAR_TYPE_SIZE 32
|
||||
+
|
||||
+/* We don't have any limit on the length as out debugger is GDB. */
|
||||
+#undef DBX_CONTIN_LENGTH
|
||||
+
|
||||
+/* OpenBSD and NetBSD do their profiling differently to the Acorn compiler. We
|
||||
+ don't need a word following the mcount call; and to skip it
|
||||
+ requires either an assembly stub or use of fomit-frame-pointer when
|
||||
+ compiling the profiling functions. Since we break Acorn CC
|
||||
+ compatibility below a little more won't hurt. */
|
||||
+
|
||||
+#undef ARM_FUNCTION_PROFILER
|
||||
+#define ARM_FUNCTION_PROFILER(STREAM,LABELNO) \
|
||||
+{ \
|
||||
+ asm_fprintf (STREAM, "\tmov\t%Rip, %Rlr\n"); \
|
||||
+ asm_fprintf (STREAM, "\tbl\t__mcount%s\n", \
|
||||
+ NEED_PLT_RELOC ? "(PLT)" : ""); \
|
||||
+}
|
||||
+
|
||||
+/* On the ARM `@' introduces a comment, so we must use something else
|
||||
+ for .type directives. */
|
||||
+#undef TYPE_OPERAND_FMT
|
||||
+#define TYPE_OPERAND_FMT "%%%s"
|
||||
+
|
||||
+#undef FPUTYPE_DEFAULT
|
||||
+#define FPUTYPE_DEFAULT FPUTYPE_VFP
|
||||
+
|
||||
+/* VERY BIG NOTE: Change of structure alignment for OpenBSD|NetBSD/arm.
|
||||
+ There are consequences you should be aware of...
|
||||
+
|
||||
+ Normally GCC/arm uses a structure alignment of 32 for compatibility
|
||||
+ with armcc. This means that structures are padded to a word
|
||||
+ boundary. However this causes problems with bugged OpenBSD|NetBSD kernel
|
||||
+ code (possibly userland code as well - I have not checked every
|
||||
+ binary). The nature of this bugged code is to rely on sizeof()
|
||||
+ returning the correct size of various structures rounded to the
|
||||
+ nearest byte (SCSI and ether code are two examples, the vm system
|
||||
+ is another). This code breaks when the structure alignment is 32
|
||||
+ as sizeof() will report a word=rounded size. By changing the
|
||||
+ structure alignment to 8. GCC will conform to what is expected by
|
||||
+ OpenBSD|NetBSD.
|
||||
+
|
||||
+ This has several side effects that should be considered.
|
||||
+ 1. Structures will only be aligned to the size of the largest member.
|
||||
+ i.e. structures containing only bytes will be byte aligned.
|
||||
+ structures containing shorts will be half word alinged.
|
||||
+ structures containing ints will be word aligned.
|
||||
+
|
||||
+ This means structures should be padded to a word boundary if
|
||||
+ alignment of 32 is required for byte structures etc.
|
||||
+
|
||||
+ 2. A potential performance penalty may exist if strings are no longer
|
||||
+ word aligned. GCC will not be able to use word load/stores to copy
|
||||
+ short strings.
|
||||
+
|
||||
+ This modification is not encouraged but with the present state of the
|
||||
+ OpenBSD|NetBSD source tree it is currently the only solution that meets the
|
||||
+ requirements. */
|
||||
+
|
||||
+#undef DEFAULT_STRUCTURE_SIZE_BOUNDARY
|
||||
+#define DEFAULT_STRUCTURE_SIZE_BOUNDARY 8
|
||||
+
|
||||
+/* Clear the instruction cache from `BEG' to `END'. This makes a
|
||||
+ call to the ARM_SYNC_ICACHE architecture specific syscall. */
|
||||
+#define CLEAR_INSN_CACHE(BEG, END) \
|
||||
+do \
|
||||
+ { \
|
||||
+ extern int sysarch(int number, void *args); \
|
||||
+ struct { \
|
||||
+ unsigned int addr; \
|
||||
+ int len; \
|
||||
+ } s; \
|
||||
+ s.addr = (unsigned int)(BEG); \
|
||||
+ s.len = (END) - (BEG); \
|
||||
+ (void) sysarch (0, &s); \
|
||||
+ } \
|
||||
+while (0)
|
||||
+
|
||||
+/* Provide a STARTFILE_SPEC appropriate for OpenBSD ELF. Here we
|
||||
+ provide support for the special GCC option -static. On ELF
|
||||
+ targets, we also add the crtbegin.o file, which provides part
|
||||
+ of the support for getting C++ file-scope static objects
|
||||
+ constructed before entering "main". */
|
||||
+
|
||||
+#define OPENBSD_STARTFILE_SPEC \
|
||||
+ "%{!shared: \
|
||||
+ %{pg:gcrt0%O%s} \
|
||||
+ %{!pg: \
|
||||
+ %{p:gcrt0%O%s} \
|
||||
+ %{!p:crt0%O%s}}} \
|
||||
+ %:if-exists(crti%O%s) \
|
||||
+ %{static:%:if-exists-else(crtbeginT%O%s crtbegin%O%s)} \
|
||||
+ %{!static: \
|
||||
+ %{!shared:crtbegin%O%s} %{shared:crtbeginS%O%s}}"
|
||||
+
|
||||
+#undef STARTFILE_SPEC
|
||||
+#define STARTFILE_SPEC OPENBSD_STARTFILE_SPEC
|
||||
+
|
||||
+/* Provide an ENDFILE_SPEC appropriate for OpenBSD ELF. Here we
|
||||
+add crtend.o, which provides part of the support for getting
|
||||
+C++ file-scope static objects deconstructed after exiting "main". */
|
||||
+
|
||||
+#define OPENBSD_ENDFILE_SPEC \
|
||||
+ "%{!shared:crtend%O%s} %{shared:crtendS%O%s} \
|
||||
+ %:if-exists(crtn%O%s)"
|
||||
+
|
||||
+#undef ENDFILE_SPEC
|
||||
+#define ENDFILE_SPEC OPENBSD_ENDFILE_SPEC
|
||||
+
|
@ -1,5 +1,5 @@
|
||||
--- gcc/config.gcc.orig Thu Mar 13 20:11:43 2008
|
||||
+++ gcc/config.gcc Wed Aug 29 20:54:50 2012
|
||||
+++ gcc/config.gcc Sat Jan 26 17:24:34 2013
|
||||
@@ -555,6 +555,11 @@ case ${target} in
|
||||
*-*-openbsd2.*|*-*-openbsd3.[012])
|
||||
tm_defines="${tm_defines} HAS_LIBC_R=1" ;;
|
||||
@ -27,7 +27,18 @@
|
||||
;;
|
||||
alpha*-dec-osf[45]*)
|
||||
if test x$stabs = xyes
|
||||
@@ -1085,10 +1090,16 @@ i[34567]86-*-openbsd2.*|i[34567]86-*openbsd3.[0123])
|
||||
@@ -694,6 +699,10 @@ arm*-*-freebsd*|strongarm*-*-freebsd*)
|
||||
tm_file="dbxelf.h elfos.h ${fbsd_tm_file} arm/elf.h arm/aout.h arm/freebsd.h arm/arm.h"
|
||||
tmake_file="${tmake_file} arm/t-arm arm/t-strongarm-elf"
|
||||
;;
|
||||
+arm-*-openbsd*)
|
||||
+ tm_file="dbxelf.h elfos.h arm/elf.h arm/aout.h arm/arm.h openbsd.h openbsd-libpthread.h arm/openbsd.h"
|
||||
+ tmake_file="${tmake_file} arm/t-arm"
|
||||
+ ;;
|
||||
arm*-*-netbsdelf*)
|
||||
tm_file="dbxelf.h elfos.h netbsd.h netbsd-elf.h arm/elf.h arm/aout.h arm/arm.h arm/netbsd-elf.h"
|
||||
tmake_file="${tmake_file} arm/t-arm arm/t-netbsd"
|
||||
@@ -1085,10 +1094,16 @@ i[34567]86-*-openbsd2.*|i[34567]86-*openbsd3.[0123])
|
||||
;;
|
||||
i[34567]86-*-openbsd*)
|
||||
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h"
|
||||
@ -45,7 +56,7 @@
|
||||
i[34567]86-*-coff*)
|
||||
tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/i386-coff.h"
|
||||
use_fixproto=yes
|
||||
@@ -1479,7 +1490,7 @@ m68010-*-netbsdelf* | m68k*-*-netbsdelf*)
|
||||
@@ -1479,7 +1494,7 @@ m68010-*-netbsdelf* | m68k*-*-netbsdelf*)
|
||||
m68k*-*-openbsd*)
|
||||
# needed to unconfuse gdb
|
||||
tm_defines="${tm_defines} OBSD_OLD_GAS TARGET_DEFAULT=(MASK_68020|MASK_68881|MASK_BITFIELD)"
|
||||
@ -54,7 +65,7 @@
|
||||
tmake_file="t-libc-ok t-openbsd m68k/t-openbsd"
|
||||
# we need collect2 until our bug is fixed...
|
||||
use_collect2=yes
|
||||
@@ -1569,7 +1580,7 @@ mips*-*-linux*) # Linux MIPS, either endian.
|
||||
@@ -1569,7 +1584,7 @@ mips*-*-linux*) # Linux MIPS, either endian.
|
||||
mips*-*-openbsd*)
|
||||
tm_defines="${tm_defines} OBSD_HAS_DECLARE_FUNCTION_NAME OBSD_HAS_DECLARE_OBJECT OBSD_HAS_CORRECT_SPECS"
|
||||
target_cpu_default="MASK_ABICALLS"
|
||||
@ -63,7 +74,7 @@
|
||||
case ${target} in
|
||||
mips*el-*-openbsd*)
|
||||
tm_defines="${tm_defines} TARGET_ENDIAN_DEFAULT=0";;
|
||||
@@ -1687,11 +1698,11 @@ pdp11-*-bsd)
|
||||
@@ -1687,11 +1702,11 @@ pdp11-*-bsd)
|
||||
pdp11-*-*)
|
||||
use_fixproto=yes
|
||||
;;
|
||||
@ -80,7 +91,7 @@
|
||||
powerpc64-*-linux*)
|
||||
tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h"
|
||||
test x$with_cpu != x || cpu_is_64bit=yes
|
||||
@@ -2163,7 +2174,8 @@ sparc-*-netbsdelf*)
|
||||
@@ -2163,7 +2178,8 @@ sparc-*-netbsdelf*)
|
||||
extra_options="${extra_options} sparc/long-double-switch.opt"
|
||||
;;
|
||||
sparc64-*-openbsd*)
|
||||
@ -90,7 +101,7 @@
|
||||
extra_options="${extra_options} sparc/little-endian.opt"
|
||||
gas=yes gnu_ld=yes
|
||||
with_cpu=ultrasparc
|
||||
@@ -2408,7 +2420,7 @@ vax-*-netbsd*)
|
||||
@@ -2408,7 +2424,7 @@ vax-*-netbsd*)
|
||||
use_collect2=yes
|
||||
;;
|
||||
vax-*-openbsd*)
|
||||
|
Loading…
Reference in New Issue
Block a user