config:
[official-gcc.git] / gcc / config / arm / netbsd.h
blob17d3d2c93cec732fea66ca981d9b05bc0d6a0068
1 /* NetBSD/arm a.out version.
2 Copyright (C) 1993, 1994, 1997, 1998 Free Software Foundation, Inc.
3 Contributed by Mark Brinicombe (amb@physig.ph.kcl.ac.uk)
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 /* Run-time Target Specification. */
23 #undef TARGET_VERSION
24 #define TARGET_VERSION fputs (" (ARM/NetBSD)", stderr);
26 /* This is used in ASM_FILE_START. */
27 #undef ARM_OS_NAME
28 #define ARM_OS_NAME "NetBSD"
30 /* Unsigned chars produces much better code than signed. */
31 #define DEFAULT_SIGNED_CHAR 0
33 /* Since we always use GAS as our assembler we support stabs. */
34 #define DBX_DEBUGGING_INFO 1
36 /*#undef ASM_DECLARE_FUNCTION_NAME*/
38 /* ARM6 family default cpu. */
39 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
41 /* Default is to use APCS-32 mode. */
42 #undef TARGET_DEFAULT
43 #define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_FRAME)
45 /* Some defines for CPP.
46 arm32 is the NetBSD port name, so we always define arm32 and __arm32__. */
47 #define TARGET_OS_CPP_BUILTINS() \
48 do { \
49 builtin_define_std ("arm32"); \
50 builtin_define_std ("unix"); \
51 builtin_define_std ("riscbsd"); \
52 builtin_define ("__NetBSD__"); \
53 builtin_assert ("system=unix"); \
54 builtin_assert ("system=NetBSD"); \
55 } while (0)
57 /* Define _POSIX_SOURCE if necessary. */
58 #undef CPP_SPEC
59 #define CPP_SPEC "\
60 %(cpp_cpu_arch) %(cpp_apcs_pc) %(cpp_float) %(cpp_endian) \
61 %{posix:-D_POSIX_SOURCE} \
64 /* Because TARGET_DEFAULT sets ARM_FLAG_APCS_32 */
65 #undef CPP_APCS_PC_DEFAULT_SPEC
66 #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
68 /* Because TARGET_DEFAULT sets ARM_FLAG_SOFT_FLOAT */
69 #undef CPP_FLOAT_DEFAULT_SPEC
70 #define CPP_FLOAT_DEFAULT_SPEC "-D__SOFTFP__"
72 /* Pass -X to the linker so that it will strip symbols starting with 'L' */
73 #undef LINK_SPEC
74 #define LINK_SPEC "\
75 -X %{!shared:%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{R*} \
76 %{static:-Bstatic}} %{shared} %{assert*} \
79 #undef SIZE_TYPE
80 #define SIZE_TYPE "unsigned int"
82 #undef PTRDIFF_TYPE
83 #define PTRDIFF_TYPE "int"
85 #define HANDLE_SYSV_PRAGMA
87 /* We don't have any limit on the length as out debugger is GDB. */
88 #undef DBX_CONTIN_LENGTH
90 /* NetBSD does its profiling differently to the Acorn compiler. We
91 don't need a word following the mcount call; and to skip it
92 requires either an assembly stub or use of fomit-frame-pointer when
93 compiling the profiling functions. Since we break Acorn CC
94 compatibility below a little more won't hurt. */
96 #undef ARM_FUNCTION_PROFILER
97 #define ARM_FUNCTION_PROFILER(STREAM,LABELNO) \
98 { \
99 fprintf(STREAM, "\tmov\t%sip, %slr\n", REGISTER_PREFIX, REGISTER_PREFIX); \
100 fprintf(STREAM, "\tbl\tmcount\n"); \
103 /* On the ARM `@' introduces a comment, so we must use something else
104 for .type directives. */
105 #undef TYPE_OPERAND_FMT
106 #define TYPE_OPERAND_FMT "%%%s"
108 /* NetBSD uses the old PCC style aggregate returning conventions. */
109 #undef DEFAULT_PCC_STRUCT_RETURN
110 #define DEFAULT_PCC_STRUCT_RETURN 1
112 /* Although not normally relevant (since by default, all aggregates
113 are returned in memory) compiling some parts of libc requires
114 non-APCS style struct returns. */
115 #undef RETURN_IN_MEMORY
117 /* VERY BIG NOTE : Change of structure alignment for RiscBSD.
118 There are consequences you should be aware of...
120 Normally GCC/arm uses a structure alignment of 32 for compatibility
121 with armcc. This means that structures are padded to a word
122 boundary. However this causes problems with bugged NetBSD kernel
123 code (possibly userland code as well - I have not checked every
124 binary). The nature of this bugged code is to rely on sizeof()
125 returning the correct size of various structures rounded to the
126 nearest byte (SCSI and ether code are two examples, the vm system
127 is another). This code breaks when the structure alignment is 32
128 as sizeof() will report a word=rounded size. By changing the
129 structure alignment to 8. GCC will conform to what is expected by
130 NetBSD.
132 This has several side effects that should be considered.
133 1. Structures will only be aligned to the size of the largest member.
134 i.e. structures containing only bytes will be byte aligned.
135 structures containing shorts will be half word alinged.
136 structures containing ints will be word aligned.
138 This means structures should be padded to a word boundary if
139 alignment of 32 is required for byte structures etc.
141 2. A potential performance penalty may exist if strings are no longer
142 word aligned. GCC will not be able to use word load/stores to copy
143 short strings.
145 This modification is not encouraged but with the present state of the
146 NetBSD source tree it is currently the only solution that meets the
147 requirements. */
148 #undef DEFAULT_STRUCTURE_SIZE_BOUNDARY
149 #define DEFAULT_STRUCTURE_SIZE_BOUNDARY 8