1 |
38 |
julius |
/* Definitions of target machine for GNU compiler, NetBSD/arm ELF version.
|
2 |
|
|
Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
|
3 |
|
|
Contributed by Wasabi Systems, Inc.
|
4 |
|
|
|
5 |
|
|
This file is part of GCC.
|
6 |
|
|
|
7 |
|
|
GCC is free software; you can redistribute it and/or modify it
|
8 |
|
|
under the terms of the GNU General Public License as published
|
9 |
|
|
by the Free Software Foundation; either version 3, or (at your
|
10 |
|
|
option) any later version.
|
11 |
|
|
|
12 |
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT
|
13 |
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
14 |
|
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
15 |
|
|
License for more details.
|
16 |
|
|
|
17 |
|
|
You should have received a copy of the GNU General Public License
|
18 |
|
|
along with GCC; see the file COPYING3. If not see
|
19 |
|
|
<http://www.gnu.org/licenses/>. */
|
20 |
|
|
|
21 |
|
|
/* Run-time Target Specification. */
|
22 |
|
|
#undef TARGET_VERSION
|
23 |
|
|
#define TARGET_VERSION fputs (" (NetBSD/arm ELF)", stderr);
|
24 |
|
|
|
25 |
|
|
/* arm.h defaults to ARM6 CPU. */
|
26 |
|
|
|
27 |
|
|
/* This defaults us to little-endian. */
|
28 |
|
|
#ifndef TARGET_ENDIAN_DEFAULT
|
29 |
|
|
#define TARGET_ENDIAN_DEFAULT 0
|
30 |
|
|
#endif
|
31 |
|
|
|
32 |
|
|
#undef MULTILIB_DEFAULTS
|
33 |
|
|
|
34 |
|
|
/* Default it to use ATPCS with soft-VFP. */
|
35 |
|
|
#undef TARGET_DEFAULT
|
36 |
|
|
#define TARGET_DEFAULT \
|
37 |
|
|
(MASK_APCS_FRAME \
|
38 |
|
|
| TARGET_ENDIAN_DEFAULT)
|
39 |
|
|
|
40 |
|
|
#undef ARM_DEFAULT_ABI
|
41 |
|
|
#define ARM_DEFAULT_ABI ARM_ABI_ATPCS
|
42 |
|
|
|
43 |
|
|
#define TARGET_OS_CPP_BUILTINS() \
|
44 |
|
|
do \
|
45 |
|
|
{ \
|
46 |
|
|
NETBSD_OS_CPP_BUILTINS_ELF(); \
|
47 |
|
|
} \
|
48 |
|
|
while (0)
|
49 |
|
|
|
50 |
|
|
#undef SUBTARGET_CPP_SPEC
|
51 |
|
|
#define SUBTARGET_CPP_SPEC NETBSD_CPP_SPEC
|
52 |
|
|
|
53 |
|
|
#undef SUBTARGET_EXTRA_ASM_SPEC
|
54 |
|
|
#define SUBTARGET_EXTRA_ASM_SPEC \
|
55 |
|
|
"-matpcs %{fpic|fpie:-k} %{fPIC|fPIE:-k}"
|
56 |
|
|
|
57 |
|
|
/* Default to full VFP if -mhard-float is specified. */
|
58 |
|
|
#undef SUBTARGET_ASM_FLOAT_SPEC
|
59 |
|
|
#define SUBTARGET_ASM_FLOAT_SPEC \
|
60 |
|
|
"%{mhard-float:{!mfpu=*:-mfpu=vfp}} \
|
61 |
|
|
%{mfloat-abi=hard:{!mfpu=*:-mfpu=vfp}}"
|
62 |
|
|
|
63 |
|
|
#undef SUBTARGET_EXTRA_SPECS
|
64 |
|
|
#define SUBTARGET_EXTRA_SPECS \
|
65 |
|
|
{ "subtarget_extra_asm_spec", SUBTARGET_EXTRA_ASM_SPEC }, \
|
66 |
|
|
{ "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, \
|
67 |
|
|
{ "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \
|
68 |
|
|
{ "netbsd_entry_point", NETBSD_ENTRY_POINT },
|
69 |
|
|
|
70 |
|
|
#define NETBSD_ENTRY_POINT "__start"
|
71 |
|
|
|
72 |
|
|
#undef LINK_SPEC
|
73 |
|
|
#define LINK_SPEC \
|
74 |
|
|
"-X %{mbig-endian:-EB} %{mlittle-endian:-EL} \
|
75 |
|
|
%(netbsd_link_spec)"
|
76 |
|
|
|
77 |
|
|
/* Make GCC agree with <machine/ansi.h>. */
|
78 |
|
|
|
79 |
|
|
#undef SIZE_TYPE
|
80 |
|
|
#define SIZE_TYPE "long unsigned int"
|
81 |
|
|
|
82 |
|
|
#undef PTRDIFF_TYPE
|
83 |
|
|
#define PTRDIFF_TYPE "long int"
|
84 |
|
|
|
85 |
|
|
/* We don't have any limit on the length as out debugger is GDB. */
|
86 |
|
|
#undef DBX_CONTIN_LENGTH
|
87 |
|
|
|
88 |
|
|
/* NetBSD does its profiling differently to the Acorn compiler. We
|
89 |
|
|
don't need a word following the mcount call; and to skip it
|
90 |
|
|
requires either an assembly stub or use of fomit-frame-pointer when
|
91 |
|
|
compiling the profiling functions. Since we break Acorn CC
|
92 |
|
|
compatibility below a little more won't hurt. */
|
93 |
|
|
|
94 |
|
|
#undef ARM_FUNCTION_PROFILER
|
95 |
|
|
#define ARM_FUNCTION_PROFILER(STREAM,LABELNO) \
|
96 |
|
|
{ \
|
97 |
|
|
asm_fprintf (STREAM, "\tmov\t%Rip, %Rlr\n"); \
|
98 |
|
|
asm_fprintf (STREAM, "\tbl\t__mcount%s\n", \
|
99 |
|
|
(TARGET_ARM && NEED_PLT_RELOC) \
|
100 |
|
|
? "(PLT)" : ""); \
|
101 |
|
|
}
|
102 |
|
|
|
103 |
|
|
/* VERY BIG NOTE: Change of structure alignment for NetBSD/arm.
|
104 |
|
|
There are consequences you should be aware of...
|
105 |
|
|
|
106 |
|
|
Normally GCC/arm uses a structure alignment of 32 for compatibility
|
107 |
|
|
with armcc. This means that structures are padded to a word
|
108 |
|
|
boundary. However this causes problems with bugged NetBSD kernel
|
109 |
|
|
code (possibly userland code as well - I have not checked every
|
110 |
|
|
binary). The nature of this bugged code is to rely on sizeof()
|
111 |
|
|
returning the correct size of various structures rounded to the
|
112 |
|
|
nearest byte (SCSI and ether code are two examples, the vm system
|
113 |
|
|
is another). This code breaks when the structure alignment is 32
|
114 |
|
|
as sizeof() will report a word=rounded size. By changing the
|
115 |
|
|
structure alignment to 8. GCC will conform to what is expected by
|
116 |
|
|
NetBSD.
|
117 |
|
|
|
118 |
|
|
This has several side effects that should be considered.
|
119 |
|
|
1. Structures will only be aligned to the size of the largest member.
|
120 |
|
|
i.e. structures containing only bytes will be byte aligned.
|
121 |
|
|
structures containing shorts will be half word aligned.
|
122 |
|
|
structures containing ints will be word aligned.
|
123 |
|
|
|
124 |
|
|
This means structures should be padded to a word boundary if
|
125 |
|
|
alignment of 32 is required for byte structures etc.
|
126 |
|
|
|
127 |
|
|
2. A potential performance penalty may exist if strings are no longer
|
128 |
|
|
word aligned. GCC will not be able to use word load/stores to copy
|
129 |
|
|
short strings.
|
130 |
|
|
|
131 |
|
|
This modification is not encouraged but with the present state of the
|
132 |
|
|
NetBSD source tree it is currently the only solution that meets the
|
133 |
|
|
requirements. */
|
134 |
|
|
|
135 |
|
|
#undef DEFAULT_STRUCTURE_SIZE_BOUNDARY
|
136 |
|
|
#define DEFAULT_STRUCTURE_SIZE_BOUNDARY 8
|
137 |
|
|
|
138 |
|
|
/* Clear the instruction cache from `BEG' to `END'. This makes a
|
139 |
|
|
call to the ARM_SYNC_ICACHE architecture specific syscall. */
|
140 |
|
|
#define CLEAR_INSN_CACHE(BEG, END) \
|
141 |
|
|
do \
|
142 |
|
|
{ \
|
143 |
|
|
extern int sysarch(int number, void *args); \
|
144 |
|
|
struct \
|
145 |
|
|
{ \
|
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 |
|
|
} \
|
153 |
|
|
while (0)
|
154 |
|
|
|
155 |
|
|
#undef FPUTYPE_DEFAULT
|
156 |
|
|
#define FPUTYPE_DEFAULT FPUTYPE_VFP
|
157 |
|
|
|