Allow netbsd target to also set structure size boundary
[official-gcc.git] / gcc / config / arm / netbsd.h
blob4c8ce4094fc092ad708599e2feed022cb3d52292
1 /* NetBSD/arm (RiscBSD) 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 #define TARGET_VERSION fputs (" (ARM/NetBSD)", stderr);
25 /* This is used in ASM_FILE_START. */
26 #define ARM_OS_NAME "NetBSD"
28 /* Unsigned chars produces much better code than signed. */
29 #define DEFAULT_SIGNED_CHAR 0
31 /* Since we always use GAS as our assembler we support stabs. */
32 #define DBX_DEBUGGING_INFO 1
34 /*#undef ASM_DECLARE_FUNCTION_NAME*/
36 /* ARM6 family default cpu. */
37 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
39 /* Default is to use APCS-32 mode. */
40 #define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_SOFT_FLOAT)
42 #include "arm/aout.h"
44 /* This gets redefined in config/netbsd.h. */
45 #undef TARGET_MEM_FUNCTIONS
47 #include <netbsd.h>
49 /* Until they use ELF or something that handles dwarf2 unwinds
50 and initialization stuff better. */
51 #undef DWARF2_UNWIND_INFO
53 /* Some defines for CPP.
54 arm32 is the NetBSD port name, so we always define arm32 and __arm32__. */
55 #undef CPP_PREDEFINES
56 #define CPP_PREDEFINES "\
57 -Dunix -Driscbsd -Darm32 -D__arm32__ -D__arm__ -D__NetBSD__ \
58 -Asystem(unix) -Asystem(NetBSD) -Acpu(arm) -Amachine(arm)"
60 /* Define _POSIX_SOURCE if necessary. */
61 #undef CPP_SPEC
62 #define CPP_SPEC "\
63 %(cpp_cpu_arch) %(cpp_apcs_pc) %(cpp_float) %(cpp_endian) \
64 %{posix:-D_POSIX_SOURCE} \
67 /* Because TARGET_DEFAULT sets ARM_FLAG_APCS_32 */
68 #undef CPP_APCS_PC_DEFAULT_SPEC
69 #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
71 /* Because TARGET_DEFAULT sets ARM_FLAG_SOFT_FLOAT */
72 #undef CPP_FLOAT_DEFAULT_SPEC
73 #define CPP_FLOAT_DEFAULT_SPEC "-D__SOFTFP__"
75 /* Pass -X to the linker so that it will strip symbols starting with 'L' */
76 #undef LINK_SPEC
77 #define LINK_SPEC "\
78 -X %{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{R*} \
79 %{static:-Bstatic} %{assert*} \
82 #undef SIZE_TYPE
83 #define SIZE_TYPE "unsigned int"
85 #undef PTRDIFF_TYPE
86 #define PTRDIFF_TYPE "int"
88 #undef WCHAR_TYPE
89 #define WCHAR_TYPE "int"
91 #undef WCHAR_UNSIGNED
92 #define WCHAR_UNSIGNED 0
94 #undef WCHAR_TYPE_SIZE
95 #define WCHAR_TYPE_SIZE 32
97 #define HANDLE_SYSV_PRAGMA
99 /* We don't have any limit on the length as out debugger is GDB. */
100 #undef DBX_CONTIN_LENGTH
102 /* NetBSD does its profiling differently to the Acorn compiler. We
103 don't need a word following the mcount call; and to skip it
104 requires either an assembly stub or use of fomit-frame-pointer when
105 compiling the profiling functions. Since we break Acorn CC
106 compatibility below a little more won't hurt. */
108 #undef FUNCTION_PROFILER
109 #define FUNCTION_PROFILER(STREAM,LABELNO) \
111 fprintf(STREAM, "\tmov\t%sip, %slr\n", REGISTER_PREFIX, REGISTER_PREFIX); \
112 fprintf(STREAM, "\tbl\tmcount\n"); \
115 /* On the ARM `@' introduces a comment, so we must use something else
116 for .type directives. */
117 #undef TYPE_OPERAND_FMT
118 #define TYPE_OPERAND_FMT "%%%s"
120 /* NetBSD uses the old PCC style aggregate returning conventions. */
121 #undef DEFAULT_PCC_STRUCT_RETURN
122 #define DEFAULT_PCC_STRUCT_RETURN 1
124 /* Although not normally relevant (since by default, all aggregates
125 are returned in memory) compiling some parts of libc requires
126 non-APCS style struct returns. */
127 #undef RETURN_IN_MEMORY
129 /* VERY BIG NOTE : Change of structure alignment for RiscBSD.
130 There are consequences you should be aware of...
132 Normally GCC/arm uses a structure alignment of 32 for compatibility
133 with armcc. This means that structures are padded to a word
134 boundary. However this causes problems with bugged NetBSD kernel
135 code (possibly userland code as well - I have not checked every
136 binary). The nature of this bugged code is to rely on sizeof()
137 returning the correct size of various structures rounded to the
138 nearest byte (SCSI and ether code are two examples, the vm system
139 is another). This code breaks when the structure alignment is 32
140 as sizeof() will report a word=rounded size. By changing the
141 structure alignment to 8. GCC will conform to what is expected by
142 NetBSD.
144 This has several side effects that should be considered.
145 1. Structures will only be aligned to the size of the largest member.
146 i.e. structures containing only bytes will be byte aligned.
147 structures containing shorts will be half word alinged.
148 structures containing ints will be word aligned.
150 This means structures should be padded to a word boundary if
151 alignment of 32 is required for byte structures etc.
153 2. A potential performance penalty may exist if strings are no longer
154 word aligned. GCC will not be able to use word load/stores to copy
155 short strings.
157 This modification is not encouraged but with the present state of the
158 NetBSD source tree it is currently the only solution that meets the
159 requirements. */
160 #undef DEFAULT_STRUCTURE_SIZE_BOUNDARY
161 #define DEFAULT_STRUCTURE_SIZE_BOUNDARY 8