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