OSDN Git Service

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