OSDN Git Service

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