c++: Fix ICE on constexpr placement new [PR115754]
[official-gcc.git] / gcc / config / rs6000 / vxworks.h
blob084cd40fa6fd6c1721ed012d63683d24f69e9c74
1 /* Definitions of target machine for GNU compiler. Vxworks PowerPC version.
2 Copyright (C) 1996-2024 Free Software Foundation, Inc.
3 Contributed by CodeSourcery, LLC.
5 This file is part of GCC.
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
9 Software Foundation; either version 3, or (at your option) any later
10 version.
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.
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/>. */
21 /* The port comes in two very different flavors at this stage:
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.
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. */
33 /*-------------------------------------------------------------*/
34 /* Common definitions first. */
35 /*-------------------------------------------------------------*/
37 /* CPP predefined macros. */
39 #undef TARGET_OS_CPP_BUILTINS
40 #define TARGET_OS_CPP_BUILTINS() \
41 do \
42 { \
43 builtin_define ("__ELF__"); \
44 if (!TARGET_VXWORKS7) \
45 builtin_define ("__EABI__"); \
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"); \
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 } \
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__"); \
79 } \
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 } \
93 /* PowerPC VxWorks specificities. */ \
94 if (!TARGET_SOFT_FLOAT) \
95 { \
96 builtin_define ("__hardfp"); \
97 builtin_define ("_WRS_HARDWARE_FP"); \
98 } \
100 /* Common VxWorks and port items. */ \
101 VXWORKS_OS_CPP_BUILTINS (); \
102 TARGET_OS_SYSV_CPP_BUILTINS (); \
104 while (0)
107 #define VX_CPUDEF(CPUID) \
108 ":-D" VX_CPU_PREFIX "CPU=" VX_CPU_PREFIX #CPUID
110 #define VX_MCPU(CPU,CPUID) \
111 "mcpu=" #CPU VX_CPUDEF(CPUID)
113 #undef CPP_SPEC
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) ";" \
124 VX_MCPU(e6500, PPCE6500) ";" \
125 VX_MCPU(8540, PPC85XX) ";" \
126 VX_MCPU(8548, PPC85XX) ";" \
127 VX_CPUDEF(PPC604) \
128 "}}" \
129 VXWORKS_ADDITIONAL_CPP_SPEC
131 /* FIXME: The only reason we allow no -mcpu switch at all is because
132 config-ml.in insists on a "." multilib. */
134 #undef LIB_SPEC
135 #define LIB_SPEC VXWORKS_LIB_SPEC
137 #undef STARTFILE_SPEC
138 #define STARTFILE_SPEC VXWORKS_STARTFILE_SPEC
140 #undef ENDFILE_SPEC
141 #define ENDFILE_SPEC VXWORKS_ENDFILE_SPEC
143 /* There is no default multilib. */
144 #undef MULTILIB_DEFAULTS
146 /* No _mcount profiling on VxWorks. */
147 #undef FUNCTION_PROFILER
148 #define FUNCTION_PROFILER(FILE,LABELNO) VXWORKS_FUNCTION_PROFILER(FILE,LABELNO)
150 /* Nor sdata, for kernel mode. We use this in
151 SUBSUBTARGET_INITIALIZE_OPTIONS, after rs6000_rtp has been initialized. */
152 #undef SDATA_DEFAULT_SIZE
153 #define SDATA_DEFAULT_SIZE (TARGET_VXWORKS_RTP ? 8 : 0)
155 #undef SUB3TARGET_OVERRIDE_OPTIONS
156 #define SUB3TARGET_OVERRIDE_OPTIONS \
157 do { \
158 if (!OPTION_SET_P (g_switch_value)) \
159 g_switch_value = SDATA_DEFAULT_SIZE; \
160 VXWORKS_OVERRIDE_OPTIONS; \
161 } while (0)
163 /* The stack pointer need not be moved while checking the stack. */
164 #undef STACK_CHECK_MOVING_SP
166 /* Define this to be nonzero if static stack checking is supported. */
167 #define STACK_CHECK_STATIC_BUILTIN 1
169 /* Room needed to allow exception propagation, from what experiments
170 and low level observations taught us ... */
171 #define STACK_CHECK_PROTECT (TARGET_64BIT ? 16 * 1024 : 12 * 1024)
173 /* Leverage linker relaxation for RTPs. This helps 32bit programs
174 referring to kernel services too far away for short calls, is more
175 precise than -mlongcall and can be overriden with -Wl,--no-relax. */
176 #define VXWORKS_RELAX_LINK_SPEC "%{mrtp:--relax}"
178 /*-------------------------------------------------------------*/
179 /* Pre-VxWorks7 configuration. */
180 /*-------------------------------------------------------------*/
182 #if !TARGET_VXWORKS7
184 #undef RS6000_STARTING_FRAME_OFFSET
185 #define RS6000_STARTING_FRAME_OFFSET \
186 (cfun->calls_alloca \
187 ? RS6000_ALIGN (crtl->outgoing_args_size + RS6000_SAVE_AREA, 16) \
188 : (RS6000_ALIGN (crtl->outgoing_args_size, 16) + RS6000_SAVE_AREA))
190 #undef STACK_DYNAMIC_OFFSET
191 #define STACK_DYNAMIC_OFFSET(FUNDECL) \
192 RS6000_ALIGN (crtl->outgoing_args_size.to_constant () \
193 + STACK_POINTER_OFFSET, 16)
195 /* Enforce 16-byte alignment for the stack pointer, to permit general
196 compliance with e.g. Altivec instructions requirements. Make sure
197 this isn't overruled by the EABI constraints. */
199 #undef STACK_BOUNDARY
200 #define STACK_BOUNDARY (16*BITS_PER_UNIT)
202 #undef PREFERRED_STACK_BOUNDARY
203 #define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY
205 #undef ABI_STACK_BOUNDARY
207 #undef STARTFILE_PREFIX_SPEC
208 #define STARTFILE_PREFIX_SPEC \
209 "%{mrtp:%{!shared:/lib%{msmp:_smp}/usr/lib/ppc/PPC32/common}}"
211 /* For aggregates passing, use the same, consistent ABI as Linux. */
212 #define AGGREGATE_PADDING_FIXED 0
213 #define AGGREGATES_PAD_UPWARD_ALWAYS 0
215 #undef ASM_SPEC
216 #define ASM_SPEC \
217 "%(asm_cpu) \
218 %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \
219 %{mrelocatable} %{mrelocatable-lib} %{" FPIC_SPEC ":-K PIC} -mbig"
221 #undef CC1_SPEC
222 #define CC1_SPEC VXWORKS_CC1_SPEC " \
223 %{G*} %{mno-sdata:-msdata=none} %{msdata:-msdata=default} \
224 %{mlittle|mlittle-endian:-mstrict-align}"
226 #undef LINK_SPEC
227 #define LINK_SPEC VXWORKS_LINK_SPEC " " VXWORKS_RELAX_LINK_SPEC
229 #undef TARGET_DEFAULT
230 #define TARGET_DEFAULT (OPTION_MASK_EABI | MASK_STRICT_ALIGN)
232 #undef PROCESSOR_DEFAULT
233 #define PROCESSOR_DEFAULT PROCESSOR_PPC604
235 /* Only big endian PPC is supported by VxWorks. */
236 #undef BYTES_BIG_ENDIAN
237 #define BYTES_BIG_ENDIAN 1
239 #undef WORDS_BIG_ENDIAN
240 #define WORDS_BIG_ENDIAN 1
242 #undef SUBTARGET_EXTRA_SPECS
243 #define SUBTARGET_EXTRA_SPECS /* none needed */
245 #else /* TARGET_VXWORKS7 */
247 /*-------------------------------------------------------------*/
248 /* Post-VxWorks7 (SR600) configuration. */
249 /*-------------------------------------------------------------*/
251 /* VxWorks does not use local symbols for the function entry point. */
252 #undef DOT_SYMBOLS
253 #define DOT_SYMBOLS 0
255 /* For link specs, we leverage the linux configuration bits through
256 LINK_OS_EXTRA_SPEC32/64 and need to cancel the default %(link_os)
257 expansion in VXWORKS_LINK_SPEC. */
259 #undef VXWORKS_LINK_OS_SPEC
260 #define VXWORKS_LINK_OS_SPEC ""
262 #undef LINK_OS_EXTRA_SPEC32
263 #define LINK_OS_EXTRA_SPEC32 VXWORKS_LINK_SPEC " " VXWORKS_RELAX_LINK_SPEC
265 #undef LINK_OS_EXTRA_SPEC64
266 #define LINK_OS_EXTRA_SPEC64 VXWORKS_LINK_SPEC
268 /* Leave TARGET_FLOAT128_ENABLE_TYPE alone here, possibly inherited from
269 a linux configuration file. This lets compilation tests pass and will
270 trigger visible link errors (hence remain harmless) if the support isn't
271 really there. */
273 #endif /* TARGET_VXWORKS7 */