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