OSDN Git Service

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