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