1 /* Target definitions for GNU compiler for PowerPC running System V.4
2    Copyright (C) 1995-2018 Free Software Foundation, Inc.
3    Contributed by Cygnus Support.
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 /* Header files should be C++ aware in general.  */
27 #undef  NO_IMPLICIT_EXTERN_C
28 #define NO_IMPLICIT_EXTERN_C
29 
30 /* Yes!  We are ELF.  */
31 #define	TARGET_OBJECT_FORMAT OBJECT_ELF
32 
33 /* Default ABI to compile code for.  */
34 #define DEFAULT_ABI rs6000_current_abi
35 
36 /* Default ABI to use.  */
37 #define RS6000_ABI_NAME "sysv"
38 
39 /* Override rs6000.h definition.  */
40 #undef	ASM_DEFAULT_SPEC
41 #define	ASM_DEFAULT_SPEC "-mppc"
42 
43 #define	TARGET_TOC		(TARGET_64BIT				\
44 				 || (TARGET_MINIMAL_TOC			\
45 				     && flag_pic > 1)			\
46 				 || DEFAULT_ABI != ABI_V4)
47 
48 #define	TARGET_BITFIELD_TYPE	(! TARGET_NO_BITFIELD_TYPE)
49 #define	TARGET_BIG_ENDIAN	(! TARGET_LITTLE_ENDIAN)
50 #define	TARGET_PROTOTYPE	target_prototype
51 #define	TARGET_NO_PROTOTYPE	(! TARGET_PROTOTYPE)
52 #define	TARGET_NO_TOC		(! TARGET_TOC)
53 #define	TARGET_NO_EABI		(! TARGET_EABI)
54 #define	TARGET_REGNAMES		rs6000_regnames
55 
56 #ifdef HAVE_AS_REL16
57 #undef TARGET_SECURE_PLT
58 #define TARGET_SECURE_PLT	secure_plt
59 #endif
60 
61 #define SDATA_DEFAULT_SIZE 8
62 
63 /* The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
64    get control in TARGET_OPTION_OVERRIDE.  */
65 
66 #define SUBTARGET_OVERRIDE_OPTIONS					\
67 do {									\
68   if (!global_options_set.x_g_switch_value)				\
69     g_switch_value = SDATA_DEFAULT_SIZE;				\
70 									\
71   if (rs6000_abi_name == NULL)						\
72     rs6000_abi_name = RS6000_ABI_NAME;					\
73 									\
74   if (!strcmp (rs6000_abi_name, "sysv"))				\
75     rs6000_current_abi = ABI_V4;					\
76   else if (!strcmp (rs6000_abi_name, "sysv-noeabi"))			\
77     {									\
78       rs6000_current_abi = ABI_V4;					\
79       rs6000_isa_flags &= ~ OPTION_MASK_EABI;				\
80     }									\
81   else if (!strcmp (rs6000_abi_name, "sysv-eabi")			\
82 	   || !strcmp (rs6000_abi_name, "eabi"))			\
83     {									\
84       rs6000_current_abi = ABI_V4;					\
85       rs6000_isa_flags |= OPTION_MASK_EABI;				\
86     }									\
87   else if (!strcmp (rs6000_abi_name, "aixdesc"))			\
88     rs6000_current_abi = ABI_AIX;					\
89   else if (!strcmp (rs6000_abi_name, "freebsd")				\
90 	   || !strcmp (rs6000_abi_name, "linux"))			\
91     {									\
92       if (TARGET_64BIT)							\
93 	rs6000_current_abi = ABI_AIX;					\
94       else								\
95 	rs6000_current_abi = ABI_V4;					\
96     }									\
97   else if (!strcmp (rs6000_abi_name, "netbsd"))				\
98     rs6000_current_abi = ABI_V4;					\
99   else if (!strcmp (rs6000_abi_name, "openbsd"))			\
100     rs6000_current_abi = ABI_V4;					\
101   else if (!strcmp (rs6000_abi_name, "i960-old"))			\
102     {									\
103       rs6000_current_abi = ABI_V4;					\
104       rs6000_isa_flags |= (OPTION_MASK_LITTLE_ENDIAN | OPTION_MASK_EABI); \
105       rs6000_isa_flags &= ~OPTION_MASK_STRICT_ALIGN;			\
106       TARGET_NO_BITFIELD_WORD = 1;					\
107     }									\
108   else									\
109     {									\
110       rs6000_current_abi = ABI_V4;					\
111       error ("bad value for -mcall-%s", rs6000_abi_name);		\
112     }									\
113 									\
114   if (rs6000_sdata_name)						\
115     {									\
116       if (!strcmp (rs6000_sdata_name, "none"))				\
117 	rs6000_sdata = SDATA_NONE;					\
118       else if (!strcmp (rs6000_sdata_name, "data"))			\
119 	rs6000_sdata = SDATA_DATA;					\
120       else if (!strcmp (rs6000_sdata_name, "default"))			\
121 	rs6000_sdata = (TARGET_EABI) ? SDATA_EABI : SDATA_SYSV;		\
122       else if (!strcmp (rs6000_sdata_name, "sysv"))			\
123 	rs6000_sdata = SDATA_SYSV;					\
124       else if (!strcmp (rs6000_sdata_name, "eabi"))			\
125 	rs6000_sdata = SDATA_EABI;					\
126       else								\
127 	error ("bad value for -msdata=%s", rs6000_sdata_name);		\
128     }									\
129   else if (DEFAULT_ABI == ABI_V4)					\
130     {									\
131       rs6000_sdata = SDATA_DATA;					\
132       rs6000_sdata_name = "data";					\
133     }									\
134   else									\
135     {									\
136       rs6000_sdata = SDATA_NONE;					\
137       rs6000_sdata_name = "none";					\
138     }									\
139 									\
140   if (TARGET_RELOCATABLE &&						\
141       (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV))	\
142     {									\
143       rs6000_sdata = SDATA_DATA;					\
144       error ("-mrelocatable and -msdata=%s are incompatible",		\
145 	     rs6000_sdata_name);					\
146     }									\
147 									\
148   else if (flag_pic && DEFAULT_ABI == ABI_V4				\
149 	   && (rs6000_sdata == SDATA_EABI				\
150 	       || rs6000_sdata == SDATA_SYSV))				\
151     {									\
152       rs6000_sdata = SDATA_DATA;					\
153       error ("-f%s and -msdata=%s are incompatible",			\
154 	     (flag_pic > 1) ? "PIC" : "pic",				\
155 	     rs6000_sdata_name);					\
156     }									\
157 									\
158   if ((rs6000_sdata != SDATA_NONE && DEFAULT_ABI != ABI_V4)		\
159       || (rs6000_sdata == SDATA_EABI && !TARGET_EABI))			\
160     {									\
161       rs6000_sdata = SDATA_NONE;					\
162       error ("-msdata=%s and -mcall-%s are incompatible",		\
163 	     rs6000_sdata_name, rs6000_abi_name);			\
164     }									\
165 									\
166   targetm.have_srodata_section = rs6000_sdata == SDATA_EABI;		\
167 									\
168   if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC)			\
169     {									\
170       rs6000_isa_flags |= OPTION_MASK_MINIMAL_TOC;			\
171       error ("-mrelocatable and -mno-minimal-toc are incompatible");	\
172     }									\
173 									\
174   if (TARGET_RELOCATABLE && rs6000_current_abi != ABI_V4)		\
175     {									\
176       rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE;			\
177       error ("-mrelocatable and -mcall-%s are incompatible",		\
178 	     rs6000_abi_name);						\
179     }									\
180 									\
181   if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi != ABI_V4)	\
182     {									\
183       flag_pic = 0;							\
184       error ("-fPIC and -mcall-%s are incompatible",			\
185 	     rs6000_abi_name);						\
186     }									\
187 									\
188   if (TARGET_SECURE_PLT != secure_plt)					\
189     {									\
190       error ("-msecure-plt not supported by your assembler");		\
191     }									\
192 									\
193   if (flag_pic > 1 && DEFAULT_ABI == ABI_V4)				\
194     {									\
195       /* Note: flag_pic should not change any option flags that would	\
196 	 be invalid with or pessimise -fno-PIC code.  LTO turns off	\
197 	 flag_pic when linking/recompiling a fixed position executable. \
198 	 However, if the objects were originally compiled with -fPIC,	\
199 	 then other target options forced on here by -fPIC are restored \
200 	 when recompiling those objects without -fPIC.  In particular	\
201 	 TARGET_RELOCATABLE must not be enabled here by flag_pic.  */	\
202       rs6000_isa_flags |= OPTION_MASK_MINIMAL_TOC;			\
203       TARGET_NO_FP_IN_TOC = 1;						\
204     }									\
205 									\
206   if (TARGET_RELOCATABLE)						\
207     {									\
208       if (!flag_pic)							\
209 	flag_pic = 2;							\
210       TARGET_NO_FP_IN_TOC = 1;						\
211     }									\
212 } while (0)
213 
214 #ifndef RS6000_BI_ARCH
215 # define SUBSUBTARGET_OVERRIDE_OPTIONS					\
216 do {									\
217   if ((TARGET_DEFAULT ^ rs6000_isa_flags) & OPTION_MASK_64BIT)		\
218     error ("-m%s not supported in this configuration",			\
219 	   (rs6000_isa_flags & OPTION_MASK_64BIT) ? "64" : "32");	\
220 } while (0)
221 #endif
222 
223 /* Override rs6000.h definition.  */
224 #undef	TARGET_DEFAULT
225 #define	TARGET_DEFAULT 0
226 
227 /* Override rs6000.h definition.  */
228 #undef	PROCESSOR_DEFAULT
229 #define	PROCESSOR_DEFAULT PROCESSOR_PPC750
230 
231 #define FIXED_R2 1
232 /* System V.4 uses register 13 as a pointer to the small data area,
233    so it is not available to the normal user.  */
234 #define FIXED_R13 1
235 
236 /* Override default big endianism definitions in rs6000.h.  */
237 #undef	BYTES_BIG_ENDIAN
238 #undef	WORDS_BIG_ENDIAN
239 #define	BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
240 #define	WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
241 
242 /* Put jump tables in read-only memory, rather than in .text.  */
243 #define JUMP_TABLES_IN_TEXT_SECTION 0
244 
245 /* Prefix and suffix to use to saving floating point.  */
246 #define	SAVE_FP_PREFIX "_savefpr_"
247 #define SAVE_FP_SUFFIX ""
248 
249 /* Prefix and suffix to use to restoring floating point.  */
250 #define	RESTORE_FP_PREFIX "_restfpr_"
251 #define RESTORE_FP_SUFFIX ""
252 
253 /* Type used for size_t, as a string used in a declaration.  */
254 #undef  SIZE_TYPE
255 #define SIZE_TYPE "unsigned int"
256 
257 /* Type used for ptrdiff_t, as a string used in a declaration.  */
258 #define PTRDIFF_TYPE "int"
259 
260 #undef	WCHAR_TYPE
261 #define WCHAR_TYPE "long int"
262 
263 #undef	WCHAR_TYPE_SIZE
264 #define WCHAR_TYPE_SIZE 32
265 
266 /* Make int foo : 8 not cause structures to be aligned to an int boundary.  */
267 /* Override elfos.h definition.  */
268 #undef	PCC_BITFIELD_TYPE_MATTERS
269 #define	PCC_BITFIELD_TYPE_MATTERS (TARGET_BITFIELD_TYPE)
270 
271 #undef	BITFIELD_NBYTES_LIMITED
272 #define	BITFIELD_NBYTES_LIMITED (TARGET_NO_BITFIELD_WORD)
273 
274 /* Define this macro to be the value 1 if instructions will fail to
275    work if given data not on the nominal alignment.  If instructions
276    will merely go slower in that case, define this macro as 0.  */
277 #undef	STRICT_ALIGNMENT
278 #define	STRICT_ALIGNMENT (TARGET_STRICT_ALIGN)
279 
280 /* Define this macro if you wish to preserve a certain alignment for
281    the stack pointer, greater than what the hardware enforces.  The
282    definition is a C expression for the desired alignment (measured
283    in bits).  This macro must evaluate to a value equal to or larger
284    than STACK_BOUNDARY.
285    For the SYSV ABI and variants the alignment of the stack pointer
286    is usually controlled manually in rs6000.c. However, to maintain
287    alignment across alloca () in all circumstances,
288    PREFERRED_STACK_BOUNDARY needs to be set as well.
289    This has the additional advantage of allowing a bigger maximum
290    alignment of user objects on the stack.  */
291 
292 #undef PREFERRED_STACK_BOUNDARY
293 #define PREFERRED_STACK_BOUNDARY 128
294 
295 /* Real stack boundary as mandated by the appropriate ABI.  */
296 #define ABI_STACK_BOUNDARY \
297   ((TARGET_EABI && !TARGET_ALTIVEC && !TARGET_ALTIVEC_ABI) ? 64 : 128)
298 
299 /* An expression for the alignment of a structure field FIELD if the
300    alignment computed in the usual way is COMPUTED.  */
301 #define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED)			      \
302 	(rs6000_special_adjust_field_align_p ((TYPE), (COMPUTED))	      \
303 	 ? 128 : COMPUTED)
304 
305 #undef  BIGGEST_FIELD_ALIGNMENT
306 
307 /* Use ELF style section commands.  */
308 
309 #define	TEXT_SECTION_ASM_OP	"\t.section\t\".text\""
310 
311 #define	DATA_SECTION_ASM_OP	"\t.section\t\".data\""
312 
313 #define	BSS_SECTION_ASM_OP	"\t.section\t\".bss\""
314 
315 /* Override elfos.h definition.  */
316 #undef	INIT_SECTION_ASM_OP
317 #define	INIT_SECTION_ASM_OP "\t.section\t\".init\",\"ax\""
318 
319 /* Override elfos.h definition.  */
320 #undef	FINI_SECTION_ASM_OP
321 #define	FINI_SECTION_ASM_OP "\t.section\t\".fini\",\"ax\""
322 
323 #define	TOC_SECTION_ASM_OP "\t.section\t\".got\",\"aw\""
324 
325 /* Put PC relative got entries in .got2.  */
326 #define	MINIMAL_TOC_SECTION_ASM_OP \
327   (flag_pic ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
328 
329 #define	SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\""
330 #define	SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\""
331 #define	SBSS_SECTION_ASM_OP "\t.section\t\".sbss\",\"aw\",@nobits"
332 
333 /* Override default elf definitions.  */
334 #define TARGET_ASM_INIT_SECTIONS rs6000_elf_asm_init_sections
335 #undef  TARGET_ASM_RELOC_RW_MASK
336 #define TARGET_ASM_RELOC_RW_MASK rs6000_elf_reloc_rw_mask
337 #undef	TARGET_ASM_SELECT_RTX_SECTION
338 #define	TARGET_ASM_SELECT_RTX_SECTION rs6000_elf_select_rtx_section
339 
340 /* Return nonzero if this entry is to be written into the constant pool
341    in a special way.  We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
342    containing one of them.  If -mfp-in-toc (the default), we also do
343    this for floating-point constants.  We actually can only do this
344    if the FP formats of the target and host machines are the same, but
345    we can't check that since not every file that uses these target macros
346    includes real.h.
347 
348    Unlike AIX, we don't key off of -mminimal-toc, but instead do not
349    allow floating point constants in the TOC if -mrelocatable.  */
350 
351 #undef	ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
352 #define	ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE)			\
353   (TARGET_TOC								\
354    && (GET_CODE (X) == SYMBOL_REF					\
355        || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS	\
356 	   && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF)		\
357        || GET_CODE (X) == LABEL_REF					\
358        || (GET_CODE (X) == CONST_INT 					\
359 	   && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode))	\
360        || (!TARGET_NO_FP_IN_TOC						\
361 	   && GET_CODE (X) == CONST_DOUBLE				\
362 	   && SCALAR_FLOAT_MODE_P (GET_MODE (X))			\
363 	   && BITS_PER_WORD == HOST_BITS_PER_INT)))
364 
365 /* These macros generate the special .type and .size directives which
366    are used to set the corresponding fields of the linker symbol table
367    entries in an ELF object file under SVR4.  These macros also output
368    the starting labels for the relevant functions/objects.  */
369 
370 /* Write the extra assembler code needed to declare a function properly.
371    Some svr4 assemblers need to also have something extra said about the
372    function's return value.  We allow for that here.  */
373 
374 /* Override elfos.h definition.  */
375 #undef	ASM_DECLARE_FUNCTION_NAME
376 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)			\
377   rs6000_elf_declare_function_name ((FILE), (NAME), (DECL))
378 
379 /* The USER_LABEL_PREFIX stuff is affected by the -fleading-underscore
380    flag.  The LOCAL_LABEL_PREFIX variable is used by dbxelf.h.  */
381 
382 #define	LOCAL_LABEL_PREFIX "."
383 #define	USER_LABEL_PREFIX ""
384 
385 #define	ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX)	\
386   asm_fprintf (FILE, "%L%s", PREFIX)
387 
388 /* Globalizing directive for a label.  */
389 #define GLOBAL_ASM_OP "\t.globl "
390 
391 /* This says how to output assembler code to declare an
392    uninitialized internal linkage data object.  Under SVR4,
393    the linker seems to want the alignment of data objects
394    to depend on their types.  We do exactly that here.  */
395 
396 #define	LOCAL_ASM_OP	"\t.local\t"
397 
398 #define	LCOMM_ASM_OP	"\t.lcomm\t"
399 
400 /* Describe how to emit uninitialized local items.  */
401 #define	ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN)	\
402 do {									\
403   if ((DECL) && rs6000_elf_in_small_data_p (DECL))			\
404     {									\
405       switch_to_section (sbss_section);					\
406       ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT));	\
407       ASM_OUTPUT_LABEL (FILE, NAME);					\
408       ASM_OUTPUT_SKIP (FILE, SIZE);					\
409       if (!flag_inhibit_size_directive && (SIZE) > 0)			\
410 	ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE);			\
411     }									\
412   else									\
413     {									\
414       fprintf (FILE, "%s", LCOMM_ASM_OP);				\
415       assemble_name ((FILE), (NAME));					\
416       fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED",%u\n",		\
417 	       (SIZE), (ALIGN) / BITS_PER_UNIT);			\
418     }									\
419   ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object");			\
420 } while (0)
421 
422 /* Describe how to emit uninitialized external linkage items.  */
423 #define	ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN)		\
424 do {									\
425   ASM_OUTPUT_ALIGNED_DECL_LOCAL (FILE, DECL, NAME, SIZE, ALIGN);	\
426 } while (0)
427 
428 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
429 /* To support -falign-* switches we need to use .p2align so
430    that alignment directives in code sections will be padded
431    with no-op instructions, rather than zeroes.  */
432 #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP)			\
433   if ((LOG) != 0)							\
434     {									\
435       if ((MAX_SKIP) == 0)						\
436 	fprintf ((FILE), "\t.p2align %d\n", (LOG));			\
437       else								\
438 	fprintf ((FILE), "\t.p2align %d,,%d\n",	(LOG), (MAX_SKIP));	\
439     }
440 #endif
441 
442 /* This is how to output code to push a register on the stack.
443    It need not be very fast code.
444 
445    On the rs6000, we must keep the backchain up to date.  In order
446    to simplify things, always allocate 16 bytes for a push (System V
447    wants to keep stack aligned to a 16 byte boundary).  */
448 
449 #define	ASM_OUTPUT_REG_PUSH(FILE, REGNO)				\
450 do {									\
451   if (DEFAULT_ABI == ABI_V4)						\
452     asm_fprintf (FILE,							\
453 		 "\tstwu %s,-16(%s)\n\tstw %s,12(%s)\n",	\
454 		 reg_names[1], reg_names[1], reg_names[REGNO],		\
455 		 reg_names[1]);						\
456 } while (0)
457 
458 /* This is how to output an insn to pop a register from the stack.
459    It need not be very fast code.  */
460 
461 #define	ASM_OUTPUT_REG_POP(FILE, REGNO)					\
462 do {									\
463   if (DEFAULT_ABI == ABI_V4)						\
464     asm_fprintf (FILE,							\
465 		 "\tlwz %s,12(%s)\n\taddi %s,%s,16\n",	\
466 		 reg_names[REGNO], reg_names[1], reg_names[1],		\
467 		 reg_names[1]);						\
468 } while (0)
469 
470 extern int fixuplabelno;
471 
472 /* Handle constructors specially for -mrelocatable.  */
473 #define TARGET_ASM_CONSTRUCTOR  rs6000_elf_asm_out_constructor
474 #define TARGET_ASM_DESTRUCTOR   rs6000_elf_asm_out_destructor
475 
476 /* This is the end of what might become sysv4.h.  */
477 
478 /* Use DWARF 2 debugging information by default.  */
479 #undef  PREFERRED_DEBUGGING_TYPE
480 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
481 
482 /* Historically we have also supported stabs debugging.  */
483 #define DBX_DEBUGGING_INFO 1
484 
485 #define TARGET_ENCODE_SECTION_INFO  rs6000_elf_encode_section_info
486 #define TARGET_IN_SMALL_DATA_P  rs6000_elf_in_small_data_p
487 
488 /* The ELF version doesn't encode [DS] or whatever at the end of symbols.  */
489 
490 #define	RS6000_OUTPUT_BASENAME(FILE, NAME)	\
491     assemble_name (FILE, NAME)
492 
493 /* We have to output the stabs for the function name *first*, before
494    outputting its label.  */
495 
496 #define	DBX_FUNCTION_FIRST
497 
498 /* This is the end of what might become sysv4dbx.h.  */
499 
500 #define TARGET_OS_SYSV_CPP_BUILTINS()		\
501   do						\
502     {						\
503       if (rs6000_isa_flags_explicit		\
504 	  & OPTION_MASK_RELOCATABLE)		\
505 	builtin_define ("_RELOCATABLE");	\
506     }						\
507   while (0)
508 
509 #ifndef	TARGET_OS_CPP_BUILTINS
510 #define TARGET_OS_CPP_BUILTINS()		\
511   do						\
512     {						\
513       builtin_define_std ("PPC");		\
514       builtin_define_std ("unix");		\
515       builtin_define ("__svr4__");		\
516       builtin_assert ("system=unix");		\
517       builtin_assert ("system=svr4");		\
518       builtin_assert ("cpu=powerpc");		\
519       builtin_assert ("machine=powerpc");	\
520       TARGET_OS_SYSV_CPP_BUILTINS ();		\
521     }						\
522   while (0)
523 #endif
524 
525 /* Select one of BIG_OPT, LITTLE_OPT or DEFAULT_OPT depending
526    on various -mbig, -mlittle and -mcall- options.  */
527 #define ENDIAN_SELECT(BIG_OPT, LITTLE_OPT, DEFAULT_OPT)	\
528 "%{mlittle|mlittle-endian:"	LITTLE_OPT ";"	\
529   "mbig|mbig-endian:"		BIG_OPT    ";"	\
530   "mcall-i960-old:"		LITTLE_OPT ";"	\
531   ":"				DEFAULT_OPT "}"
532 
533 #define DEFAULT_ASM_ENDIAN " -mbig"
534 
535 #undef	ASM_SPEC
536 #define	ASM_SPEC "%(asm_cpu) \
537 %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \
538 %{mrelocatable} %{mrelocatable-lib} %{" FPIE_OR_FPIC_SPEC ":-K PIC} \
539 %{memb|msdata=eabi: -memb}" \
540 ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
541 
542 #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
543 #define CC1_SECURE_PLT_DEFAULT_SPEC ""
544 #endif
545 #ifndef LINK_SECURE_PLT_DEFAULT_SPEC
546 #define LINK_SECURE_PLT_DEFAULT_SPEC ""
547 #endif
548 
549 /* Pass -G xxx to the compiler.  */
550 #undef CC1_SPEC
551 #define	CC1_SPEC "%{G*} %(cc1_cpu)" \
552 "%{meabi: %{!mcall-*: -mcall-sysv }} \
553 %{!meabi: %{!mno-eabi: \
554     %{mrelocatable: -meabi } \
555     %{mcall-freebsd: -mno-eabi } \
556     %{mcall-i960-old: -meabi } \
557     %{mcall-linux: -mno-eabi } \
558     %{mcall-netbsd: -mno-eabi } \
559     %{mcall-openbsd: -mno-eabi }}} \
560 %{msdata: -msdata=default} \
561 %{mno-sdata: -msdata=none} \
562 %{!mbss-plt: %{!msecure-plt: %(cc1_secure_plt_default)}} \
563 %{profile: -p}"
564 
565 /* Default starting address if specified.  */
566 #define LINK_START_SPEC "\
567 %{mads         : %(link_start_ads)         ; \
568   myellowknife : %(link_start_yellowknife) ; \
569   mmvme        : %(link_start_mvme)        ; \
570   msim         : %(link_start_sim)         ; \
571   mcall-freebsd: %(link_start_freebsd)     ; \
572   mcall-linux  : %(link_start_linux)       ; \
573   mcall-netbsd : %(link_start_netbsd)      ; \
574   mcall-openbsd: %(link_start_openbsd)     ; \
575                : %(link_start_default)     }"
576 
577 #define LINK_START_DEFAULT_SPEC ""
578 #define LINK_SECURE_PLT_SPEC LINK_SECURE_PLT_DEFAULT_SPEC
579 
580 #undef	LINK_SPEC
581 #define	LINK_SPEC "\
582 %{h*} %{v:-V} %{!msdata=none:%{G*}} %{msdata=none:-G0} \
583 %{R*} \
584 %(link_shlib) \
585 %{!T*: %(link_start) } \
586 %{!static: %{!mbss-plt: %(link_secure_plt)}} \
587 %(link_os)"
588 
589 /* Shared libraries are not default.  */
590 #define LINK_SHLIB_SPEC "\
591 %{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} \
592 %{static: } \
593 %{shared:-G -dy -z text } \
594 %{symbolic:-Bsymbolic -G -dy -z text }"
595 
596 /* Any specific OS flags.  */
597 #define LINK_OS_SPEC "\
598 %{mads         : %(link_os_ads)         ; \
599   myellowknife : %(link_os_yellowknife) ; \
600   mmvme        : %(link_os_mvme)        ; \
601   msim         : %(link_os_sim)         ; \
602   mcall-freebsd: %(link_os_freebsd)     ; \
603   mcall-linux  : %(link_os_linux)       ; \
604   mcall-netbsd : %(link_os_netbsd)      ; \
605   mcall-openbsd: %(link_os_openbsd)     ; \
606                : %(link_os_default)     }"
607 
608 #define LINK_OS_DEFAULT_SPEC ""
609 
610 #define DRIVER_SELF_SPECS "%{mfpu=none: %<mfpu=* \
611  	%<msingle-float %<mdouble-float}"
612 
613 /* Override rs6000.h definition.  */
614 #undef	CPP_SPEC
615 #define	CPP_SPEC "%{posix: -D_POSIX_SOURCE} \
616 %{mads         : %(cpp_os_ads)         ; \
617   myellowknife : %(cpp_os_yellowknife) ; \
618   mmvme        : %(cpp_os_mvme)        ; \
619   msim         : %(cpp_os_sim)         ; \
620   mcall-freebsd: %(cpp_os_freebsd)     ; \
621   mcall-linux  : %(cpp_os_linux)       ; \
622   mcall-netbsd : %(cpp_os_netbsd)      ; \
623   mcall-openbsd: %(cpp_os_openbsd)     ; \
624                : %(cpp_os_default)     }"
625 
626 #define	CPP_OS_DEFAULT_SPEC ""
627 
628 #undef	STARTFILE_SPEC
629 #define	STARTFILE_SPEC "\
630 %{mads         : %(startfile_ads)         ; \
631   myellowknife : %(startfile_yellowknife) ; \
632   mmvme        : %(startfile_mvme)        ; \
633   msim         : %(startfile_sim)         ; \
634   mcall-freebsd: %(startfile_freebsd)     ; \
635   mcall-linux  : %(startfile_linux)       ; \
636   mcall-netbsd : %(startfile_netbsd)      ; \
637   mcall-openbsd: %(startfile_openbsd)     ; \
638                : %(startfile_default)     }"
639 
640 #define	STARTFILE_DEFAULT_SPEC "ecrti.o%s crtbegin.o%s"
641 
642 #undef	LIB_SPEC
643 #define	LIB_SPEC "\
644 %{mads         : %(lib_ads)         ; \
645   myellowknife : %(lib_yellowknife) ; \
646   mmvme        : %(lib_mvme)        ; \
647   msim         : %(lib_sim)         ; \
648   mcall-freebsd: %(lib_freebsd)     ; \
649   mcall-linux  : %(lib_linux)       ; \
650   mcall-netbsd : %(lib_netbsd)      ; \
651   mcall-openbsd: %(lib_openbsd)     ; \
652                : %(lib_default)     }"
653 
654 #define LIB_DEFAULT_SPEC "-lc"
655 
656 #undef	ENDFILE_SPEC
657 #define	ENDFILE_SPEC "\
658 %{mads         : %(endfile_ads)         ; \
659   myellowknife : %(endfile_yellowknife) ; \
660   mmvme        : %(endfile_mvme)        ; \
661   msim         : %(endfile_sim)         ; \
662   mcall-freebsd: %(endfile_freebsd)     ; \
663   mcall-linux  : %(endfile_linux)       ; \
664   mcall-netbsd : %(endfile_netbsd)      ; \
665   mcall-openbsd: %(endfile_openbsd)     ; \
666                : %(crtsavres_default) %(endfile_default)     }"
667 
668 #define CRTSAVRES_DEFAULT_SPEC ""
669 
670 #define	ENDFILE_DEFAULT_SPEC "crtend.o%s ecrtn.o%s"
671 
672 /* Motorola ADS support.  */
673 #define LIB_ADS_SPEC "--start-group -lads -lc --end-group"
674 
675 #define	STARTFILE_ADS_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
676 
677 #define	ENDFILE_ADS_SPEC "crtend.o%s ecrtn.o%s"
678 
679 #define LINK_START_ADS_SPEC "-T ads.ld%s"
680 
681 #define LINK_OS_ADS_SPEC ""
682 
683 #define CPP_OS_ADS_SPEC ""
684 
685 /* Motorola Yellowknife support.  */
686 #define LIB_YELLOWKNIFE_SPEC "--start-group -lyk -lc --end-group"
687 
688 #define	STARTFILE_YELLOWKNIFE_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
689 
690 #define	ENDFILE_YELLOWKNIFE_SPEC "crtend.o%s ecrtn.o%s"
691 
692 #define LINK_START_YELLOWKNIFE_SPEC "-T yellowknife.ld%s"
693 
694 #define LINK_OS_YELLOWKNIFE_SPEC ""
695 
696 #define CPP_OS_YELLOWKNIFE_SPEC ""
697 
698 /* Motorola MVME support.  */
699 #define LIB_MVME_SPEC "--start-group -lmvme -lc --end-group"
700 
701 #define	STARTFILE_MVME_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
702 
703 #define	ENDFILE_MVME_SPEC "crtend.o%s ecrtn.o%s"
704 
705 #define LINK_START_MVME_SPEC "-Ttext 0x40000"
706 
707 #define LINK_OS_MVME_SPEC ""
708 
709 #define CPP_OS_MVME_SPEC ""
710 
711 /* PowerPC simulator based on netbsd system calls support.  */
712 #define LIB_SIM_SPEC "--start-group -lsim -lc --end-group"
713 
714 #define	STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s crtbegin.o%s"
715 
716 #define	ENDFILE_SIM_SPEC "crtend.o%s ecrtn.o%s"
717 
718 #define LINK_START_SIM_SPEC ""
719 
720 #define LINK_OS_SIM_SPEC "-m elf32ppcsim"
721 
722 #define CPP_OS_SIM_SPEC ""
723 
724 /* FreeBSD support.  */
725 
726 #define CPP_OS_FREEBSD_SPEC	"\
727   -D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ \
728   -Acpu=powerpc -Amachine=powerpc"
729 
730 #define	STARTFILE_FREEBSD_SPEC	FBSD_STARTFILE_SPEC
731 #define ENDFILE_FREEBSD_SPEC	FBSD_ENDFILE_SPEC
732 #define LIB_FREEBSD_SPEC	FBSD_LIB_SPEC
733 #define LINK_START_FREEBSD_SPEC	""
734 
735 #define LINK_OS_FREEBSD_SPEC "\
736   %{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \
737   %{v:-V} \
738   %{assert*} %{R*} %{rpath*} %{defsym*} \
739   %{shared:-Bshareable %{h*} %{soname*}} \
740   %{!shared: \
741     %{!static: \
742       %{rdynamic: -export-dynamic} \
743       -dynamic-linker %(fbsd_dynamic_linker) } \
744     %{static:-Bstatic}} \
745   %{symbolic:-Bsymbolic}"
746 
747 /* GNU/Linux support.  */
748 #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
749 %{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \
750 %{!shared: %{profile:-lc_p} %{!profile:-lc}}}"
751 
752 #if ENABLE_OFFLOADING == 1
753 #define CRTOFFLOADBEGIN "%{fopenacc|fopenmp:crtoffloadbegin%O%s}"
754 #define CRTOFFLOADEND "%{fopenacc|fopenmp:crtoffloadend%O%s}"
755 #else
756 #define CRTOFFLOADBEGIN ""
757 #define CRTOFFLOADEND ""
758 #endif
759 
760 #ifdef HAVE_LD_PIE
761 #define	STARTFILE_LINUX_SPEC "\
762 %{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
763 %{mnewlib:ecrti.o%s;:crti.o%s} \
764 %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s} \
765 " CRTOFFLOADBEGIN
766 #else
767 #define	STARTFILE_LINUX_SPEC "\
768 %{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
769 %{mnewlib:ecrti.o%s;:crti.o%s} \
770 %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s} \
771 " CRTOFFLOADBEGIN
772 #endif
773 
774 #define	ENDFILE_LINUX_SPEC "\
775 %{shared|pie:crtendS.o%s;:crtend.o%s} \
776 %{mnewlib:ecrtn.o%s;:crtn.o%s} \
777 " CRTOFFLOADEND
778 
779 #define LINK_START_LINUX_SPEC ""
780 
781 #define MUSL_DYNAMIC_LINKER_E ENDIAN_SELECT("","le","")
782 
783 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
784 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
785 #define MUSL_DYNAMIC_LINKER \
786   "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
787 #if DEFAULT_LIBC == LIBC_UCLIBC
788 #define CHOOSE_DYNAMIC_LINKER(G, U, M) \
789   "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
790 #elif DEFAULT_LIBC == LIBC_MUSL
791 #define CHOOSE_DYNAMIC_LINKER(G, U, M) \
792   "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
793 #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
794 #define CHOOSE_DYNAMIC_LINKER(G, U, M) \
795   "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
796 #else
797 #error "Unsupported DEFAULT_LIBC"
798 #endif
799 #define GNU_USER_DYNAMIC_LINKER \
800   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
801 			 MUSL_DYNAMIC_LINKER)
802 
803 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
804   %{rdynamic:-export-dynamic} \
805   -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
806 
807 #if defined(HAVE_LD_EH_FRAME_HDR)
808 # define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
809 #endif
810 
811 #define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
812 %{!undef:							  \
813   %{!ansi:							  \
814     %{!std=*:-Dunix -D__unix -Dlinux -D__linux}			  \
815     %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}}		  \
816 -Asystem=linux -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
817 
818 /* NetBSD support.  */
819 #define LIB_NETBSD_SPEC "\
820 -lc"
821 
822 #define	STARTFILE_NETBSD_SPEC "\
823 ncrti.o%s crt0.o%s \
824 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
825 
826 #define ENDFILE_NETBSD_SPEC "\
827 %{!shared:crtend.o%s} %{shared:crtendS.o%s} \
828 ncrtn.o%s"
829 
830 #define LINK_START_NETBSD_SPEC "\
831 "
832 
833 #define LINK_OS_NETBSD_SPEC "\
834 %{!shared: %{!static: \
835   %{rdynamic:-export-dynamic} \
836   -dynamic-linker /usr/libexec/ld.elf_so}}"
837 
838 #define CPP_OS_NETBSD_SPEC "\
839 -D__powerpc__ -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__"
840 
841 /* OpenBSD support.  */
842 #ifndef	LIB_OPENBSD_SPEC
843 #define LIB_OPENBSD_SPEC "%{!shared:%{pthread:-lpthread%{p:_p}%{!p:%{pg:_p}}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}"
844 #endif
845 
846 #ifndef	STARTFILE_OPENBSD_SPEC
847 #define	STARTFILE_OPENBSD_SPEC "\
848 %{!shared: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \
849 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
850 #endif
851 
852 #ifndef	ENDFILE_OPENBSD_SPEC
853 #define	ENDFILE_OPENBSD_SPEC "\
854 %{!shared:crtend.o%s} %{shared:crtendS.o%s}"
855 #endif
856 
857 #ifndef LINK_START_OPENBSD_SPEC
858 #define LINK_START_OPENBSD_SPEC "-Ttext 0x400074"
859 #endif
860 
861 #ifndef LINK_OS_OPENBSD_SPEC
862 #define LINK_OS_OPENBSD_SPEC ""
863 #endif
864 
865 #ifndef CPP_OS_OPENBSD_SPEC
866 #define CPP_OS_OPENBSD_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
867 #endif
868 
869 /* Define any extra SPECS that the compiler needs to generate.  */
870 /* Override rs6000.h definition.  */
871 #undef	SUBTARGET_EXTRA_SPECS
872 #define	SUBTARGET_EXTRA_SPECS						\
873   { "crtsavres_default",	CRTSAVRES_DEFAULT_SPEC },		\
874   { "lib_ads",			LIB_ADS_SPEC },				\
875   { "lib_yellowknife",		LIB_YELLOWKNIFE_SPEC },			\
876   { "lib_mvme",			LIB_MVME_SPEC },			\
877   { "lib_sim",			LIB_SIM_SPEC },				\
878   { "lib_freebsd",		LIB_FREEBSD_SPEC },			\
879   { "lib_linux",		LIB_LINUX_SPEC },			\
880   { "lib_netbsd",		LIB_NETBSD_SPEC },			\
881   { "lib_openbsd",		LIB_OPENBSD_SPEC },			\
882   { "lib_default",		LIB_DEFAULT_SPEC },			\
883   { "startfile_ads",		STARTFILE_ADS_SPEC },			\
884   { "startfile_yellowknife",	STARTFILE_YELLOWKNIFE_SPEC },		\
885   { "startfile_mvme",		STARTFILE_MVME_SPEC },			\
886   { "startfile_sim",		STARTFILE_SIM_SPEC },			\
887   { "startfile_freebsd",	STARTFILE_FREEBSD_SPEC },		\
888   { "startfile_linux",		STARTFILE_LINUX_SPEC },			\
889   { "startfile_netbsd",		STARTFILE_NETBSD_SPEC },		\
890   { "startfile_openbsd",	STARTFILE_OPENBSD_SPEC },		\
891   { "startfile_default",	STARTFILE_DEFAULT_SPEC },		\
892   { "endfile_ads",		ENDFILE_ADS_SPEC },			\
893   { "endfile_yellowknife",	ENDFILE_YELLOWKNIFE_SPEC },		\
894   { "endfile_mvme",		ENDFILE_MVME_SPEC },			\
895   { "endfile_sim",		ENDFILE_SIM_SPEC },			\
896   { "endfile_freebsd",		ENDFILE_FREEBSD_SPEC },			\
897   { "endfile_linux",		ENDFILE_LINUX_SPEC },			\
898   { "endfile_netbsd",		ENDFILE_NETBSD_SPEC },			\
899   { "endfile_openbsd",		ENDFILE_OPENBSD_SPEC },			\
900   { "endfile_default",		ENDFILE_DEFAULT_SPEC },			\
901   { "link_shlib",		LINK_SHLIB_SPEC },			\
902   { "link_start",		LINK_START_SPEC },			\
903   { "link_start_ads",		LINK_START_ADS_SPEC },			\
904   { "link_start_yellowknife",	LINK_START_YELLOWKNIFE_SPEC },		\
905   { "link_start_mvme",		LINK_START_MVME_SPEC },			\
906   { "link_start_sim",		LINK_START_SIM_SPEC },			\
907   { "link_start_freebsd",	LINK_START_FREEBSD_SPEC },		\
908   { "link_start_linux",		LINK_START_LINUX_SPEC },		\
909   { "link_start_netbsd",	LINK_START_NETBSD_SPEC },		\
910   { "link_start_openbsd",	LINK_START_OPENBSD_SPEC },		\
911   { "link_start_default",	LINK_START_DEFAULT_SPEC },		\
912   { "link_os",			LINK_OS_SPEC },				\
913   { "link_os_ads",		LINK_OS_ADS_SPEC },			\
914   { "link_os_yellowknife",	LINK_OS_YELLOWKNIFE_SPEC },		\
915   { "link_os_mvme",		LINK_OS_MVME_SPEC },			\
916   { "link_os_sim",		LINK_OS_SIM_SPEC },			\
917   { "link_os_freebsd",		LINK_OS_FREEBSD_SPEC },			\
918   { "link_os_linux",		LINK_OS_LINUX_SPEC },			\
919   { "link_os_netbsd",		LINK_OS_NETBSD_SPEC },			\
920   { "link_os_openbsd",		LINK_OS_OPENBSD_SPEC },			\
921   { "link_os_default",		LINK_OS_DEFAULT_SPEC },			\
922   { "cc1_secure_plt_default",	CC1_SECURE_PLT_DEFAULT_SPEC },		\
923   { "link_secure_plt",		LINK_SECURE_PLT_SPEC },			\
924   { "cpp_os_ads",		CPP_OS_ADS_SPEC },			\
925   { "cpp_os_yellowknife",	CPP_OS_YELLOWKNIFE_SPEC },		\
926   { "cpp_os_mvme",		CPP_OS_MVME_SPEC },			\
927   { "cpp_os_sim",		CPP_OS_SIM_SPEC },			\
928   { "cpp_os_freebsd",		CPP_OS_FREEBSD_SPEC },			\
929   { "cpp_os_linux",		CPP_OS_LINUX_SPEC },			\
930   { "cpp_os_netbsd",		CPP_OS_NETBSD_SPEC },			\
931   { "cpp_os_openbsd",		CPP_OS_OPENBSD_SPEC },			\
932   { "cpp_os_default",		CPP_OS_DEFAULT_SPEC },			\
933   { "fbsd_dynamic_linker",	FBSD_DYNAMIC_LINKER },			\
934   SUBSUBTARGET_EXTRA_SPECS
935 
936 #define	SUBSUBTARGET_EXTRA_SPECS
937 
938 /* Define this macro as a C expression for the initializer of an
939    array of string to tell the driver program which options are
940    defaults for this target and thus do not need to be handled
941    specially when using `MULTILIB_OPTIONS'.
942 
943    Do not define this macro if `MULTILIB_OPTIONS' is not defined in
944    the target makefile fragment or if none of the options listed in
945    `MULTILIB_OPTIONS' are set by default.  *Note Target Fragment::.  */
946 
947 #define	MULTILIB_DEFAULTS { "mbig", "mcall-sysv" }
948 
949 /* Define this macro if the code for function profiling should come
950    before the function prologue.  Normally, the profiling code comes
951    after.  */
952 #define PROFILE_BEFORE_PROLOGUE 1
953 
954 /* Function name to call to do profiling.  */
955 #define RS6000_MCOUNT "_mcount"
956 
957 /* Select a format to encode pointers in exception handling data.  CODE
958    is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
959    true if the symbol may be affected by dynamic relocations.  */
960 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL)			\
961   (flag_pic								\
962    ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel		\
963       | DW_EH_PE_sdata4)						\
964    : DW_EH_PE_absptr)
965 
966 #define DOUBLE_INT_ASM_OP "\t.quad\t"
967 
968 /* Generate entries in .fixup for relocatable addresses.  */
969 #define RELOCATABLE_NEEDS_FIXUP 1
970 
971 #define TARGET_ASM_FILE_END rs6000_elf_file_end
972 
973 #undef TARGET_ASAN_SHADOW_OFFSET
974 #define TARGET_ASAN_SHADOW_OFFSET rs6000_asan_shadow_offset
975 
976 /* This target uses the sysv4.opt file.  */
977 #define TARGET_USES_SYSV4_OPT 1
978 
979 /* Include order changes for musl, same as in generic linux.h.  */
980 #if DEFAULT_LIBC == LIBC_MUSL
981 #define INCLUDE_DEFAULTS_MUSL_GPP			\
982     { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1,		\
983       GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },		\
984     { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1,		\
985       GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 },		\
986     { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1,	\
987       GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
988 
989 #ifdef LOCAL_INCLUDE_DIR
990 #define INCLUDE_DEFAULTS_MUSL_LOCAL			\
991     { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },		\
992     { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
993 #else
994 #define INCLUDE_DEFAULTS_MUSL_LOCAL
995 #endif
996 
997 #ifdef PREFIX_INCLUDE_DIR
998 #define INCLUDE_DEFAULTS_MUSL_PREFIX			\
999     { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
1000 #else
1001 #define INCLUDE_DEFAULTS_MUSL_PREFIX
1002 #endif
1003 
1004 #ifdef CROSS_INCLUDE_DIR
1005 #define INCLUDE_DEFAULTS_MUSL_CROSS			\
1006     { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
1007 #else
1008 #define INCLUDE_DEFAULTS_MUSL_CROSS
1009 #endif
1010 
1011 #ifdef TOOL_INCLUDE_DIR
1012 #define INCLUDE_DEFAULTS_MUSL_TOOL			\
1013     { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
1014 #else
1015 #define INCLUDE_DEFAULTS_MUSL_TOOL
1016 #endif
1017 
1018 #ifdef NATIVE_SYSTEM_HEADER_DIR
1019 #define INCLUDE_DEFAULTS_MUSL_NATIVE			\
1020     { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 },	\
1021     { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
1022 #else
1023 #define INCLUDE_DEFAULTS_MUSL_NATIVE
1024 #endif
1025 
1026 #if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
1027 # undef INCLUDE_DEFAULTS_MUSL_LOCAL
1028 # define INCLUDE_DEFAULTS_MUSL_LOCAL
1029 # undef INCLUDE_DEFAULTS_MUSL_NATIVE
1030 # define INCLUDE_DEFAULTS_MUSL_NATIVE
1031 #else
1032 # undef INCLUDE_DEFAULTS_MUSL_CROSS
1033 # define INCLUDE_DEFAULTS_MUSL_CROSS
1034 #endif
1035 
1036 #undef INCLUDE_DEFAULTS
1037 #define INCLUDE_DEFAULTS				\
1038   {							\
1039     INCLUDE_DEFAULTS_MUSL_GPP				\
1040     INCLUDE_DEFAULTS_MUSL_LOCAL				\
1041     INCLUDE_DEFAULTS_MUSL_PREFIX			\
1042     INCLUDE_DEFAULTS_MUSL_CROSS				\
1043     INCLUDE_DEFAULTS_MUSL_TOOL				\
1044     INCLUDE_DEFAULTS_MUSL_NATIVE			\
1045     { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 },		\
1046     { 0, 0, 0, 0, 0, 0 }				\
1047   }
1048 #endif
1049