Initial revision
[official-gcc.git] / gcc / config / arm / netbsd.h
blob2bcd165181a73d391273c77dd0bc3ee5b9c5d571
1 /*
2 NetBSD/arm (RiscBSD) version.
3 Copyright (C) 1993, 1994 Free Software Foundation, Inc.
4 Contributed by Mark Brinicombe (amb@physig.ph.kcl.ac.uk)
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, 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
42 #include "arm/aout.h"
44 /* This gets redefined in config/netbsd.h. */
45 #undef TARGET_MEM_FUNCTIONS
47 #include <netbsd.h>
49 /* Some defines for CPP.
50 arm32 is the NetBSD port name, so we always define arm32 and __arm32__. */
51 #undef CPP_PREDEFINES
52 #define CPP_PREDEFINES "\
53 -Dunix -Driscbsd -Darm32 -D__arm32__ -D__NetBSD__ \
54 -Asystem(unix) -Asystem(NetBSD) -Acpu(arm) -Amachine(arm)"
56 /* Define _POSIX_SOURCE if necessary. */
57 #undef CPP_SPEC
58 #define CPP_SPEC "\
59 %(cpp_cpu_arch) %(cpp_apcs_pc) %(cpp_float) %(cpp_endian) \
60 %{posix:-D_POSIX_SOURCE} \
63 /* Because TARGET_DEFAULT sets ARM_FLAG_APCS_32 */
64 #undef CPP_APCS_PC_DEFAULT_SPEC
65 #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
67 #undef SIZE_TYPE
68 #define SIZE_TYPE "unsigned int"
70 #undef PTRDIFF_TYPE
71 #define PTRDIFF_TYPE "int"
73 #undef WCHAR_TYPE
74 #define WCHAR_TYPE "int"
76 #undef WCHAR_UNSIGNED
77 #define WCHAR_UNSIGNED 0
79 #undef WCHAR_TYPE_SIZE
80 #define WCHAR_TYPE_SIZE 32
82 #define HANDLE_SYSV_PRAGMA
84 /* We don't have any limit on the length as out debugger is GDB. */
85 #undef DBX_CONTIN_LENGTH
87 /* NetBSD does its profiling differently to the Acorn compiler. We
88 don't need a word following the mcount call; and to skip it
89 requires either an assembly stub or use of fomit-frame-pointer when
90 compiling the profiling functions. Since we break Acorn CC
91 compatibility below a little more won't hurt. */
93 #undef FUNCTION_PROFILER
94 #define FUNCTION_PROFILER(STREAM,LABELNO) \
95 { \
96 fprintf(STREAM, "\tmov\t%sip, %slr\n", REGISTER_PREFIX, REGISTER_PREFIX); \
97 fprintf(STREAM, "\tbl\tmcount\n"); \
100 /* VERY BIG NOTE : Change of structure alignment for RiscBSD.
101 There are consequences you should be aware of...
103 Normally GCC/arm uses a structure alignment of 32 for compatibility
104 with armcc. This means that structures are padded to a word
105 boundry. However this causes problems with bugged NetBSD kernel
106 code (possibly userland code as well - I have not checked every
107 binary). The nature of this bugged code is to rely on sizeof()
108 returning the correct size of various structures rounded to the
109 nearest byte (SCSI and ether code are two examples, the vm system
110 is another). This code breaks when the structure alignment is 32
111 as sizeof() will report a word=rounded size. By changing the
112 structure alignment to 8. GCC will conform to what is expected by
113 NetBSD.
115 This has several side effects that should be considered.
116 1. Structures will only be aligned to the size of the largest member.
117 i.e. structures containing only bytes will be byte aligned.
118 structures containing shorts will be half word alinged.
119 structures containing ints will be word aligned.
121 This means structures should be padded to a word boundry if
122 alignment of 32 is required for byte structures etc.
124 2. A potential performance penalty may exist if strings are no longer
125 word aligned. GCC will not be able to use word load/stores to copy
126 short strings.
128 This modification is not encouraged but with the present state of the
129 NetBSD source tree it is currently the only solution that meets the
130 requirements. */
131 #undef STRUCTURE_SIZE_BOUNDARY
132 #define STRUCTURE_SIZE_BOUNDARY 8