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)
6 This file is part of GCC.
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.
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.
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. */
23 /* Run-time Target Specification. */
25 #define TARGET_VERSION fputs (" (ARM/NetBSD)", stderr);
27 /* Unsigned chars produces much better code than signed. */
28 #define DEFAULT_SIGNED_CHAR 0
30 /* Since we always use GAS as our assembler we support stabs. */
31 #define DBX_DEBUGGING_INFO 1
33 /*#undef ASM_DECLARE_FUNCTION_NAME*/
35 /* ARM6 family default cpu. */
36 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
39 #define TARGET_DEFAULT (MASK_APCS_FRAME)
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() \
45 NETBSD_OS_CPP_BUILTINS_AOUT(); \
46 builtin_define_std ("arm32"); \
47 builtin_define_std ("unix"); \
48 builtin_define_std ("riscbsd"); \
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 },
58 %(cpp_cpu_arch) %(cpp_float) %(cpp_endian) %(netbsd_cpp_spec) \
61 /* Because TARGET_DEFAULT sets MASK_SOFT_FLOAT */
62 #undef CPP_FLOAT_DEFAULT_SPEC
63 #define CPP_FLOAT_DEFAULT_SPEC "-D__SOFTFP__"
65 /* Pass -X to the linker so that it will strip symbols starting with 'L' */
67 #define LINK_SPEC "-X %(netbsd_link_spec)"
70 #define SIZE_TYPE "unsigned int"
73 #define PTRDIFF_TYPE "int"
75 #define HANDLE_SYSV_PRAGMA 1
77 /* We don't have any limit on the length as out debugger is GDB. */
78 #undef DBX_CONTIN_LENGTH
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. */
86 #undef ARM_FUNCTION_PROFILER
87 #define ARM_FUNCTION_PROFILER(STREAM,LABELNO) \
89 fprintf(STREAM, "\tmov\t%sip, %slr\n", REGISTER_PREFIX, REGISTER_PREFIX); \
90 fprintf(STREAM, "\tbl\tmcount\n"); \
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"
98 /* NetBSD uses the old PCC style aggregate returning conventions. */
99 #undef DEFAULT_PCC_STRUCT_RETURN
100 #define DEFAULT_PCC_STRUCT_RETURN 1
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
107 /* VERY BIG NOTE : Change of structure alignment for RiscBSD.
108 There are consequences you should be aware of...
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
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.
128 This means structures should be padded to a word boundary if
129 alignment of 32 is required for byte structures etc.
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
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
138 #undef DEFAULT_STRUCTURE_SIZE_BOUNDARY
139 #define DEFAULT_STRUCTURE_SIZE_BOUNDARY 8
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) \
145 extern int sysarch(int number, void *args); \
150 s.addr = (unsigned int)(BEG); \
151 s.len = (END) - (BEG); \
152 (void)sysarch(0, &s); \