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