]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/gcc/config/arm/netbsd.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / gcc / config / arm / netbsd.h
1 /* NetBSD/arm a.out version.
2    Copyright (C) 1993, 1994, 1997, 1998, 2003, 2004, 2005
3    Free Software Foundation, Inc.
4    Contributed by Mark Brinicombe (amb@physig.ph.kcl.ac.uk)
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 2, 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 COPYING.  If not, write to
20    the Free Software Foundation, 51 Franklin Street, Fifth Floor,
21    Boston, MA 02110-1301, USA.  */
22
23 /* Run-time Target Specification.  */
24 #undef  TARGET_VERSION
25 #define TARGET_VERSION fputs (" (ARM/NetBSD)", stderr);
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 #undef TARGET_DEFAULT
39 #define TARGET_DEFAULT (MASK_APCS_FRAME)
40
41 /* Some defines for CPP.
42    arm32 is the NetBSD port name, so we always define arm32 and __arm32__.  */
43 #define TARGET_OS_CPP_BUILTINS()                \
44     do {                                        \
45         NETBSD_OS_CPP_BUILTINS_AOUT();          \
46         builtin_define_std ("arm32");           \
47         builtin_define_std ("unix");            \
48         builtin_define_std ("riscbsd");         \
49     } while (0)
50
51 #undef SUBTARGET_EXTRA_SPECS
52 #define SUBTARGET_EXTRA_SPECS \
53   { "netbsd_cpp_spec",  NETBSD_CPP_SPEC }, \
54   { "netbsd_link_spec", NETBSD_LINK_SPEC_AOUT },
55
56 #undef CPP_SPEC
57 #define CPP_SPEC "\
58 %(cpp_cpu_arch) %(cpp_float) %(cpp_endian) %(netbsd_cpp_spec) \
59 "
60
61 /* Because TARGET_DEFAULT sets MASK_SOFT_FLOAT */
62 #undef CPP_FLOAT_DEFAULT_SPEC
63 #define CPP_FLOAT_DEFAULT_SPEC "-D__SOFTFP__"
64
65 /* Pass -X to the linker so that it will strip symbols starting with 'L' */
66 #undef LINK_SPEC
67 #define LINK_SPEC "-X %(netbsd_link_spec)"
68
69 #undef SIZE_TYPE
70 #define SIZE_TYPE "unsigned int"
71
72 #undef PTRDIFF_TYPE
73 #define PTRDIFF_TYPE "int"
74
75 #define HANDLE_SYSV_PRAGMA 1
76
77 /* We don't have any limit on the length as out debugger is GDB.  */
78 #undef DBX_CONTIN_LENGTH
79
80 /* NetBSD does its profiling differently to the Acorn compiler. We
81    don't need a word following the mcount call; and to skip it
82    requires either an assembly stub or use of fomit-frame-pointer when
83    compiling the profiling functions.  Since we break Acorn CC
84    compatibility below a little more won't hurt.  */
85
86 #undef  ARM_FUNCTION_PROFILER
87 #define ARM_FUNCTION_PROFILER(STREAM,LABELNO)                               \
88 {                                                                           \
89   fprintf(STREAM, "\tmov\t%sip, %slr\n", REGISTER_PREFIX, REGISTER_PREFIX); \
90   fprintf(STREAM, "\tbl\tmcount\n");                                        \
91 }
92
93 /* On the ARM `@' introduces a comment, so we must use something else
94    for .type directives.  */
95 #undef TYPE_OPERAND_FMT
96 #define TYPE_OPERAND_FMT "%%%s"
97
98 /* NetBSD uses the old PCC style aggregate returning conventions.  */
99 #undef DEFAULT_PCC_STRUCT_RETURN
100 #define DEFAULT_PCC_STRUCT_RETURN 1
101
102 /* Although not normally relevant (since by default, all aggregates
103    are returned in memory) compiling some parts of libc requires
104    non-APCS style struct returns.  */
105 #undef RETURN_IN_MEMORY
106
107 /* VERY BIG NOTE : Change of structure alignment for RiscBSD.
108    There are consequences you should be aware of...
109
110    Normally GCC/arm uses a structure alignment of 32 for compatibility
111    with armcc.  This means that structures are padded to a word
112    boundary.  However this causes problems with bugged NetBSD kernel
113    code (possibly userland code as well - I have not checked every
114    binary).  The nature of this bugged code is to rely on sizeof()
115    returning the correct size of various structures rounded to the
116    nearest byte (SCSI and ether code are two examples, the vm system
117    is another).  This code breaks when the structure alignment is 32
118    as sizeof() will report a word=rounded size.  By changing the
119    structure alignment to 8. GCC will conform to what is expected by
120    NetBSD.
121
122    This has several side effects that should be considered.
123    1. Structures will only be aligned to the size of the largest member.
124       i.e. structures containing only bytes will be byte aligned.
125            structures containing shorts will be half word aligned.
126            structures containing ints will be word aligned.
127
128       This means structures should be padded to a word boundary if
129       alignment of 32 is required for byte structures etc.
130       
131    2. A potential performance penalty may exist if strings are no longer
132       word aligned.  GCC will not be able to use word load/stores to copy
133       short strings.
134       
135    This modification is not encouraged but with the present state of the
136    NetBSD source tree it is currently the only solution that meets the
137    requirements.  */
138 #undef  DEFAULT_STRUCTURE_SIZE_BOUNDARY
139 #define DEFAULT_STRUCTURE_SIZE_BOUNDARY 8
140
141 /* Clear the instruction cache from `BEG' to `END'.  This makes a
142    call to the ARM32_SYNC_ICACHE architecture specific syscall.  */
143 #define CLEAR_INSN_CACHE(BEG, END)                                     \
144 {                                                                      \
145   extern int sysarch(int number, void *args);                          \
146   struct {                                                             \
147     unsigned int  addr;                                                \
148     int           len;                                                 \
149   } s;                                                                 \
150   s.addr = (unsigned int)(BEG);                                        \
151   s.len = (END) - (BEG);                                               \
152   (void)sysarch(0, &s);                                                \
153 }