1 /* Definitions of target machine for GNU compiler,
2    for 64 bit PowerPC linux.
3    Copyright (C) 2000-2014 Free Software Foundation, Inc.
4 
5    This file is part of GCC.
6 
7    GCC is free software; you can redistribute it and/or modify it
8    under the terms of the GNU General Public License as published
9    by the Free Software Foundation; either version 3, or (at your
10    option) any later version.
11 
12    GCC is distributed in the hope that it will be useful, but WITHOUT
13    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
15    License for more details.
16 
17    Under Section 7 of GPL version 3, you are granted additional
18    permissions described in the GCC Runtime Library Exception, version
19    3.1, as published by the Free Software Foundation.
20 
21    You should have received a copy of the GNU General Public License and
22    a copy of the GCC Runtime Library Exception along with this program;
23    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
24    <http://www.gnu.org/licenses/>.  */
25 
26 #ifndef RS6000_BI_ARCH
27 
28 #undef	TARGET_64BIT
29 #define	TARGET_64BIT 1
30 
31 #define	DEFAULT_ARCH64_P 1
32 #define	RS6000_BI_ARCH_P 0
33 
34 #else
35 
36 #define	DEFAULT_ARCH64_P (TARGET_DEFAULT & MASK_64BIT)
37 #define	RS6000_BI_ARCH_P 1
38 
39 #endif
40 
41 #ifdef IN_LIBGCC2
42 #undef TARGET_64BIT
43 #ifdef __powerpc64__
44 #define TARGET_64BIT 1
45 #else
46 #define TARGET_64BIT 0
47 #endif
48 #endif
49 
50 #undef	TARGET_AIX
51 #define	TARGET_AIX TARGET_64BIT
52 
53 #ifdef HAVE_LD_NO_DOT_SYMS
54 /* New ABI uses a local sym for the function entry point.  */
55 extern int dot_symbols;
56 #undef DOT_SYMBOLS
57 #define DOT_SYMBOLS dot_symbols
58 #endif
59 
60 #define TARGET_PROFILE_KERNEL profile_kernel
61 
62 #define TARGET_USES_LINUX64_OPT 1
63 #ifdef HAVE_LD_LARGE_TOC
64 #undef TARGET_CMODEL
65 #define TARGET_CMODEL rs6000_current_cmodel
66 #define SET_CMODEL(opt) rs6000_current_cmodel = opt
67 #else
68 #define SET_CMODEL(opt) do {} while (0)
69 #endif
70 
71 #undef  PROCESSOR_DEFAULT
72 #define PROCESSOR_DEFAULT PROCESSOR_POWER7
73 #undef  PROCESSOR_DEFAULT64
74 #ifdef LINUX64_DEFAULT_ABI_ELFv2
75 #define PROCESSOR_DEFAULT64 PROCESSOR_POWER8
76 #else
77 #define PROCESSOR_DEFAULT64 PROCESSOR_POWER7
78 #endif
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   (rs6000_isa_flags & rs6000_isa_flags_explicit & OPTION_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 #ifdef LINUX64_DEFAULT_ABI_ELFv2
93 #define ELFv2_ABI_CHECK (rs6000_elf_abi != 1)
94 #else
95 #define ELFv2_ABI_CHECK (rs6000_elf_abi == 2)
96 #endif
97 
98 #undef	SUBSUBTARGET_OVERRIDE_OPTIONS
99 #define	SUBSUBTARGET_OVERRIDE_OPTIONS				\
100   do								\
101     {								\
102       if (!global_options_set.x_rs6000_alignment_flags)		\
103 	rs6000_alignment_flags = MASK_ALIGN_NATURAL;		\
104       if (TARGET_64BIT)						\
105 	{							\
106 	  if (DEFAULT_ABI != ABI_AIX)				\
107 	    {							\
108 	      rs6000_current_abi = ABI_AIX;			\
109 	      error (INVALID_64BIT, "call");			\
110 	    }							\
111 	  dot_symbols = !strcmp (rs6000_abi_name, "aixdesc");	\
112 	  if (ELFv2_ABI_CHECK)					\
113 	    {							\
114 	      rs6000_current_abi = ABI_ELFv2;			\
115 	      if (dot_symbols)					\
116 		error ("-mcall-aixdesc incompatible with -mabi=elfv2"); \
117 	    }							\
118 	  if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE)	\
119 	    {							\
120 	      rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE;	\
121 	      error (INVALID_64BIT, "relocatable");		\
122 	    }							\
123 	  if (rs6000_isa_flags & OPTION_MASK_EABI)		\
124 	    {							\
125 	      rs6000_isa_flags &= ~OPTION_MASK_EABI;		\
126 	      error (INVALID_64BIT, "eabi");			\
127 	    }							\
128 	  if (TARGET_PROTOTYPE)					\
129 	    {							\
130 	      target_prototype = 0;				\
131 	      error (INVALID_64BIT, "prototype");		\
132 	    }							\
133 	  if ((rs6000_isa_flags & OPTION_MASK_POWERPC64) == 0)	\
134 	    {							\
135 	      rs6000_isa_flags |= OPTION_MASK_POWERPC64;	\
136 	      error ("-m64 requires a PowerPC64 cpu");		\
137 	    }							\
138 	  if ((rs6000_isa_flags_explicit			\
139 	       & OPTION_MASK_MINIMAL_TOC) != 0)			\
140 	    {							\
141 	      if (global_options_set.x_rs6000_current_cmodel	\
142 		  && rs6000_current_cmodel != CMODEL_SMALL)	\
143 		error ("-mcmodel incompatible with other toc options"); \
144 	      SET_CMODEL (CMODEL_SMALL);			\
145 	    }							\
146 	  else							\
147 	    {							\
148 	      if (!global_options_set.x_rs6000_current_cmodel)	\
149 		SET_CMODEL (CMODEL_MEDIUM);			\
150 	      if (rs6000_current_cmodel != CMODEL_SMALL)	\
151 		{						\
152 		  if (!global_options_set.x_TARGET_NO_FP_IN_TOC) \
153 		    TARGET_NO_FP_IN_TOC				\
154 		      = rs6000_current_cmodel == CMODEL_MEDIUM;	\
155 		  if (!global_options_set.x_TARGET_NO_SUM_IN_TOC) \
156 		    TARGET_NO_SUM_IN_TOC = 0;			\
157 		}						\
158 	    }							\
159 	}							\
160       else							\
161 	{							\
162 	  if (!RS6000_BI_ARCH_P)				\
163 	    error (INVALID_32BIT, "32");			\
164 	  if (TARGET_PROFILE_KERNEL)				\
165 	    {							\
166 	      TARGET_PROFILE_KERNEL = 0;			\
167 	      error (INVALID_32BIT, "profile-kernel");		\
168 	    }							\
169 	  if (global_options_set.x_rs6000_current_cmodel)	\
170 	    {							\
171 	      SET_CMODEL (CMODEL_SMALL);			\
172 	      error (INVALID_32BIT, "cmodel");			\
173 	    }							\
174 	}							\
175     }								\
176   while (0)
177 
178 #undef	ASM_DEFAULT_SPEC
179 #undef	ASM_SPEC
180 #undef	LINK_OS_LINUX_SPEC
181 
182 #ifndef	RS6000_BI_ARCH
183 #define	ASM_DEFAULT_SPEC "-mppc64"
184 #define	ASM_SPEC	 "%(asm_spec64) %(asm_spec_common)"
185 #define	LINK_OS_LINUX_SPEC "%(link_os_linux_spec64)"
186 #else
187 #if DEFAULT_ARCH64_P
188 #define	ASM_DEFAULT_SPEC "-mppc%{!m32:64}"
189 #define	ASM_SPEC	 "%{m32:%(asm_spec32)}%{!m32:%(asm_spec64)} %(asm_spec_common)"
190 #define	LINK_OS_LINUX_SPEC "%{m32:%(link_os_linux_spec32)}%{!m32:%(link_os_linux_spec64)}"
191 #else
192 #define	ASM_DEFAULT_SPEC "-mppc%{m64:64}"
193 #define	ASM_SPEC	 "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)"
194 #define	LINK_OS_LINUX_SPEC "%{!m64:%(link_os_linux_spec32)}%{m64:%(link_os_linux_spec64)}"
195 #endif
196 #endif
197 
198 #define ASM_SPEC32 "-a32 \
199 %{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \
200 %{memb|msdata=eabi: -memb}"
201 
202 #define ASM_SPEC64 "-a64"
203 
204 #define ASM_SPEC_COMMON "%(asm_cpu) \
205 %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}}" \
206   ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
207 
208 #undef	SUBSUBTARGET_EXTRA_SPECS
209 #define SUBSUBTARGET_EXTRA_SPECS \
210   { "asm_spec_common",		ASM_SPEC_COMMON },			\
211   { "asm_spec32",		ASM_SPEC32 },				\
212   { "asm_spec64",		ASM_SPEC64 },				\
213   { "link_os_linux_spec32",	LINK_OS_LINUX_SPEC32 },			\
214   { "link_os_linux_spec64",	LINK_OS_LINUX_SPEC64 },
215 
216 #undef	MULTILIB_DEFAULTS
217 #if DEFAULT_ARCH64_P
218 #define MULTILIB_DEFAULTS { "m64" }
219 #else
220 #define MULTILIB_DEFAULTS { "m32" }
221 #endif
222 
223 #ifndef RS6000_BI_ARCH
224 
225 /* 64-bit PowerPC Linux always has a TOC.  */
226 #undef  TARGET_TOC
227 #define	TARGET_TOC		1
228 
229 /* Some things from sysv4.h we don't do when 64 bit.  */
230 #undef	OPTION_RELOCATABLE
231 #define	OPTION_RELOCATABLE	0
232 #undef	OPTION_EABI
233 #define	OPTION_EABI		0
234 #undef	OPTION_PROTOTYPE
235 #define	OPTION_PROTOTYPE	0
236 #undef RELOCATABLE_NEEDS_FIXUP
237 #define RELOCATABLE_NEEDS_FIXUP 0
238 
239 #endif
240 
241 /* We use glibc _mcount for profiling.  */
242 #define NO_PROFILE_COUNTERS 1
243 #define PROFILE_HOOK(LABEL) \
244   do { if (TARGET_64BIT) output_profile_hook (LABEL); } while (0)
245 
246 /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given.  */
247 #undef  ADJUST_FIELD_ALIGN
248 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
249   (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED))		\
250    ? 128								\
251    : (TARGET_64BIT							\
252       && TARGET_ALIGN_NATURAL == 0					\
253       && TYPE_MODE (strip_array_types (TREE_TYPE (FIELD))) == DFmode)	\
254    ? MIN ((COMPUTED), 32)						\
255    : (COMPUTED))
256 
257 /* PowerPC64 Linux increases natural record alignment to doubleword if
258    the first field is an FP double, only if in power alignment mode.  */
259 #undef  ROUND_TYPE_ALIGN
260 #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED)			\
261   ((TARGET_64BIT							\
262     && (TREE_CODE (STRUCT) == RECORD_TYPE				\
263 	|| TREE_CODE (STRUCT) == UNION_TYPE				\
264 	|| TREE_CODE (STRUCT) == QUAL_UNION_TYPE)			\
265     && TARGET_ALIGN_NATURAL == 0)					\
266    ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED)	\
267    : MAX ((COMPUTED), (SPECIFIED)))
268 
269 /* Use the default for compiling target libs.  */
270 #ifdef IN_TARGET_LIBS
271 #undef TARGET_ALIGN_NATURAL
272 #define TARGET_ALIGN_NATURAL 1
273 #endif
274 
275 /* Indicate that jump tables go in the text section.  */
276 #undef  JUMP_TABLES_IN_TEXT_SECTION
277 #define JUMP_TABLES_IN_TEXT_SECTION TARGET_64BIT
278 
279 /* The linux ppc64 ABI isn't explicit on whether aggregates smaller
280    than a doubleword should be padded upward or downward.  You could
281    reasonably assume that they follow the normal rules for structure
282    layout treating the parameter area as any other block of memory,
283    then map the reg param area to registers.  i.e. pad upward.
284    Setting both of the following defines results in this behavior.
285    Setting just the first one will result in aggregates that fit in a
286    doubleword being padded downward, and others being padded upward.
287    Not a bad idea as this results in struct { int x; } being passed
288    the same way as an int.  */
289 #define AGGREGATE_PADDING_FIXED TARGET_64BIT
290 #define AGGREGATES_PAD_UPWARD_ALWAYS 0
291 
292 /* Specify padding for the last element of a block move between
293    registers and memory.  FIRST is nonzero if this is the only
294    element.  */
295 #define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
296   (!(FIRST) ? upward : FUNCTION_ARG_PADDING (MODE, TYPE))
297 
298 /* Linux doesn't support saving and restoring 64-bit regs in a 32-bit
299    process.  */
300 #define OS_MISSING_POWERPC64 !TARGET_64BIT
301 
302 #ifdef SINGLE_LIBC
303 #define OPTION_GLIBC  (DEFAULT_LIBC == LIBC_GLIBC)
304 #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
305 #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
306 #else
307 #define OPTION_GLIBC  (linux_libc == LIBC_GLIBC)
308 #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
309 #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
310 #endif
311 
312 /* Determine what functions are present at the runtime;
313    this includes full c99 runtime and sincos.  */
314 #undef TARGET_LIBC_HAS_FUNCTION
315 #define TARGET_LIBC_HAS_FUNCTION linux_libc_has_function
316 
317 #undef  TARGET_OS_CPP_BUILTINS
318 #define TARGET_OS_CPP_BUILTINS()			\
319   do							\
320     {							\
321       if (TARGET_64BIT)					\
322 	{						\
323 	  builtin_define ("__PPC__");			\
324 	  builtin_define ("__PPC64__");			\
325 	  builtin_define ("__powerpc__");		\
326 	  builtin_define ("__powerpc64__");		\
327 	  if (!DOT_SYMBOLS)				\
328 	    builtin_define ("_CALL_LINUX");		\
329 	  builtin_assert ("cpu=powerpc64");		\
330 	  builtin_assert ("machine=powerpc64");		\
331 	}						\
332       else						\
333 	{						\
334 	  builtin_define_std ("PPC");			\
335 	  builtin_define_std ("powerpc");		\
336 	  builtin_assert ("cpu=powerpc");		\
337 	  builtin_assert ("machine=powerpc");		\
338 	  TARGET_OS_SYSV_CPP_BUILTINS ();		\
339 	}						\
340     }							\
341   while (0)
342 
343 #undef  CPP_OS_DEFAULT_SPEC
344 #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
345 
346 /* The GNU C++ standard library currently requires _GNU_SOURCE being
347    defined on glibc-based systems. This temporary hack accomplishes this,
348    it should go away as soon as libstdc++-v3 has a real fix.  */
349 #undef  CPLUSPLUS_CPP_SPEC
350 #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
351 
352 #undef  LINK_SHLIB_SPEC
353 #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
354 
355 #undef  LIB_DEFAULT_SPEC
356 #define LIB_DEFAULT_SPEC "%(lib_linux)"
357 
358 #undef  STARTFILE_DEFAULT_SPEC
359 #define STARTFILE_DEFAULT_SPEC "%(startfile_linux)"
360 
361 #undef	ENDFILE_DEFAULT_SPEC
362 #define ENDFILE_DEFAULT_SPEC "%(endfile_linux)"
363 
364 #undef	LINK_START_DEFAULT_SPEC
365 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
366 
367 #undef	LINK_OS_DEFAULT_SPEC
368 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
369 
370 #define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
371 #ifdef LINUX64_DEFAULT_ABI_ELFv2
372 #define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/lib64/ld64.so.1;:/lib64/ld64.so.2}"
373 #else
374 #define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
375 #endif
376 #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
377 #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
378 #if DEFAULT_LIBC == LIBC_UCLIBC
379 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
380 #elif DEFAULT_LIBC == LIBC_GLIBC
381 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
382 #else
383 #error "Unsupported DEFAULT_LIBC"
384 #endif
385 #define GNU_USER_DYNAMIC_LINKER32 \
386   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
387 #define GNU_USER_DYNAMIC_LINKER64 \
388   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
389 
390 #undef  DEFAULT_ASM_ENDIAN
391 #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
392 #define DEFAULT_ASM_ENDIAN " -mlittle"
393 #define LINK_OS_LINUX_EMUL32 ENDIAN_SELECT(" -m elf32ppclinux",		\
394 					   " -m elf32lppclinux",	\
395 					   " -m elf32lppclinux")
396 #define LINK_OS_LINUX_EMUL64 ENDIAN_SELECT(" -m elf64ppc",		\
397 					   " -m elf64lppc",		\
398 					   " -m elf64lppc")
399 #else
400 #define DEFAULT_ASM_ENDIAN " -mbig"
401 #define LINK_OS_LINUX_EMUL32 ENDIAN_SELECT(" -m elf32ppclinux",		\
402 					   " -m elf32lppclinux",	\
403 					   " -m elf32ppclinux")
404 #define LINK_OS_LINUX_EMUL64 ENDIAN_SELECT(" -m elf64ppc",		\
405 					   " -m elf64lppc",		\
406 					   " -m elf64ppc")
407 #endif
408 
409 #define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
410   %{rdynamic:-export-dynamic} \
411   -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}}"
412 
413 #define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " %{!shared: %{!static: \
414   %{rdynamic:-export-dynamic} \
415   -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}"
416 
417 #undef  TOC_SECTION_ASM_OP
418 #define TOC_SECTION_ASM_OP \
419   (TARGET_64BIT						\
420    ? "\t.section\t\".toc\",\"aw\""			\
421    : "\t.section\t\".got\",\"aw\"")
422 
423 #undef  MINIMAL_TOC_SECTION_ASM_OP
424 #define MINIMAL_TOC_SECTION_ASM_OP \
425   (TARGET_64BIT						\
426    ? "\t.section\t\".toc1\",\"aw\""			\
427    : ((TARGET_RELOCATABLE || flag_pic)			\
428       ? "\t.section\t\".got2\",\"aw\""			\
429       : "\t.section\t\".got1\",\"aw\""))
430 
431 /* Must be at least as big as our pointer type.  */
432 #undef	SIZE_TYPE
433 #define	SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
434 
435 #undef	PTRDIFF_TYPE
436 #define	PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
437 
438 #undef	WCHAR_TYPE
439 #define	WCHAR_TYPE (TARGET_64BIT ? "int" : "long int")
440 #undef  WCHAR_TYPE_SIZE
441 #define WCHAR_TYPE_SIZE 32
442 
443 /* Override rs6000.h definition.  */
444 #undef  ASM_APP_ON
445 #define ASM_APP_ON "#APP\n"
446 
447 /* Override rs6000.h definition.  */
448 #undef  ASM_APP_OFF
449 #define ASM_APP_OFF "#NO_APP\n"
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_POSIX_IO
551 
552 #define LINK_GCC_C_SEQUENCE_SPEC \
553   "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
554 
555 /* Use --as-needed -lgcc_s for eh support.  */
556 #ifdef HAVE_LD_AS_NEEDED
557 #define USE_LD_AS_NEEDED 1
558 #endif
559 
560 #ifdef TARGET_LIBC_PROVIDES_SSP
561 /* ppc32 glibc provides __stack_chk_guard in -0x7008(2),
562    ppc64 glibc provides it at -0x7010(13).  */
563 #define TARGET_THREAD_SSP_OFFSET	(TARGET_64BIT ? -0x7010 : -0x7008)
564 #endif
565 
566 #define POWERPC_LINUX
567 
568 /* ppc{32,64} linux has 128-bit long double support in glibc 2.4 and later.  */
569 #ifdef TARGET_DEFAULT_LONG_DOUBLE_128
570 #define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128
571 #endif
572 
573 /* Static stack checking is supported by means of probes.  */
574 #define STACK_CHECK_STATIC_BUILTIN 1
575 
576 /* The default value isn't sufficient in 64-bit mode.  */
577 #define STACK_CHECK_PROTECT (TARGET_64BIT ? 16 * 1024 : 12 * 1024)
578 
579 /* Software floating point support for exceptions and rounding modes
580    depends on the C library in use.  */
581 #undef TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P
582 #define TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P \
583   rs6000_linux_float_exceptions_rounding_supported_p
584