]>
Commit | Line | Data |
---|---|---|
4977bab6 | 1 | /* Definitions of target machine for GNU compiler. Vxworks PowerPC version. |
99dee823 | 2 | Copyright (C) 1996-2021 Free Software Foundation, Inc. |
2eab15c9 | 3 | Contributed by CodeSourcery, LLC. |
4977bab6 | 4 | |
2eab15c9 | 5 | This file is part of GCC. |
4977bab6 | 6 | |
2eab15c9 PE |
7 | GCC is free software; you can redistribute it and/or modify it under |
8 | the terms of the GNU General Public License as published by the Free | |
2f83c7d6 | 9 | Software Foundation; either version 3, or (at your option) any later |
2eab15c9 | 10 | version. |
4977bab6 | 11 | |
2eab15c9 PE |
12 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
13 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 | for more details. | |
4977bab6 | 16 | |
2eab15c9 | 17 | You should have received a copy of the GNU General Public License |
2f83c7d6 NC |
18 | along with GCC; see the file COPYING3. If not see |
19 | <http://www.gnu.org/licenses/>. */ | |
4977bab6 | 20 | |
17867980 DR |
21 | /* The port comes in two very different flavors at this stage: |
22 | ||
23 | - For 653 (AE) and regular versions prior to VxWorks 7, the port | |
24 | comes with its own set of definitions, matching a system compiler | |
25 | configured this way as well as the corresponding run-time | |
26 | environment. This is essentially an eabi system, so changes to | |
27 | eabi.h should usually be reflected here. | |
28 | ||
29 | - Starting with VxWorks 7 (post SR600), the system environment | |
30 | was made extremely similar to GNU/Linux and this toolchain is | |
31 | built on top of the corresponding header files. */ | |
32 | ||
33 | /*-------------------------------------------------------------*/ | |
34 | /* Common definitions first. */ | |
35 | /*-------------------------------------------------------------*/ | |
2eab15c9 | 36 | |
2eab15c9 PE |
37 | /* CPP predefined macros. */ |
38 | ||
39 | #undef TARGET_OS_CPP_BUILTINS | |
cc956ba2 NB |
40 | #define TARGET_OS_CPP_BUILTINS() \ |
41 | do \ | |
42 | { \ | |
2eab15c9 | 43 | builtin_define ("__ELF__"); \ |
5b00bcc5 OH |
44 | if (!TARGET_VXWORKS7) \ |
45 | builtin_define ("__EABI__"); \ | |
46 | \ | |
47 | /* CPU macros, based on what the system compilers do. */ \ | |
48 | if (!TARGET_VXWORKS7) \ | |
49 | { \ | |
50 | builtin_define ("__ppc"); \ | |
51 | /* Namespace violation below, but the system headers \ | |
52 | really depend heavily on this. */ \ | |
53 | builtin_define ("CPU_FAMILY=PPC"); \ | |
54 | \ | |
55 | /* __PPC__ isn't actually emitted by the system compiler \ | |
56 | prior to vx7 but has been advertised by us for ages. */ \ | |
57 | builtin_define ("__PPC__"); \ | |
58 | } \ | |
59 | else \ | |
60 | { \ | |
61 | builtin_define ("__PPC__"); \ | |
62 | builtin_define ("__powerpc__"); \ | |
63 | if (TARGET_64BIT) \ | |
64 | { \ | |
65 | builtin_define ("__PPC64__"); \ | |
66 | builtin_define ("__powerpc64__"); \ | |
67 | } \ | |
68 | else \ | |
69 | { \ | |
70 | builtin_define ("__PPC"); \ | |
71 | builtin_define ("__powerpc"); \ | |
72 | } \ | |
17e8da49 OH |
73 | \ |
74 | /* __ppc isn't emitted by the system compiler \ | |
75 | any more but a few system headers still depend \ | |
76 | on it, as well as on __ppc__. */ \ | |
77 | builtin_define ("__ppc"); \ | |
78 | builtin_define ("__ppc__"); \ | |
5b00bcc5 OH |
79 | } \ |
80 | \ | |
81 | /* Asserts for #cpu and #machine. */ \ | |
82 | if (TARGET_64BIT) \ | |
83 | { \ | |
84 | builtin_assert ("cpu=powerpc64"); \ | |
85 | builtin_assert ("machine=powerpc64"); \ | |
86 | } \ | |
87 | else \ | |
88 | { \ | |
89 | builtin_assert ("cpu=powerpc"); \ | |
90 | builtin_assert ("machine=powerpc"); \ | |
91 | } \ | |
92 | \ | |
93 | /* PowerPC VxWorks specificities. */ \ | |
2eab15c9 | 94 | if (!TARGET_SOFT_FLOAT) \ |
5b00bcc5 OH |
95 | { \ |
96 | builtin_define ("__hardfp"); \ | |
97 | builtin_define ("_WRS_HARDWARE_FP"); \ | |
98 | } \ | |
2eab15c9 | 99 | \ |
5b00bcc5 | 100 | /* Common VxWorks and port items. */ \ |
bda38d2e | 101 | VXWORKS_OS_CPP_BUILTINS (); \ |
5b00bcc5 | 102 | TARGET_OS_SYSV_CPP_BUILTINS (); \ |
bda38d2e | 103 | } \ |
cc956ba2 | 104 | while (0) |
4977bab6 | 105 | |
bd8efb66 | 106 | |
17867980 DR |
107 | #define VX_CPUDEF(CPUID) \ |
108 | ":-D" VX_CPU_PREFIX "CPU=" VX_CPU_PREFIX #CPUID | |
2eab15c9 | 109 | |
17867980 DR |
110 | #define VX_MCPU(CPU,CPUID) \ |
111 | "mcpu=" #CPU VX_CPUDEF(CPUID) | |
4977bab6 | 112 | |
4977bab6 | 113 | #undef CPP_SPEC |
17867980 DR |
114 | #define CPP_SPEC \ |
115 | "%{!D" VX_CPU_PREFIX "CPU=*:%{" \ | |
116 | VX_MCPU(403, PPC403) ";" \ | |
117 | VX_MCPU(405, PPC405) ";" \ | |
118 | VX_MCPU(440, PPC440) ";" \ | |
119 | VX_MCPU(464, PPC464) ";" \ | |
120 | VX_MCPU(476, PPC476) ";" \ | |
121 | VX_MCPU(603, PPC603) ";" \ | |
122 | VX_MCPU(604, PPC604) ";" \ | |
123 | VX_MCPU(860, PPC860) ";" \ | |
7fdedf8a | 124 | VX_MCPU(e6500, PPCE6500) ";" \ |
17867980 DR |
125 | VX_MCPU(8540, PPC85XX) ";" \ |
126 | VX_MCPU(8548, PPC85XX) ";" \ | |
127 | VX_CPUDEF(PPC604) \ | |
128 | "}}" \ | |
129 | VXWORKS_ADDITIONAL_CPP_SPEC | |
4977bab6 | 130 | |
2eab15c9 | 131 | /* FIXME: The only reason we allow no -mcpu switch at all is because |
17867980 | 132 | config-ml.in insists on a "." multilib. */ |
2eab15c9 PE |
133 | |
134 | #undef LIB_SPEC | |
135 | #define LIB_SPEC VXWORKS_LIB_SPEC | |
13c4e403 | 136 | |
2eab15c9 PE |
137 | #undef STARTFILE_SPEC |
138 | #define STARTFILE_SPEC VXWORKS_STARTFILE_SPEC | |
17867980 | 139 | |
2eab15c9 PE |
140 | #undef ENDFILE_SPEC |
141 | #define ENDFILE_SPEC VXWORKS_ENDFILE_SPEC | |
142 | ||
143 | /* There is no default multilib. */ | |
144 | #undef MULTILIB_DEFAULTS | |
145 | ||
17867980 DR |
146 | /* No _mcount profiling on VxWorks. */ |
147 | #undef FUNCTION_PROFILER | |
148 | #define FUNCTION_PROFILER(FILE,LABELNO) VXWORKS_FUNCTION_PROFILER(FILE,LABELNO) | |
2eab15c9 | 149 | |
17867980 DR |
150 | /* Initialize library function table. */ |
151 | #undef TARGET_INIT_LIBFUNCS | |
152 | #define TARGET_INIT_LIBFUNCS rs6000_vxworks_init_libfuncs | |
2eab15c9 PE |
153 | |
154 | /* Nor sdata, for kernel mode. We use this in | |
155 | SUBSUBTARGET_INITIALIZE_OPTIONS, after rs6000_rtp has been initialized. */ | |
156 | #undef SDATA_DEFAULT_SIZE | |
157 | #define SDATA_DEFAULT_SIZE (TARGET_VXWORKS_RTP ? 8 : 0) | |
158 | ||
17867980 DR |
159 | #undef SUB3TARGET_OVERRIDE_OPTIONS |
160 | #define SUB3TARGET_OVERRIDE_OPTIONS \ | |
161 | do { \ | |
162 | if (!global_options_set.x_g_switch_value) \ | |
163 | g_switch_value = SDATA_DEFAULT_SIZE; \ | |
164 | VXWORKS_OVERRIDE_OPTIONS; \ | |
165 | } while (0) | |
b3552548 | 166 | |
17867980 DR |
167 | /* The stack pointer need not be moved while checking the stack. */ |
168 | #undef STACK_CHECK_MOVING_SP | |
b3552548 | 169 | |
17867980 DR |
170 | /* Define this to be nonzero if static stack checking is supported. */ |
171 | #define STACK_CHECK_STATIC_BUILTIN 1 | |
b3552548 | 172 | |
17867980 DR |
173 | /* Room needed to allow exception propagation, from what experiments |
174 | and low level observations taught us ... */ | |
175 | #define STACK_CHECK_PROTECT (TARGET_64BIT ? 16 * 1024 : 12 * 1024) | |
176 | ||
177 | /* Leverage linker relaxation for RTPs. This helps 32bit programs | |
178 | referring to kernel services too far away for short calls, is more | |
179 | precise than -mlongcall and can be overriden with -Wl,--no-relax. */ | |
180 | #define VXWORKS_RELAX_LINK_SPEC "%{mrtp:--relax}" | |
181 | ||
182 | /*-------------------------------------------------------------*/ | |
183 | /* Pre-VxWorks7 configuration. */ | |
184 | /*-------------------------------------------------------------*/ | |
185 | ||
186 | #if !TARGET_VXWORKS7 | |
2eab15c9 | 187 | |
f9d4d3cf EB |
188 | #undef RS6000_STARTING_FRAME_OFFSET |
189 | #define RS6000_STARTING_FRAME_OFFSET \ | |
190 | (cfun->calls_alloca \ | |
191 | ? RS6000_ALIGN (crtl->outgoing_args_size + RS6000_SAVE_AREA, 16) \ | |
192 | : (RS6000_ALIGN (crtl->outgoing_args_size, 16) + RS6000_SAVE_AREA)) | |
193 | ||
194 | #undef STACK_DYNAMIC_OFFSET | |
195 | #define STACK_DYNAMIC_OFFSET(FUNDECL) \ | |
196 | RS6000_ALIGN (crtl->outgoing_args_size.to_constant () \ | |
197 | + STACK_POINTER_OFFSET, 16) | |
198 | ||
17867980 DR |
199 | /* Enforce 16-byte alignment for the stack pointer, to permit general |
200 | compliance with e.g. Altivec instructions requirements. Make sure | |
201 | this isn't overruled by the EABI constraints. */ | |
2eab15c9 | 202 | |
17867980 DR |
203 | #undef STACK_BOUNDARY |
204 | #define STACK_BOUNDARY (16*BITS_PER_UNIT) | |
3488bd6b | 205 | |
17867980 DR |
206 | #undef PREFERRED_STACK_BOUNDARY |
207 | #define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY | |
208 | ||
209 | #undef ABI_STACK_BOUNDARY | |
210 | ||
211 | #undef STARTFILE_PREFIX_SPEC | |
212 | #define STARTFILE_PREFIX_SPEC \ | |
213 | "%{mrtp:%{!shared:%:getenv(WIND_BASE /target/lib/usr/lib/ppc/PPC32/common)}}" | |
214 | ||
215 | /* For aggregates passing, use the same, consistent ABI as Linux. */ | |
216 | #define AGGREGATE_PADDING_FIXED 0 | |
217 | #define AGGREGATES_PAD_UPWARD_ALWAYS 0 | |
218 | ||
219 | #undef ASM_SPEC | |
220 | #define ASM_SPEC \ | |
221 | "%(asm_cpu) \ | |
222 | %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \ | |
223 | %{mrelocatable} %{mrelocatable-lib} %{" FPIC_SPEC ":-K PIC} -mbig" | |
224 | ||
225 | #undef CC1_SPEC | |
226 | #define CC1_SPEC VXWORKS_CC1_SPEC " \ | |
227 | %{G*} %{mno-sdata:-msdata=none} %{msdata:-msdata=default} \ | |
228 | %{mlittle|mlittle-endian:-mstrict-align}" | |
229 | ||
230 | #undef LINK_SPEC | |
231 | #define LINK_SPEC VXWORKS_LINK_SPEC " " VXWORKS_RELAX_LINK_SPEC | |
232 | ||
233 | #undef TARGET_DEFAULT | |
234 | #define TARGET_DEFAULT (MASK_EABI | MASK_STRICT_ALIGN) | |
235 | ||
236 | #undef PROCESSOR_DEFAULT | |
237 | #define PROCESSOR_DEFAULT PROCESSOR_PPC604 | |
238 | ||
239 | /* Only big endian PPC is supported by VxWorks. */ | |
240 | #undef BYTES_BIG_ENDIAN | |
241 | #define BYTES_BIG_ENDIAN 1 | |
242 | ||
243 | #undef WORDS_BIG_ENDIAN | |
244 | #define WORDS_BIG_ENDIAN 1 | |
245 | ||
246 | #undef SUBTARGET_EXTRA_SPECS | |
247 | #define SUBTARGET_EXTRA_SPECS /* none needed */ | |
248 | ||
249 | #else /* TARGET_VXWORKS7 */ | |
250 | ||
251 | /*-------------------------------------------------------------*/ | |
252 | /* Post-VxWorks7 (SR600) configuration. */ | |
253 | /*-------------------------------------------------------------*/ | |
254 | ||
255 | /* VxWorks does not use local symbols for the function entry point. */ | |
256 | #undef DOT_SYMBOLS | |
257 | #define DOT_SYMBOLS 0 | |
258 | ||
259 | #undef LINK_OS_VXWORKS_SPEC | |
260 | #define LINK_OS_VXWORKS_SPEC \ | |
261 | " %{!mrtp:-r} %{mrtp:-q -static} %{!Xbind-lazy:-z now}" | |
262 | ||
263 | #undef LINK_OS_EXTRA_SPEC32 | |
264 | #define LINK_OS_EXTRA_SPEC32 LINK_OS_VXWORKS_SPEC " " VXWORKS_RELAX_LINK_SPEC | |
265 | ||
266 | #undef LINK_OS_EXTRA_SPEC64 | |
267 | #define LINK_OS_EXTRA_SPEC64 LINK_OS_VXWORKS_SPEC | |
268 | ||
269 | /* linux64.h enables this, not supported in vxWorks. */ | |
270 | #undef TARGET_FLOAT128_ENABLE_TYPE | |
271 | #define TARGET_FLOAT128_ENABLE_TYPE 0 | |
272 | ||
273 | #endif /* TARGET_VXWORKS7 */ | |
3488bd6b | 274 |