xref: /minix/external/gpl3/gcc/files/arm-minix.h (revision 045e0ed3)
1 /* Definitions for ARM running MINIX using the ELF format
2    Copyright (C) 2001, 2004, 2007 Free Software Foundation, Inc.
3    Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi.
4    Adapted for MINIX by Lionel Sambuc <lionel@minix3.org>
5 
6    This file is part of GCC.
7 
8    GCC is free software; you can redistribute it and/or modify it
9    under the terms of the GNU General Public License as published
10    by the Free Software Foundation; either version 3, or (at your
11    option) any later version.
12 
13    GCC is distributed in the hope that it will be useful, but WITHOUT
14    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
16    License for more details.
17 
18    You should have received a copy of the GNU General Public License
19    along with GCC; see the file COPYING3.  If not see
20    <http://www.gnu.org/licenses/>.  */
21 
22 #undef MINIX_TARGET_CPU_CPP_BUILTINS
23 #define MINIX_TARGET_CPU_CPP_BUILTINS()		\
24   do						\
25     {						\
26       TARGET_BPABI_CPP_BUILTINS();		\
27       if (ARM_EABI_UNWIND_TABLES)		\
28         builtin_define ("__UNWIND_TABLES__");	\
29     }						\
30   while (0)
31 
32 /* Define the actual types of some ANSI-mandated types.
33    Needs to agree with <machine/ansi.h>.  GCC defaults come from c-decl.c,
34    c-common.c, and config/<arch>/<arch>.h. */
35 #undef  SIZE_TYPE
36 #define SIZE_TYPE	"unsigned int"
37 
38 #undef  PTRDIFF_TYPE
39 #define PTRDIFF_TYPE	"int"
40 
41 #undef WCHAR_TYPE
42 #define WCHAR_TYPE	"int"
43 
44 #undef WINT_TYPE
45 #define WINT_TYPE	"int"
46 
47 /* We don't have any limit on the length as out debugger is GDB.  */
48 #undef DBX_CONTIN_LENGTH
49 
50 /* NetBSD does its profiling differently to the Acorn compiler. We
51    don't need a word following the mcount call; and to skip it
52    requires either an assembly stub or use of fomit-frame-pointer when
53    compiling the profiling functions.  Since we break Acorn CC
54    compatibility below a little more won't hurt.  */
55 
56 #undef ARM_FUNCTION_PROFILER
57 #define ARM_FUNCTION_PROFILER(STREAM,LABELNO)           \
58 {                                                       \
59   asm_fprintf (STREAM, "\tmov\t%Rip, %Rlr\n");          \
60   asm_fprintf (STREAM, "\tbl\t__mcount%s\n",            \
61                (TARGET_ARM && NEED_PLT_RELOC)           \
62                ? "(PLT)" : "");                         \
63 }
64 
65 /* VERY BIG NOTE: Change of structure alignment for NetBSD/arm.
66    There are consequences you should be aware of...
67 
68    Normally GCC/arm uses a structure alignment of 32 for compatibility
69    with armcc.  This means that structures are padded to a word
70    boundary.  However this causes problems with bugged NetBSD kernel
71    code (possibly userland code as well - I have not checked every
72    binary).  The nature of this bugged code is to rely on sizeof()
73    returning the correct size of various structures rounded to the
74    nearest byte (SCSI and ether code are two examples, the vm system
75    is another).  This code breaks when the structure alignment is 32
76    as sizeof() will report a word=rounded size.  By changing the
77    structure alignment to 8. GCC will conform to what is expected by
78    NetBSD.
79 
80    This has several side effects that should be considered.
81    1. Structures will only be aligned to the size of the largest member.
82       i.e. structures containing only bytes will be byte aligned.
83            structures containing shorts will be half word aligned.
84            structures containing ints will be word aligned.
85 
86       This means structures should be padded to a word boundary if
87       alignment of 32 is required for byte structures etc.
88 
89    2. A potential performance penalty may exist if strings are no longer
90       word aligned.  GCC will not be able to use word load/stores to copy
91       short strings.
92 
93    This modification is not encouraged but with the present state of the
94    NetBSD source tree it is currently the only solution that meets the
95    requirements.  */
96 
97 #undef DEFAULT_STRUCTURE_SIZE_BOUNDARY
98 #define DEFAULT_STRUCTURE_SIZE_BOUNDARY 8
99 
100 /* Fixed-sized enum by default (-fno-short-enums) */
101 #undef MINIX_CC1_SPEC
102 #define MINIX_CC1_SPEC	"%{!fshort-enums:%{!fno-short-enums:-fno-short-enums}} "
103 
104 /* Use by default the new abi and calling standard */
105 #undef ARM_DEFAULT_ABI
106 #define ARM_DEFAULT_ABI ARM_ABI_AAPCS
107 
108 #undef ARM_EABI_UNWIND_TABLES
109 #define ARM_EABI_UNWIND_TABLES 0
110 #undef ARM_UNWIND_INFO
111 #define ARM_UNWIND_INFO 0
112 #undef ARM_DWARF_UNWIND_TABLES
113 #define ARM_DWARF_UNWIND_TABLES 1
114 
115 /* LSC: FIXME: When activated, some programs crash on qemu with an illegal
116  *             instruction.
117  *             The cause is unknown (Missing support on MINIX, missing support
118  *             on the emulator, library error...).
119  */
120 #if 0
121 /* Make sure we use hard-floating point ABI by default */
122 #undef TARGET_DEFAULT_FLOAT_ABI
123 #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
124 #endif
125 
126 #if defined(NETBSD_NATIVE)
127 /* LSC: On arm, when compiling statically, we need gcc_eh. */
128 #undef MINIX_LINK_GCC_C_SEQUENCE_SPEC
129 #define MINIX_LINK_GCC_C_SEQUENCE_SPEC \
130 	"%{static:--start-group} %G %L -lgcc_eh %{static:--end-group}%{!static:%G}"
131 #endif /* defined(NETBSD_NATIVE) */
132 
133 /* Default to full VFP if -mhard-float is specified.  */
134 #undef MINIX_SUBTARGET_ASM_FLOAT_SPEC
135 #define MINIX_SUBTARGET_ASM_FLOAT_SPEC					\
136 	"%{mhard-float:%{!mfpu=*:-mfpu=vfpv3-d16}}			\
137 	 %{mfloat-abi=hard:%{!mfpu=*:-mfpu=vfpv3-d16}}"
138 
139 #undef MINIX_SUBTARGET_EXTRA_ASM_SPEC
140 #define MINIX_SUBTARGET_EXTRA_ASM_SPEC					\
141 	"%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu;:-meabi=5}"		\
142 	TARGET_FIX_V4BX_SPEC						\
143 	"%{fpic|fpie:-k} %{fPIC|fPIE:-k}"
144 
145 /* Little endian by default */
146 #undef TARGET_ENDIAN_DEFAULT
147 #define TARGET_ENDIAN_DEFAULT 0
148 
149 #undef  SUBTARGET_CPU_DEFAULT
150 #define SUBTARGET_CPU_DEFAULT	TARGET_CPU_cortexa8
151