1 |
282 |
jeremybenn |
/* Definitions of target machine for GNU compiler,
|
2 |
|
|
for 64 bit PowerPC linux.
|
3 |
|
|
Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
|
4 |
|
|
2009, 2010 Free Software Foundation, Inc.
|
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 |
|
|
Under Section 7 of GPL version 3, you are granted additional
|
19 |
|
|
permissions described in the GCC Runtime Library Exception, version
|
20 |
|
|
3.1, as published by the Free Software Foundation.
|
21 |
|
|
|
22 |
|
|
You should have received a copy of the GNU General Public License and
|
23 |
|
|
a copy of the GCC Runtime Library Exception along with this program;
|
24 |
|
|
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
25 |
|
|
<http://www.gnu.org/licenses/>. */
|
26 |
|
|
|
27 |
|
|
#ifndef RS6000_BI_ARCH
|
28 |
|
|
|
29 |
|
|
#undef DEFAULT_ABI
|
30 |
|
|
#define DEFAULT_ABI ABI_AIX
|
31 |
|
|
|
32 |
|
|
#undef TARGET_64BIT
|
33 |
|
|
#define TARGET_64BIT 1
|
34 |
|
|
|
35 |
|
|
#define DEFAULT_ARCH64_P 1
|
36 |
|
|
#define RS6000_BI_ARCH_P 0
|
37 |
|
|
|
38 |
|
|
#else
|
39 |
|
|
|
40 |
|
|
#define DEFAULT_ARCH64_P (TARGET_DEFAULT & MASK_64BIT)
|
41 |
|
|
#define RS6000_BI_ARCH_P 1
|
42 |
|
|
|
43 |
|
|
#endif
|
44 |
|
|
|
45 |
|
|
#ifdef IN_LIBGCC2
|
46 |
|
|
#undef TARGET_64BIT
|
47 |
|
|
#ifdef __powerpc64__
|
48 |
|
|
#define TARGET_64BIT 1
|
49 |
|
|
#else
|
50 |
|
|
#define TARGET_64BIT 0
|
51 |
|
|
#endif
|
52 |
|
|
#endif
|
53 |
|
|
|
54 |
|
|
#undef TARGET_AIX
|
55 |
|
|
#define TARGET_AIX TARGET_64BIT
|
56 |
|
|
|
57 |
|
|
#ifdef HAVE_LD_NO_DOT_SYMS
|
58 |
|
|
/* New ABI uses a local sym for the function entry point. */
|
59 |
|
|
extern int dot_symbols;
|
60 |
|
|
#undef DOT_SYMBOLS
|
61 |
|
|
#define DOT_SYMBOLS dot_symbols
|
62 |
|
|
#endif
|
63 |
|
|
|
64 |
|
|
#define TARGET_PROFILE_KERNEL profile_kernel
|
65 |
|
|
|
66 |
|
|
#undef PROCESSOR_DEFAULT
|
67 |
|
|
#define PROCESSOR_DEFAULT PROCESSOR_POWER6
|
68 |
|
|
#undef PROCESSOR_DEFAULT64
|
69 |
|
|
#define PROCESSOR_DEFAULT64 PROCESSOR_POWER6
|
70 |
|
|
|
71 |
|
|
/* We don't need to generate entries in .fixup, except when
|
72 |
|
|
-mrelocatable or -mrelocatable-lib is given. */
|
73 |
|
|
#undef RELOCATABLE_NEEDS_FIXUP
|
74 |
|
|
#define RELOCATABLE_NEEDS_FIXUP \
|
75 |
|
|
(target_flags & target_flags_explicit & MASK_RELOCATABLE)
|
76 |
|
|
|
77 |
|
|
#undef RS6000_ABI_NAME
|
78 |
|
|
#define RS6000_ABI_NAME "linux"
|
79 |
|
|
|
80 |
|
|
#define INVALID_64BIT "-m%s not supported in this configuration"
|
81 |
|
|
#define INVALID_32BIT INVALID_64BIT
|
82 |
|
|
|
83 |
|
|
#undef SUBSUBTARGET_OVERRIDE_OPTIONS
|
84 |
|
|
#define SUBSUBTARGET_OVERRIDE_OPTIONS \
|
85 |
|
|
do \
|
86 |
|
|
{ \
|
87 |
|
|
if (!rs6000_explicit_options.alignment) \
|
88 |
|
|
rs6000_alignment_flags = MASK_ALIGN_NATURAL; \
|
89 |
|
|
if (TARGET_64BIT) \
|
90 |
|
|
{ \
|
91 |
|
|
if (DEFAULT_ABI != ABI_AIX) \
|
92 |
|
|
{ \
|
93 |
|
|
rs6000_current_abi = ABI_AIX; \
|
94 |
|
|
error (INVALID_64BIT, "call"); \
|
95 |
|
|
} \
|
96 |
|
|
dot_symbols = !strcmp (rs6000_abi_name, "aixdesc"); \
|
97 |
|
|
if (target_flags & MASK_RELOCATABLE) \
|
98 |
|
|
{ \
|
99 |
|
|
target_flags &= ~MASK_RELOCATABLE; \
|
100 |
|
|
error (INVALID_64BIT, "relocatable"); \
|
101 |
|
|
} \
|
102 |
|
|
if (target_flags & MASK_EABI) \
|
103 |
|
|
{ \
|
104 |
|
|
target_flags &= ~MASK_EABI; \
|
105 |
|
|
error (INVALID_64BIT, "eabi"); \
|
106 |
|
|
} \
|
107 |
|
|
if (TARGET_PROTOTYPE) \
|
108 |
|
|
{ \
|
109 |
|
|
target_prototype = 0; \
|
110 |
|
|
error (INVALID_64BIT, "prototype"); \
|
111 |
|
|
} \
|
112 |
|
|
if ((target_flags & MASK_POWERPC64) == 0) \
|
113 |
|
|
{ \
|
114 |
|
|
target_flags |= MASK_POWERPC64; \
|
115 |
|
|
error ("-m64 requires a PowerPC64 cpu"); \
|
116 |
|
|
} \
|
117 |
|
|
} \
|
118 |
|
|
else \
|
119 |
|
|
{ \
|
120 |
|
|
if (!RS6000_BI_ARCH_P) \
|
121 |
|
|
error (INVALID_32BIT, "32"); \
|
122 |
|
|
if (TARGET_PROFILE_KERNEL) \
|
123 |
|
|
{ \
|
124 |
|
|
TARGET_PROFILE_KERNEL = 0; \
|
125 |
|
|
error (INVALID_32BIT, "profile-kernel"); \
|
126 |
|
|
} \
|
127 |
|
|
} \
|
128 |
|
|
} \
|
129 |
|
|
while (0)
|
130 |
|
|
|
131 |
|
|
#ifdef RS6000_BI_ARCH
|
132 |
|
|
|
133 |
|
|
#undef OVERRIDE_OPTIONS
|
134 |
|
|
#define OVERRIDE_OPTIONS \
|
135 |
|
|
rs6000_override_options (((TARGET_DEFAULT ^ target_flags) & MASK_64BIT) \
|
136 |
|
|
? (char *) 0 : TARGET_CPU_DEFAULT)
|
137 |
|
|
|
138 |
|
|
#endif
|
139 |
|
|
|
140 |
|
|
#undef ASM_DEFAULT_SPEC
|
141 |
|
|
#undef ASM_SPEC
|
142 |
|
|
#undef LINK_OS_LINUX_SPEC
|
143 |
|
|
|
144 |
|
|
/* FIXME: This will quite possibly choose the wrong dynamic linker. */
|
145 |
|
|
#undef LINK_OS_GNU_SPEC
|
146 |
|
|
#define LINK_OS_GNU_SPEC LINK_OS_LINUX_SPEC
|
147 |
|
|
|
148 |
|
|
#ifndef RS6000_BI_ARCH
|
149 |
|
|
#define ASM_DEFAULT_SPEC "-mppc64"
|
150 |
|
|
#define ASM_SPEC "%(asm_spec64) %(asm_spec_common)"
|
151 |
|
|
#define LINK_OS_LINUX_SPEC "%(link_os_linux_spec64)"
|
152 |
|
|
#else
|
153 |
|
|
#if DEFAULT_ARCH64_P
|
154 |
|
|
#define ASM_DEFAULT_SPEC "-mppc%{!m32:64}"
|
155 |
|
|
#define ASM_SPEC "%{m32:%(asm_spec32)}%{!m32:%(asm_spec64)} %(asm_spec_common)"
|
156 |
|
|
#define LINK_OS_LINUX_SPEC "%{m32:%(link_os_linux_spec32)}%{!m32:%(link_os_linux_spec64)}"
|
157 |
|
|
#else
|
158 |
|
|
#define ASM_DEFAULT_SPEC "-mppc%{m64:64}"
|
159 |
|
|
#define ASM_SPEC "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)"
|
160 |
|
|
#define LINK_OS_LINUX_SPEC "%{!m64:%(link_os_linux_spec32)}%{m64:%(link_os_linux_spec64)}"
|
161 |
|
|
#endif
|
162 |
|
|
#endif
|
163 |
|
|
|
164 |
|
|
#define ASM_SPEC32 "-a32 %{n} %{T} %{Ym,*} %{Yd,*} \
|
165 |
|
|
%{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \
|
166 |
|
|
%{memb} %{!memb: %{msdata=eabi: -memb}} \
|
167 |
|
|
%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
|
168 |
|
|
%{mcall-freebsd: -mbig} \
|
169 |
|
|
%{mcall-i960-old: -mlittle} \
|
170 |
|
|
%{mcall-linux: -mbig} \
|
171 |
|
|
%{mcall-gnu: -mbig} \
|
172 |
|
|
%{mcall-netbsd: -mbig} \
|
173 |
|
|
}}}}"
|
174 |
|
|
|
175 |
|
|
#define ASM_SPEC64 "-a64"
|
176 |
|
|
|
177 |
|
|
#define ASM_SPEC_COMMON "%(asm_cpu) \
|
178 |
|
|
%{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \
|
179 |
|
|
%{v:-V} %{Qy:} %{!Qn:-Qy} %{Wa,*:%*} \
|
180 |
|
|
%{mlittle} %{mlittle-endian} %{mbig} %{mbig-endian}"
|
181 |
|
|
|
182 |
|
|
#undef SUBSUBTARGET_EXTRA_SPECS
|
183 |
|
|
#define SUBSUBTARGET_EXTRA_SPECS \
|
184 |
|
|
{ "asm_spec_common", ASM_SPEC_COMMON }, \
|
185 |
|
|
{ "asm_spec32", ASM_SPEC32 }, \
|
186 |
|
|
{ "asm_spec64", ASM_SPEC64 }, \
|
187 |
|
|
{ "link_os_linux_spec32", LINK_OS_LINUX_SPEC32 }, \
|
188 |
|
|
{ "link_os_linux_spec64", LINK_OS_LINUX_SPEC64 },
|
189 |
|
|
|
190 |
|
|
#undef MULTILIB_DEFAULTS
|
191 |
|
|
#if DEFAULT_ARCH64_P
|
192 |
|
|
#define MULTILIB_DEFAULTS { "m64" }
|
193 |
|
|
#else
|
194 |
|
|
#define MULTILIB_DEFAULTS { "m32" }
|
195 |
|
|
#endif
|
196 |
|
|
|
197 |
|
|
#ifndef RS6000_BI_ARCH
|
198 |
|
|
|
199 |
|
|
/* 64-bit PowerPC Linux is always big-endian. */
|
200 |
|
|
#undef TARGET_LITTLE_ENDIAN
|
201 |
|
|
#define TARGET_LITTLE_ENDIAN 0
|
202 |
|
|
|
203 |
|
|
/* 64-bit PowerPC Linux always has a TOC. */
|
204 |
|
|
#undef TARGET_TOC
|
205 |
|
|
#define TARGET_TOC 1
|
206 |
|
|
|
207 |
|
|
/* Some things from sysv4.h we don't do when 64 bit. */
|
208 |
|
|
#undef TARGET_RELOCATABLE
|
209 |
|
|
#define TARGET_RELOCATABLE 0
|
210 |
|
|
#undef TARGET_EABI
|
211 |
|
|
#define TARGET_EABI 0
|
212 |
|
|
#undef TARGET_PROTOTYPE
|
213 |
|
|
#define TARGET_PROTOTYPE 0
|
214 |
|
|
#undef RELOCATABLE_NEEDS_FIXUP
|
215 |
|
|
#define RELOCATABLE_NEEDS_FIXUP 0
|
216 |
|
|
|
217 |
|
|
#endif
|
218 |
|
|
|
219 |
|
|
/* We use glibc _mcount for profiling. */
|
220 |
|
|
#define NO_PROFILE_COUNTERS 1
|
221 |
|
|
#define PROFILE_HOOK(LABEL) \
|
222 |
|
|
do { if (TARGET_64BIT) output_profile_hook (LABEL); } while (0)
|
223 |
|
|
|
224 |
|
|
/* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */
|
225 |
|
|
#undef ADJUST_FIELD_ALIGN
|
226 |
|
|
#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
|
227 |
|
|
((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \
|
228 |
|
|
? 128 \
|
229 |
|
|
: (TARGET_64BIT \
|
230 |
|
|
&& TARGET_ALIGN_NATURAL == 0 \
|
231 |
|
|
&& TYPE_MODE (strip_array_types (TREE_TYPE (FIELD))) == DFmode) \
|
232 |
|
|
? MIN ((COMPUTED), 32) \
|
233 |
|
|
: (COMPUTED))
|
234 |
|
|
|
235 |
|
|
/* PowerPC64 Linux increases natural record alignment to doubleword if
|
236 |
|
|
the first field is an FP double, only if in power alignment mode. */
|
237 |
|
|
#undef ROUND_TYPE_ALIGN
|
238 |
|
|
#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \
|
239 |
|
|
((TARGET_64BIT \
|
240 |
|
|
&& (TREE_CODE (STRUCT) == RECORD_TYPE \
|
241 |
|
|
|| TREE_CODE (STRUCT) == UNION_TYPE \
|
242 |
|
|
|| TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \
|
243 |
|
|
&& TARGET_ALIGN_NATURAL == 0) \
|
244 |
|
|
? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \
|
245 |
|
|
: MAX ((COMPUTED), (SPECIFIED)))
|
246 |
|
|
|
247 |
|
|
/* Use the default for compiling target libs. */
|
248 |
|
|
#ifdef IN_TARGET_LIBS
|
249 |
|
|
#undef TARGET_ALIGN_NATURAL
|
250 |
|
|
#define TARGET_ALIGN_NATURAL 1
|
251 |
|
|
#endif
|
252 |
|
|
|
253 |
|
|
/* Indicate that jump tables go in the text section. */
|
254 |
|
|
#undef JUMP_TABLES_IN_TEXT_SECTION
|
255 |
|
|
#define JUMP_TABLES_IN_TEXT_SECTION TARGET_64BIT
|
256 |
|
|
|
257 |
|
|
/* The linux ppc64 ABI isn't explicit on whether aggregates smaller
|
258 |
|
|
than a doubleword should be padded upward or downward. You could
|
259 |
|
|
reasonably assume that they follow the normal rules for structure
|
260 |
|
|
layout treating the parameter area as any other block of memory,
|
261 |
|
|
then map the reg param area to registers. i.e. pad upward.
|
262 |
|
|
Setting both of the following defines results in this behavior.
|
263 |
|
|
Setting just the first one will result in aggregates that fit in a
|
264 |
|
|
doubleword being padded downward, and others being padded upward.
|
265 |
|
|
Not a bad idea as this results in struct { int x; } being passed
|
266 |
|
|
the same way as an int. */
|
267 |
|
|
#define AGGREGATE_PADDING_FIXED TARGET_64BIT
|
268 |
|
|
#define AGGREGATES_PAD_UPWARD_ALWAYS 0
|
269 |
|
|
|
270 |
|
|
/* Specify padding for the last element of a block move between
|
271 |
|
|
registers and memory. FIRST is nonzero if this is the only
|
272 |
|
|
element. */
|
273 |
|
|
#define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
|
274 |
|
|
(!(FIRST) ? upward : FUNCTION_ARG_PADDING (MODE, TYPE))
|
275 |
|
|
|
276 |
|
|
/* __throw will restore its own return address to be the same as the
|
277 |
|
|
return address of the function that the throw is being made to.
|
278 |
|
|
This is unfortunate, because we want to check the original
|
279 |
|
|
return address to see if we need to restore the TOC.
|
280 |
|
|
So we have to squirrel it away with this. */
|
281 |
|
|
#define SETUP_FRAME_ADDRESSES() \
|
282 |
|
|
do { if (TARGET_64BIT) rs6000_aix_emit_builtin_unwind_init (); } while (0)
|
283 |
|
|
|
284 |
|
|
/* Override svr4.h */
|
285 |
|
|
#undef MD_EXEC_PREFIX
|
286 |
|
|
#undef MD_STARTFILE_PREFIX
|
287 |
|
|
|
288 |
|
|
/* Linux doesn't support saving and restoring 64-bit regs in a 32-bit
|
289 |
|
|
process. */
|
290 |
|
|
#define OS_MISSING_POWERPC64 !TARGET_64BIT
|
291 |
|
|
|
292 |
|
|
/* glibc has float and long double forms of math functions. */
|
293 |
|
|
#undef TARGET_C99_FUNCTIONS
|
294 |
|
|
#define TARGET_C99_FUNCTIONS (OPTION_GLIBC)
|
295 |
|
|
|
296 |
|
|
/* Whether we have sincos that follows the GNU extension. */
|
297 |
|
|
#undef TARGET_HAS_SINCOS
|
298 |
|
|
#define TARGET_HAS_SINCOS (OPTION_GLIBC)
|
299 |
|
|
|
300 |
|
|
#undef TARGET_OS_CPP_BUILTINS
|
301 |
|
|
#define TARGET_OS_CPP_BUILTINS() \
|
302 |
|
|
do \
|
303 |
|
|
{ \
|
304 |
|
|
if (TARGET_64BIT) \
|
305 |
|
|
{ \
|
306 |
|
|
builtin_define ("__PPC__"); \
|
307 |
|
|
builtin_define ("__PPC64__"); \
|
308 |
|
|
builtin_define ("__powerpc__"); \
|
309 |
|
|
builtin_define ("__powerpc64__"); \
|
310 |
|
|
builtin_assert ("cpu=powerpc64"); \
|
311 |
|
|
builtin_assert ("machine=powerpc64"); \
|
312 |
|
|
} \
|
313 |
|
|
else \
|
314 |
|
|
{ \
|
315 |
|
|
builtin_define_std ("PPC"); \
|
316 |
|
|
builtin_define_std ("powerpc"); \
|
317 |
|
|
builtin_assert ("cpu=powerpc"); \
|
318 |
|
|
builtin_assert ("machine=powerpc"); \
|
319 |
|
|
TARGET_OS_SYSV_CPP_BUILTINS (); \
|
320 |
|
|
} \
|
321 |
|
|
} \
|
322 |
|
|
while (0)
|
323 |
|
|
|
324 |
|
|
#undef CPP_OS_DEFAULT_SPEC
|
325 |
|
|
#define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
|
326 |
|
|
|
327 |
|
|
/* The GNU C++ standard library currently requires _GNU_SOURCE being
|
328 |
|
|
defined on glibc-based systems. This temporary hack accomplishes this,
|
329 |
|
|
it should go away as soon as libstdc++-v3 has a real fix. */
|
330 |
|
|
#undef CPLUSPLUS_CPP_SPEC
|
331 |
|
|
#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
|
332 |
|
|
|
333 |
|
|
#undef LINK_SHLIB_SPEC
|
334 |
|
|
#define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
|
335 |
|
|
|
336 |
|
|
#undef LIB_DEFAULT_SPEC
|
337 |
|
|
#define LIB_DEFAULT_SPEC "%(lib_linux)"
|
338 |
|
|
|
339 |
|
|
#undef STARTFILE_DEFAULT_SPEC
|
340 |
|
|
#define STARTFILE_DEFAULT_SPEC "%(startfile_linux)"
|
341 |
|
|
|
342 |
|
|
#undef ENDFILE_DEFAULT_SPEC
|
343 |
|
|
#define ENDFILE_DEFAULT_SPEC "%(endfile_linux)"
|
344 |
|
|
|
345 |
|
|
#undef LINK_START_DEFAULT_SPEC
|
346 |
|
|
#define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
|
347 |
|
|
|
348 |
|
|
#undef LINK_OS_DEFAULT_SPEC
|
349 |
|
|
#define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
|
350 |
|
|
|
351 |
|
|
#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
|
352 |
|
|
#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
|
353 |
|
|
#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
|
354 |
|
|
#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
|
355 |
|
|
#if UCLIBC_DEFAULT
|
356 |
|
|
#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:%{muclibc:%e-mglibc and -muclibc used together}" G ";:" U "}"
|
357 |
|
|
#else
|
358 |
|
|
#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:%{mglibc:%e-mglibc and -muclibc used together}" U ";:" G "}"
|
359 |
|
|
#endif
|
360 |
|
|
#define LINUX_DYNAMIC_LINKER32 \
|
361 |
|
|
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
|
362 |
|
|
#define LINUX_DYNAMIC_LINKER64 \
|
363 |
|
|
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
|
364 |
|
|
|
365 |
|
|
|
366 |
|
|
#define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux %{!shared: %{!static: \
|
367 |
|
|
%{rdynamic:-export-dynamic} \
|
368 |
|
|
%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER32 "}}}"
|
369 |
|
|
|
370 |
|
|
#define LINK_OS_LINUX_SPEC64 "-m elf64ppc %{!shared: %{!static: \
|
371 |
|
|
%{rdynamic:-export-dynamic} \
|
372 |
|
|
%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER64 "}}}"
|
373 |
|
|
|
374 |
|
|
#undef TOC_SECTION_ASM_OP
|
375 |
|
|
#define TOC_SECTION_ASM_OP \
|
376 |
|
|
(TARGET_64BIT \
|
377 |
|
|
? "\t.section\t\".toc\",\"aw\"" \
|
378 |
|
|
: "\t.section\t\".got\",\"aw\"")
|
379 |
|
|
|
380 |
|
|
#undef MINIMAL_TOC_SECTION_ASM_OP
|
381 |
|
|
#define MINIMAL_TOC_SECTION_ASM_OP \
|
382 |
|
|
(TARGET_64BIT \
|
383 |
|
|
? "\t.section\t\".toc1\",\"aw\"" \
|
384 |
|
|
: ((TARGET_RELOCATABLE || flag_pic) \
|
385 |
|
|
? "\t.section\t\".got2\",\"aw\"" \
|
386 |
|
|
: "\t.section\t\".got1\",\"aw\""))
|
387 |
|
|
|
388 |
|
|
#undef TARGET_VERSION
|
389 |
|
|
#define TARGET_VERSION fprintf (stderr, " (PowerPC64 GNU/Linux)");
|
390 |
|
|
|
391 |
|
|
/* Must be at least as big as our pointer type. */
|
392 |
|
|
#undef SIZE_TYPE
|
393 |
|
|
#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
|
394 |
|
|
|
395 |
|
|
#undef PTRDIFF_TYPE
|
396 |
|
|
#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
|
397 |
|
|
|
398 |
|
|
#undef WCHAR_TYPE
|
399 |
|
|
#define WCHAR_TYPE (TARGET_64BIT ? "int" : "long int")
|
400 |
|
|
#undef WCHAR_TYPE_SIZE
|
401 |
|
|
#define WCHAR_TYPE_SIZE 32
|
402 |
|
|
|
403 |
|
|
/* Override rs6000.h definition. */
|
404 |
|
|
#undef ASM_APP_ON
|
405 |
|
|
#define ASM_APP_ON "#APP\n"
|
406 |
|
|
|
407 |
|
|
/* Override rs6000.h definition. */
|
408 |
|
|
#undef ASM_APP_OFF
|
409 |
|
|
#define ASM_APP_OFF "#NO_APP\n"
|
410 |
|
|
|
411 |
|
|
/* PowerPC no-op instruction. */
|
412 |
|
|
#undef RS6000_CALL_GLUE
|
413 |
|
|
#define RS6000_CALL_GLUE (TARGET_64BIT ? "nop" : "cror 31,31,31")
|
414 |
|
|
|
415 |
|
|
#undef RS6000_MCOUNT
|
416 |
|
|
#define RS6000_MCOUNT "_mcount"
|
417 |
|
|
|
418 |
|
|
#ifdef __powerpc64__
|
419 |
|
|
/* _init and _fini functions are built from bits spread across many
|
420 |
|
|
object files, each potentially with a different TOC pointer. For
|
421 |
|
|
that reason, place a nop after the call so that the linker can
|
422 |
|
|
restore the TOC pointer if a TOC adjusting call stub is needed. */
|
423 |
|
|
#if DOT_SYMBOLS
|
424 |
|
|
#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
|
425 |
|
|
asm (SECTION_OP "\n" \
|
426 |
|
|
" bl ." #FUNC "\n" \
|
427 |
|
|
" nop\n" \
|
428 |
|
|
" .previous");
|
429 |
|
|
#else
|
430 |
|
|
#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
|
431 |
|
|
asm (SECTION_OP "\n" \
|
432 |
|
|
" bl " #FUNC "\n" \
|
433 |
|
|
" nop\n" \
|
434 |
|
|
" .previous");
|
435 |
|
|
#endif
|
436 |
|
|
#endif
|
437 |
|
|
|
438 |
|
|
/* FP save and restore routines. */
|
439 |
|
|
#undef SAVE_FP_PREFIX
|
440 |
|
|
#define SAVE_FP_PREFIX (TARGET_64BIT ? "._savef" : "_savefpr_")
|
441 |
|
|
#undef SAVE_FP_SUFFIX
|
442 |
|
|
#define SAVE_FP_SUFFIX ""
|
443 |
|
|
#undef RESTORE_FP_PREFIX
|
444 |
|
|
#define RESTORE_FP_PREFIX (TARGET_64BIT ? "._restf" : "_restfpr_")
|
445 |
|
|
#undef RESTORE_FP_SUFFIX
|
446 |
|
|
#define RESTORE_FP_SUFFIX ""
|
447 |
|
|
|
448 |
|
|
/* Dwarf2 debugging. */
|
449 |
|
|
#undef PREFERRED_DEBUGGING_TYPE
|
450 |
|
|
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
|
451 |
|
|
|
452 |
|
|
/* This is how to declare the size of a function. */
|
453 |
|
|
#undef ASM_DECLARE_FUNCTION_SIZE
|
454 |
|
|
#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
|
455 |
|
|
do \
|
456 |
|
|
{ \
|
457 |
|
|
if (!flag_inhibit_size_directive) \
|
458 |
|
|
{ \
|
459 |
|
|
fputs ("\t.size\t", (FILE)); \
|
460 |
|
|
if (TARGET_64BIT && DOT_SYMBOLS) \
|
461 |
|
|
putc ('.', (FILE)); \
|
462 |
|
|
assemble_name ((FILE), (FNAME)); \
|
463 |
|
|
fputs (",.-", (FILE)); \
|
464 |
|
|
rs6000_output_function_entry (FILE, FNAME); \
|
465 |
|
|
putc ('\n', (FILE)); \
|
466 |
|
|
} \
|
467 |
|
|
} \
|
468 |
|
|
while (0)
|
469 |
|
|
|
470 |
|
|
/* Return nonzero if this entry is to be written into the constant
|
471 |
|
|
pool in a special way. We do so if this is a SYMBOL_REF, LABEL_REF
|
472 |
|
|
or a CONST containing one of them. If -mfp-in-toc (the default),
|
473 |
|
|
we also do this for floating-point constants. We actually can only
|
474 |
|
|
do this if the FP formats of the target and host machines are the
|
475 |
|
|
same, but we can't check that since not every file that uses
|
476 |
|
|
the macros includes real.h. We also do this when we can write the
|
477 |
|
|
entry into the TOC and the entry is not larger than a TOC entry. */
|
478 |
|
|
|
479 |
|
|
#undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
|
480 |
|
|
#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
|
481 |
|
|
(TARGET_TOC \
|
482 |
|
|
&& (GET_CODE (X) == SYMBOL_REF \
|
483 |
|
|
|| (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
|
484 |
|
|
&& GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
|
485 |
|
|
|| GET_CODE (X) == LABEL_REF \
|
486 |
|
|
|| (GET_CODE (X) == CONST_INT \
|
487 |
|
|
&& GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
|
488 |
|
|
|| (GET_CODE (X) == CONST_DOUBLE \
|
489 |
|
|
&& ((TARGET_64BIT \
|
490 |
|
|
&& (TARGET_MINIMAL_TOC \
|
491 |
|
|
|| (SCALAR_FLOAT_MODE_P (GET_MODE (X)) \
|
492 |
|
|
&& ! TARGET_NO_FP_IN_TOC))) \
|
493 |
|
|
|| (!TARGET_64BIT \
|
494 |
|
|
&& !TARGET_NO_FP_IN_TOC \
|
495 |
|
|
&& !TARGET_RELOCATABLE \
|
496 |
|
|
&& SCALAR_FLOAT_MODE_P (GET_MODE (X)) \
|
497 |
|
|
&& BITS_PER_WORD == HOST_BITS_PER_INT)))))
|
498 |
|
|
|
499 |
|
|
/* Select a format to encode pointers in exception handling data. CODE
|
500 |
|
|
is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
|
501 |
|
|
true if the symbol may be affected by dynamic relocations. */
|
502 |
|
|
#undef ASM_PREFERRED_EH_DATA_FORMAT
|
503 |
|
|
#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
|
504 |
|
|
((TARGET_64BIT || flag_pic || TARGET_RELOCATABLE) \
|
505 |
|
|
? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel \
|
506 |
|
|
| (TARGET_64BIT ? DW_EH_PE_udata8 : DW_EH_PE_sdata4)) \
|
507 |
|
|
: DW_EH_PE_absptr)
|
508 |
|
|
|
509 |
|
|
/* For backward compatibility, we must continue to use the AIX
|
510 |
|
|
structure return convention. */
|
511 |
|
|
#undef DRAFT_V4_STRUCT_RET
|
512 |
|
|
#define DRAFT_V4_STRUCT_RET (!TARGET_64BIT)
|
513 |
|
|
|
514 |
|
|
#define TARGET_ASM_FILE_END rs6000_elf_end_indicate_exec_stack
|
515 |
|
|
|
516 |
|
|
#define TARGET_POSIX_IO
|
517 |
|
|
|
518 |
|
|
#define LINK_GCC_C_SEQUENCE_SPEC \
|
519 |
|
|
"%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
|
520 |
|
|
|
521 |
|
|
/* Use --as-needed -lgcc_s for eh support. */
|
522 |
|
|
#ifdef HAVE_LD_AS_NEEDED
|
523 |
|
|
#define USE_LD_AS_NEEDED 1
|
524 |
|
|
#endif
|
525 |
|
|
|
526 |
|
|
#define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h"
|
527 |
|
|
|
528 |
|
|
#ifdef TARGET_LIBC_PROVIDES_SSP
|
529 |
|
|
/* ppc32 glibc provides __stack_chk_guard in -0x7008(2),
|
530 |
|
|
ppc64 glibc provides it at -0x7010(13). */
|
531 |
|
|
#define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? -0x7010 : -0x7008)
|
532 |
|
|
#endif
|
533 |
|
|
|
534 |
|
|
#define POWERPC_LINUX
|
535 |
|
|
|
536 |
|
|
/* ppc{32,64} linux has 128-bit long double support in glibc 2.4 and later. */
|
537 |
|
|
#ifdef TARGET_DEFAULT_LONG_DOUBLE_128
|
538 |
|
|
#define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128
|
539 |
|
|
#endif
|