sysv4.h revision 259563
13199Sjkh/* Target definitions for GNU compiler for PowerPC running System V.4
23199Sjkh   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
388028Sjoerg   2004, 2005, 2006, 2007 Free Software Foundation, Inc.
43199Sjkh   Contributed by Cygnus Support.
53199Sjkh
63199Sjkh   This file is part of GCC.
73199Sjkh
83199Sjkh   GCC is free software; you can redistribute it and/or modify it
93199Sjkh   under the terms of the GNU General Public License as published
103199Sjkh   by the Free Software Foundation; either version 2, or (at your
113199Sjkh   option) any later version.
123199Sjkh
133199Sjkh   GCC is distributed in the hope that it will be useful, but WITHOUT
143199Sjkh   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1582229Sdd   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
163199Sjkh   License for more details.
173199Sjkh
183199Sjkh   You should have received a copy of the GNU General Public License
193199Sjkh   along with GCC; see the file COPYING.  If not, write to the
203199Sjkh   Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
213199Sjkh   MA 02110-1301, USA.  */
223199Sjkh
233199Sjkh/* Header files should be C++ aware in general.  */
243199Sjkh#undef  NO_IMPLICIT_EXTERN_C
253199Sjkh#define NO_IMPLICIT_EXTERN_C
263199Sjkh
273199Sjkh/* Yes!  We are ELF.  */
2850476Speter#define	TARGET_OBJECT_FORMAT OBJECT_ELF
293199Sjkh
30163798Skeramida/* Default ABI to compile code for.  */
3153200Sphantom#define DEFAULT_ABI rs6000_current_abi
3279538Sru
333199Sjkh/* Default ABI to use.  */
343199Sjkh#define RS6000_ABI_NAME "sysv"
3589225Sru
363199Sjkh/* Override rs6000.h definition.  */
3784877Syokota#undef	ASM_DEFAULT_SPEC
3884877Syokota#define	ASM_DEFAULT_SPEC "-mppc"
3984877Syokota
4084877Syokota/* Small data support types.  */
4184877Syokotaenum rs6000_sdata_type {
4284877Syokota  SDATA_NONE,			/* No small data support.  */
4384877Syokota  SDATA_DATA,			/* Just put data in .sbss/.sdata, don't use relocs.  */
4484877Syokota  SDATA_SYSV,			/* Use r13 to point to .sdata/.sbss.  */
4588028Sjoerg  SDATA_EABI			/* Use r13 like above, r2 points to .sdata2/.sbss2.  */
4684877Syokota};
4784877Syokota
4888028Sjoergextern enum rs6000_sdata_type rs6000_sdata;
4984877Syokota
5084877Syokota#define	TARGET_TOC		((target_flags & MASK_64BIT)		\
5188028Sjoerg				 || ((target_flags & (MASK_RELOCATABLE	\
523199Sjkh						      | MASK_MINIMAL_TOC)) \
5388028Sjoerg				     && flag_pic > 1)			\
5489225Sru				 || DEFAULT_ABI == ABI_AIX)
5589225Sru
5688028Sjoerg#define	TARGET_BITFIELD_TYPE	(! TARGET_NO_BITFIELD_TYPE)
5788028Sjoerg#define	TARGET_BIG_ENDIAN	(! TARGET_LITTLE_ENDIAN)
5830575Sjoerg#define	TARGET_NO_PROTOTYPE	(! TARGET_PROTOTYPE)
5989225Sru#define	TARGET_NO_TOC		(! TARGET_TOC)
6089225Sru#define	TARGET_NO_EABI		(! TARGET_EABI)
6188028Sjoerg
62132219Snjl#ifdef HAVE_AS_REL16
63132219Snjl#undef TARGET_SECURE_PLT
6489225Sru#define TARGET_SECURE_PLT	secure_plt
6588028Sjoerg#endif
6689225Sru
6789225Sruextern const char *rs6000_abi_name;
6888028Sjoergextern const char *rs6000_sdata_name;
6988028Sjoergextern const char *rs6000_tls_size_string; /* For -mtls-size= */
7088028Sjoerg
7188028Sjoerg#define SDATA_DEFAULT_SIZE 8
7288028Sjoerg
7389225Sru/* Sometimes certain combinations of command options do not make sense
7489225Sru   on a particular target machine.  You can define a macro
7588028Sjoerg   `OVERRIDE_OPTIONS' to take account of this.  This macro, if
7688028Sjoerg   defined, is executed once just after all the command options have
7754939Sjoerg   been parsed.
7888028Sjoerg
7988028Sjoerg   The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
8088028Sjoerg   get control.  */
8188028Sjoerg
8288028Sjoerg#define SUBTARGET_OVERRIDE_OPTIONS					\
8388028Sjoergdo {									\
8488028Sjoerg  if (!g_switch_set)							\
8588028Sjoerg    g_switch_value = SDATA_DEFAULT_SIZE;				\
8688028Sjoerg									\
8788028Sjoerg  if (rs6000_abi_name == NULL)						\
8888028Sjoerg    rs6000_abi_name = RS6000_ABI_NAME;					\
8988028Sjoerg									\
9088028Sjoerg  if (!strcmp (rs6000_abi_name, "sysv"))				\
9189225Sru    rs6000_current_abi = ABI_V4;					\
9289225Sru  else if (!strcmp (rs6000_abi_name, "sysv-noeabi"))			\
9388028Sjoerg    {									\
9489225Sru      rs6000_current_abi = ABI_V4;					\
9589225Sru      target_flags &= ~ MASK_EABI;					\
9688028Sjoerg    }									\
9788028Sjoerg  else if (!strcmp (rs6000_abi_name, "sysv-eabi")			\
9889225Sru	   || !strcmp (rs6000_abi_name, "eabi"))			\
9989225Sru    {									\
10088028Sjoerg      rs6000_current_abi = ABI_V4;					\
10189225Sru      target_flags |= MASK_EABI;					\
10289225Sru    }									\
10388028Sjoerg  else if (!strcmp (rs6000_abi_name, "aixdesc"))			\
10488028Sjoerg    rs6000_current_abi = ABI_AIX;					\
10588028Sjoerg  else if (!strcmp (rs6000_abi_name, "freebsd"))			\
10688028Sjoerg    rs6000_current_abi = ABI_V4;					\
10788028Sjoerg  else if (!strcmp (rs6000_abi_name, "linux"))				\
10888028Sjoerg    {									\
10988028Sjoerg      if (TARGET_64BIT)							\
11088028Sjoerg	rs6000_current_abi = ABI_AIX;					\
11188028Sjoerg      else								\
11288028Sjoerg	rs6000_current_abi = ABI_V4;					\
11388028Sjoerg    }									\
11488028Sjoerg  else if (!strcmp (rs6000_abi_name, "gnu"))				\
11588028Sjoerg    rs6000_current_abi = ABI_V4;					\
11688028Sjoerg  else if (!strcmp (rs6000_abi_name, "netbsd"))				\
11789225Sru    rs6000_current_abi = ABI_V4;					\
11889225Sru  else if (!strcmp (rs6000_abi_name, "openbsd"))			\
11988028Sjoerg    rs6000_current_abi = ABI_V4;					\
12089225Sru  else if (!strcmp (rs6000_abi_name, "i960-old"))			\
12189225Sru    {									\
12288028Sjoerg      rs6000_current_abi = ABI_V4;					\
12389225Sru      target_flags |= (MASK_LITTLE_ENDIAN | MASK_EABI			\
12489225Sru		       | MASK_NO_BITFIELD_WORD);			\
12588028Sjoerg      target_flags &= ~MASK_STRICT_ALIGN;				\
12688028Sjoerg    }									\
12789225Sru  else									\
12889225Sru    {									\
12988028Sjoerg      rs6000_current_abi = ABI_V4;					\
13088028Sjoerg      error ("bad value for -mcall-%s", rs6000_abi_name);		\
13188028Sjoerg    }									\
13288028Sjoerg									\
13389225Sru  if (rs6000_sdata_name)						\
13489225Sru    {									\
13589225Sru      if (!strcmp (rs6000_sdata_name, "none"))				\
13688028Sjoerg	rs6000_sdata = SDATA_NONE;					\
13788028Sjoerg      else if (!strcmp (rs6000_sdata_name, "data"))			\
13888028Sjoerg	rs6000_sdata = SDATA_DATA;					\
13988028Sjoerg      else if (!strcmp (rs6000_sdata_name, "default"))			\
14088028Sjoerg	rs6000_sdata = (TARGET_EABI) ? SDATA_EABI : SDATA_SYSV;		\
14188028Sjoerg      else if (!strcmp (rs6000_sdata_name, "sysv"))			\
14288028Sjoerg	rs6000_sdata = SDATA_SYSV;					\
14388028Sjoerg      else if (!strcmp (rs6000_sdata_name, "eabi"))			\
14488028Sjoerg	rs6000_sdata = SDATA_EABI;					\
14588028Sjoerg      else								\
14688028Sjoerg	error ("bad value for -msdata=%s", rs6000_sdata_name);		\
14788028Sjoerg    }									\
14888028Sjoerg  else if (DEFAULT_ABI == ABI_V4)					\
14988028Sjoerg    {									\
15088028Sjoerg      rs6000_sdata = SDATA_DATA;					\
15188028Sjoerg      rs6000_sdata_name = "data";					\
15288028Sjoerg    }									\
15388028Sjoerg  else									\
15488028Sjoerg    {									\
15588028Sjoerg      rs6000_sdata = SDATA_NONE;					\
156132219Snjl      rs6000_sdata_name = "none";					\
15789225Sru    }									\
15888028Sjoerg									\
159132219Snjl  if (TARGET_RELOCATABLE &&						\
160165216Smpp      (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV))	\
16188028Sjoerg    {									\
16288028Sjoerg      rs6000_sdata = SDATA_DATA;					\
16389225Sru      error ("-mrelocatable and -msdata=%s are incompatible",		\
16489225Sru	     rs6000_sdata_name);					\
16589225Sru    }									\
16689225Sru									\
167132219Snjl  else if (flag_pic && DEFAULT_ABI != ABI_AIX				\
16889225Sru	   && (rs6000_sdata == SDATA_EABI				\
16988028Sjoerg	       || rs6000_sdata == SDATA_SYSV))				\
17088028Sjoerg    {									\
17189225Sru      rs6000_sdata = SDATA_DATA;					\
17289225Sru      error ("-f%s and -msdata=%s are incompatible",			\
17388028Sjoerg	     (flag_pic > 1) ? "PIC" : "pic",				\
17488028Sjoerg	     rs6000_sdata_name);					\
17588028Sjoerg    }									\
17688028Sjoerg									\
17788028Sjoerg  if ((rs6000_sdata != SDATA_NONE && DEFAULT_ABI != ABI_V4)		\
17888028Sjoerg      || (rs6000_sdata == SDATA_EABI && !TARGET_EABI))			\
17988028Sjoerg    {									\
18088028Sjoerg      rs6000_sdata = SDATA_NONE;					\
18188028Sjoerg      error ("-msdata=%s and -mcall-%s are incompatible",		\
18288028Sjoerg	     rs6000_sdata_name, rs6000_abi_name);			\
183119893Sru    }									\
18489225Sru									\
18589225Sru  targetm.have_srodata_section = rs6000_sdata == SDATA_EABI;		\
18688028Sjoerg									\
18789225Sru  if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC)			\
18889225Sru    {									\
18988028Sjoerg      target_flags |= MASK_MINIMAL_TOC;					\
19089225Sru      error ("-mrelocatable and -mno-minimal-toc are incompatible");	\
19188028Sjoerg    }									\
19288028Sjoerg									\
19389225Sru  if (TARGET_RELOCATABLE && rs6000_current_abi == ABI_AIX)		\
19488028Sjoerg    {									\
19588028Sjoerg      target_flags &= ~MASK_RELOCATABLE;				\
19688028Sjoerg      error ("-mrelocatable and -mcall-%s are incompatible",		\
19788028Sjoerg	     rs6000_abi_name);						\
19889610Smpp    }									\
19989225Sru									\
20088028Sjoerg  if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi == ABI_AIX)	\
20189225Sru    {									\
20289225Sru      flag_pic = 0;							\
20388028Sjoerg      error ("-fPIC and -mcall-%s are incompatible",			\
20488028Sjoerg	     rs6000_abi_name);						\
20589225Sru    }									\
20689225Sru									\
20788028Sjoerg  if (rs6000_current_abi == ABI_AIX && TARGET_LITTLE_ENDIAN)		\
20888028Sjoerg    {									\
20988028Sjoerg      target_flags &= ~MASK_LITTLE_ENDIAN;				\
21089225Sru      error ("-mcall-aixdesc must be big endian");			\
21189225Sru    }									\
21288028Sjoerg									\
21389225Sru  if (TARGET_SECURE_PLT != secure_plt)					\
21489225Sru    {									\
21589225Sru      error ("-msecure-plt not supported by your assembler");		\
21688028Sjoerg    }									\
21789225Sru									\
21888028Sjoerg  /* Treat -fPIC the same as -mrelocatable.  */				\
21988028Sjoerg  if (flag_pic > 1 && DEFAULT_ABI != ABI_AIX)				\
22088028Sjoerg    {									\
22188028Sjoerg      target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC;		\
22289225Sru      TARGET_NO_FP_IN_TOC = 1;						\
22389225Sru    }									\
22489225Sru									\
22589225Sru  else if (TARGET_RELOCATABLE)						\
22689225Sru    flag_pic = 2;							\
22788028Sjoerg} while (0)
22888028Sjoerg
22989225Sru#ifndef RS6000_BI_ARCH
23088028Sjoerg# define SUBSUBTARGET_OVERRIDE_OPTIONS					\
23188028Sjoergdo {									\
23289225Sru  if ((TARGET_DEFAULT ^ target_flags) & MASK_64BIT)			\
23389225Sru    error ("-m%s not supported in this configuration",			\
23489225Sru	   (target_flags & MASK_64BIT) ? "64" : "32");			\
23589225Sru} while (0)
23688028Sjoerg#endif
23789225Sru
23888028Sjoerg/* Override rs6000.h definition.  */
23989225Sru#undef	TARGET_DEFAULT
24089225Sru#define	TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS)
24188028Sjoerg
24288028Sjoerg/* Override rs6000.h definition.  */
24389225Sru#undef	PROCESSOR_DEFAULT
24489225Sru#define	PROCESSOR_DEFAULT PROCESSOR_PPC750
24588028Sjoerg
24689225Sru/* SVR4 only defined for PowerPC, so short-circuit POWER patterns.  */
24788028Sjoerg#undef  TARGET_POWER
24889225Sru#define TARGET_POWER 0
24989225Sru
25089225Sru#define FIXED_R2 1
25189225Sru/* System V.4 uses register 13 as a pointer to the small data area,
25289225Sru   so it is not available to the normal user.  */
25388028Sjoerg#define FIXED_R13 1
25489225Sru
25589225Sru/* Override default big endianism definitions in rs6000.h.  */
25688028Sjoerg#undef	BYTES_BIG_ENDIAN
25789225Sru#undef	WORDS_BIG_ENDIAN
25888028Sjoerg#define	BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
25989225Sru#define	WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
26089225Sru
26189225Sru/* Define this to set the endianness to use in libgcc2.c, which can
26289225Sru   not depend on target_flags.  */
26388028Sjoerg#if !defined(__LITTLE_ENDIAN__) && !defined(__sun__)
26488028Sjoerg#define LIBGCC2_WORDS_BIG_ENDIAN 1
26588028Sjoerg#else
26689225Sru#define LIBGCC2_WORDS_BIG_ENDIAN 0
26789225Sru#endif
26889225Sru
26989225Sru/* Define cutoff for using external functions to save floating point.
27089225Sru   Currently on V.4, always use inline stores.  */
27189610Smpp#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64)
27289225Sru
27389225Sru/* Put jump tables in read-only memory, rather than in .text.  */
27489225Sru#define JUMP_TABLES_IN_TEXT_SECTION 0
27589225Sru
27688028Sjoerg/* Prefix and suffix to use to saving floating point.  */
27788028Sjoerg#define	SAVE_FP_PREFIX "_savefpr_"
27889225Sru#define SAVE_FP_SUFFIX "_l"
27989225Sru
28089225Sru/* Prefix and suffix to use to restoring floating point.  */
28188028Sjoerg#define	RESTORE_FP_PREFIX "_restfpr_"
28289225Sru#define RESTORE_FP_SUFFIX "_l"
28388028Sjoerg
28489225Sru/* Type used for ptrdiff_t, as a string used in a declaration.  */
28589225Sru#define PTRDIFF_TYPE "int"
28689225Sru
28789225Sru/* Type used for wchar_t, as a string used in a declaration.  */
28889225Sru/* Override svr4.h definition.  */
28989225Sru#undef	WCHAR_TYPE
29088028Sjoerg#define WCHAR_TYPE "long int"
29189225Sru
29289225Sru/* Width of wchar_t in bits.  */
29389225Sru/* Override svr4.h definition.  */
29489225Sru#undef	WCHAR_TYPE_SIZE
29589225Sru#define WCHAR_TYPE_SIZE 32
29689225Sru
29789225Sru/* Make int foo : 8 not cause structures to be aligned to an int boundary.  */
29889225Sru/* Override elfos.h definition.  */
29988028Sjoerg#undef	PCC_BITFIELD_TYPE_MATTERS
30089225Sru#define	PCC_BITFIELD_TYPE_MATTERS (TARGET_BITFIELD_TYPE)
30189225Sru
30289225Sru#undef	BITFIELD_NBYTES_LIMITED
30388028Sjoerg#define	BITFIELD_NBYTES_LIMITED (TARGET_NO_BITFIELD_WORD)
30489225Sru
30589225Sru/* Define this macro to be the value 1 if instructions will fail to
30689225Sru   work if given data not on the nominal alignment.  If instructions
30788028Sjoerg   will merely go slower in that case, define this macro as 0.  */
30889225Sru#undef	STRICT_ALIGNMENT
30989225Sru#define	STRICT_ALIGNMENT (TARGET_STRICT_ALIGN)
31089225Sru
31188028Sjoerg/* Define this macro if you wish to preserve a certain alignment for
31289225Sru   the stack pointer, greater than what the hardware enforces.  The
31388028Sjoerg   definition is a C expression for the desired alignment (measured
31488028Sjoerg   in bits).  This macro must evaluate to a value equal to or larger
31589225Sru   than STACK_BOUNDARY.
31688028Sjoerg   For the SYSV ABI and variants the alignment of the stack pointer
31789225Sru   is usually controlled manually in rs6000.c. However, to maintain
31889225Sru   alignment across alloca () in all circumstances,
31989225Sru   PREFERRED_STACK_BOUNDARY needs to be set as well.
32089225Sru   This has the additional advantage of allowing a bigger maximum
32188028Sjoerg   alignment of user objects on the stack.  */
322132219Snjl
32388028Sjoerg#undef PREFERRED_STACK_BOUNDARY
3243199Sjkh#define PREFERRED_STACK_BOUNDARY 128
32589225Sru
32671895Sru/* Real stack boundary as mandated by the appropriate ABI.  */
3273199Sjkh#define ABI_STACK_BOUNDARY \
3283199Sjkh  ((TARGET_EABI && !TARGET_ALTIVEC && !TARGET_ALTIVEC_ABI) ? 64 : 128)
3293199Sjkh
33020920Swosch/* An expression for the alignment of a structure field FIELD if the
33188028Sjoerg   alignment computed in the usual way is COMPUTED.  */
33288028Sjoerg#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED)				      \
33388028Sjoerg	((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE)     \
33488028Sjoerg	 ? 128 : COMPUTED)
33588028Sjoerg
33689225Sru#undef  BIGGEST_FIELD_ALIGNMENT
33789225Sru
33888028Sjoerg/* Use ELF style section commands.  */
33989225Sru
34088028Sjoerg#define	TEXT_SECTION_ASM_OP	"\t.section\t\".text\""
34188028Sjoerg
34288028Sjoerg#define	DATA_SECTION_ASM_OP	"\t.section\t\".data\""
34388028Sjoerg
344#define	BSS_SECTION_ASM_OP	"\t.section\t\".bss\""
345
346/* Override elfos.h definition.  */
347#undef	INIT_SECTION_ASM_OP
348#define	INIT_SECTION_ASM_OP "\t.section\t\".init\",\"ax\""
349
350/* Override elfos.h definition.  */
351#undef	FINI_SECTION_ASM_OP
352#define	FINI_SECTION_ASM_OP "\t.section\t\".fini\",\"ax\""
353
354#define	TOC_SECTION_ASM_OP "\t.section\t\".got\",\"aw\""
355
356/* Put PC relative got entries in .got2.  */
357#define	MINIMAL_TOC_SECTION_ASM_OP \
358  (TARGET_RELOCATABLE || (flag_pic && DEFAULT_ABI != ABI_AIX)		\
359   ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
360
361#define	SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\""
362#define	SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\""
363#define	SBSS_SECTION_ASM_OP "\t.section\t\".sbss\",\"aw\",@nobits"
364
365/* Override default elf definitions.  */
366#define TARGET_ASM_INIT_SECTIONS rs6000_elf_asm_init_sections
367#undef  TARGET_ASM_RELOC_RW_MASK
368#define TARGET_ASM_RELOC_RW_MASK rs6000_elf_reloc_rw_mask
369#undef	TARGET_ASM_SELECT_RTX_SECTION
370#define	TARGET_ASM_SELECT_RTX_SECTION rs6000_elf_select_rtx_section
371
372/* Return nonzero if this entry is to be written into the constant pool
373   in a special way.  We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
374   containing one of them.  If -mfp-in-toc (the default), we also do
375   this for floating-point constants.  We actually can only do this
376   if the FP formats of the target and host machines are the same, but
377   we can't check that since not every file that uses
378   GO_IF_LEGITIMATE_ADDRESS_P includes real.h.
379
380   Unlike AIX, we don't key off of -mminimal-toc, but instead do not
381   allow floating point constants in the TOC if -mrelocatable.  */
382
383#undef	ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
384#define	ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE)			\
385  (TARGET_TOC								\
386   && (GET_CODE (X) == SYMBOL_REF					\
387       || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS	\
388	   && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF)		\
389       || GET_CODE (X) == LABEL_REF					\
390       || (GET_CODE (X) == CONST_INT 					\
391	   && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode))	\
392       || (!TARGET_NO_FP_IN_TOC						\
393	   && !TARGET_RELOCATABLE					\
394	   && GET_CODE (X) == CONST_DOUBLE				\
395	   && SCALAR_FLOAT_MODE_P (GET_MODE (X))			\
396	   && BITS_PER_WORD == HOST_BITS_PER_INT)))
397
398/* These macros generate the special .type and .size directives which
399   are used to set the corresponding fields of the linker symbol table
400   entries in an ELF object file under SVR4.  These macros also output
401   the starting labels for the relevant functions/objects.  */
402
403/* Write the extra assembler code needed to declare a function properly.
404   Some svr4 assemblers need to also have something extra said about the
405   function's return value.  We allow for that here.  */
406
407extern int rs6000_pic_labelno;
408
409/* Override elfos.h definition.  */
410#undef	ASM_DECLARE_FUNCTION_NAME
411#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)			\
412  rs6000_elf_declare_function_name ((FILE), (NAME), (DECL))
413
414/* The USER_LABEL_PREFIX stuff is affected by the -fleading-underscore
415   flag.  The LOCAL_LABEL_PREFIX variable is used by dbxelf.h.  */
416
417#define	LOCAL_LABEL_PREFIX "."
418#define	USER_LABEL_PREFIX ""
419
420/* svr4.h overrides (*targetm.asm_out.internal_label).  */
421
422#define	ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX)	\
423  asm_fprintf (FILE, "%L%s", PREFIX)
424
425/* Globalizing directive for a label.  */
426#define GLOBAL_ASM_OP "\t.globl "
427
428/* This says how to output assembler code to declare an
429   uninitialized internal linkage data object.  Under SVR4,
430   the linker seems to want the alignment of data objects
431   to depend on their types.  We do exactly that here.  */
432
433#define	LOCAL_ASM_OP	"\t.local\t"
434
435#define	LCOMM_ASM_OP	"\t.lcomm\t"
436
437/* Describe how to emit uninitialized local items.  */
438#define	ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN)	\
439do {									\
440  if ((DECL) && rs6000_elf_in_small_data_p (DECL))			\
441    {									\
442      switch_to_section (sbss_section);					\
443      ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT));	\
444      ASM_OUTPUT_LABEL (FILE, NAME);					\
445      ASM_OUTPUT_SKIP (FILE, SIZE);					\
446      if (!flag_inhibit_size_directive && (SIZE) > 0)			\
447	ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE);			\
448    }									\
449  else									\
450    {									\
451      fprintf (FILE, "%s", LCOMM_ASM_OP);				\
452      assemble_name ((FILE), (NAME));					\
453      fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n",		\
454	       (SIZE), (ALIGN) / BITS_PER_UNIT);			\
455    }									\
456  ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object");			\
457} while (0)
458
459/* Describe how to emit uninitialized external linkage items.  */
460#define	ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN)		\
461do {									\
462  ASM_OUTPUT_ALIGNED_DECL_LOCAL (FILE, DECL, NAME, SIZE, ALIGN);	\
463} while (0)
464
465#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
466/* To support -falign-* switches we need to use .p2align so
467   that alignment directives in code sections will be padded
468   with no-op instructions, rather than zeroes.  */
469#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP)			\
470  if ((LOG) != 0)							\
471    {									\
472      if ((MAX_SKIP) == 0)						\
473	fprintf ((FILE), "\t.p2align %d\n", (LOG));			\
474      else								\
475	fprintf ((FILE), "\t.p2align %d,,%d\n",	(LOG), (MAX_SKIP));	\
476    }
477#endif
478
479/* This is how to output code to push a register on the stack.
480   It need not be very fast code.
481
482   On the rs6000, we must keep the backchain up to date.  In order
483   to simplify things, always allocate 16 bytes for a push (System V
484   wants to keep stack aligned to a 16 byte boundary).  */
485
486#define	ASM_OUTPUT_REG_PUSH(FILE, REGNO)				\
487do {									\
488  if (DEFAULT_ABI == ABI_V4)						\
489    asm_fprintf (FILE,							\
490		 "\t{stu|stwu} %s,-16(%s)\n\t{st|stw} %s,12(%s)\n",	\
491		 reg_names[1], reg_names[1], reg_names[REGNO],		\
492		 reg_names[1]);						\
493} while (0)
494
495/* This is how to output an insn to pop a register from the stack.
496   It need not be very fast code.  */
497
498#define	ASM_OUTPUT_REG_POP(FILE, REGNO)					\
499do {									\
500  if (DEFAULT_ABI == ABI_V4)						\
501    asm_fprintf (FILE,							\
502		 "\t{l|lwz} %s,12(%s)\n\t{ai|addic} %s,%s,16\n",	\
503		 reg_names[REGNO], reg_names[1], reg_names[1],		\
504		 reg_names[1]);						\
505} while (0)
506
507/* Switch  Recognition by gcc.c.  Add -G xx support.  */
508
509/* Override svr4.h definition.  */
510#undef	SWITCH_TAKES_ARG
511#define	SWITCH_TAKES_ARG(CHAR)						\
512  ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o'			\
513   || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u'			\
514   || (CHAR) == 'I' || (CHAR) == 'm' || (CHAR) == 'x'			\
515   || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'V'			\
516   || (CHAR) == 'B' || (CHAR) == 'b' || (CHAR) == 'G')
517
518extern int fixuplabelno;
519
520/* Handle constructors specially for -mrelocatable.  */
521#define TARGET_ASM_CONSTRUCTOR  rs6000_elf_asm_out_constructor
522#define TARGET_ASM_DESTRUCTOR   rs6000_elf_asm_out_destructor
523
524/* This is the end of what might become sysv4.h.  */
525
526/* Use DWARF 2 debugging information by default.  */
527#undef  PREFERRED_DEBUGGING_TYPE
528#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
529
530/* Historically we have also supported stabs debugging.  */
531#define DBX_DEBUGGING_INFO 1
532
533#define TARGET_ENCODE_SECTION_INFO  rs6000_elf_encode_section_info
534#define TARGET_IN_SMALL_DATA_P  rs6000_elf_in_small_data_p
535
536/* The ELF version doesn't encode [DS] or whatever at the end of symbols.  */
537
538#define	RS6000_OUTPUT_BASENAME(FILE, NAME)	\
539    assemble_name (FILE, NAME)
540
541/* We have to output the stabs for the function name *first*, before
542   outputting its label.  */
543
544#define	DBX_FUNCTION_FIRST
545
546/* This is the end of what might become sysv4dbx.h.  */
547
548#ifndef	TARGET_VERSION
549#define	TARGET_VERSION fprintf (stderr, " (PowerPC System V.4)");
550#endif
551
552#define TARGET_OS_SYSV_CPP_BUILTINS()		\
553  do						\
554    {						\
555      if (target_flags_explicit			\
556	  & MASK_RELOCATABLE)			\
557	builtin_define ("_RELOCATABLE");	\
558    }						\
559  while (0)
560
561#ifndef	TARGET_OS_CPP_BUILTINS
562#define TARGET_OS_CPP_BUILTINS()		\
563  do						\
564    {						\
565      builtin_define_std ("PPC");		\
566      builtin_define_std ("unix");		\
567      builtin_define ("__svr4__");		\
568      builtin_assert ("system=unix");		\
569      builtin_assert ("system=svr4");		\
570      builtin_assert ("cpu=powerpc");		\
571      builtin_assert ("machine=powerpc");	\
572      TARGET_OS_SYSV_CPP_BUILTINS ();		\
573    }						\
574  while (0)
575#endif
576
577/* Pass various options to the assembler.  */
578/* Override svr4.h definition.  */
579#undef	ASM_SPEC
580#define	ASM_SPEC "%(asm_cpu) \
581%{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \
582%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
583%{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \
584%{memb|msdata|msdata=eabi: -memb} \
585%{mlittle|mlittle-endian:-mlittle; \
586  mbig|mbig-endian      :-mbig;    \
587  mcall-aixdesc |		   \
588  mcall-freebsd |		   \
589  mcall-netbsd  |		   \
590  mcall-openbsd |		   \
591  mcall-linux   |		   \
592  mcall-gnu             :-mbig;    \
593  mcall-i960-old        :-mlittle}"
594
595#define	CC1_ENDIAN_BIG_SPEC ""
596
597#define	CC1_ENDIAN_LITTLE_SPEC "\
598%{!mstrict-align: %{!mno-strict-align: \
599    %{!mcall-i960-old: \
600	-mstrict-align \
601    } \
602}}"
603
604#define	CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_big)"
605
606#ifndef CC1_SECURE_PLT_DEFAULT_SPEC
607#define CC1_SECURE_PLT_DEFAULT_SPEC ""
608#endif
609
610/* Pass -G xxx to the compiler and set correct endian mode.  */
611#define	CC1_SPEC "%{G*} \
612%{mlittle|mlittle-endian: %(cc1_endian_little);           \
613  mbig   |mbig-endian   : %(cc1_endian_big);              \
614  mcall-aixdesc |					  \
615  mcall-freebsd |					  \
616  mcall-netbsd  |					  \
617  mcall-openbsd |					  \
618  mcall-linux   |					  \
619  mcall-gnu             : -mbig %(cc1_endian_big);        \
620  mcall-i960-old        : -mlittle %(cc1_endian_little);  \
621                        : %(cc1_endian_default)}          \
622%{meabi: %{!mcall-*: -mcall-sysv }} \
623%{!meabi: %{!mno-eabi: \
624    %{mrelocatable: -meabi } \
625    %{mcall-freebsd: -mno-eabi } \
626    %{mcall-i960-old: -meabi } \
627    %{mcall-linux: -mno-eabi } \
628    %{mcall-gnu: -mno-eabi } \
629    %{mcall-netbsd: -mno-eabi } \
630    %{mcall-openbsd: -mno-eabi }}} \
631%{msdata: -msdata=default} \
632%{mno-sdata: -msdata=none} \
633%{!mbss-plt: %{!msecure-plt: %(cc1_secure_plt_default)}} \
634%{profile: -p}"
635
636/* Don't put -Y P,<path> for cross compilers.  */
637#ifndef CROSS_DIRECTORY_STRUCTURE
638#define LINK_PATH_SPEC "\
639%{!R*:%{L*:-R %*}} \
640%{!nostdlib: %{!YP,*: \
641    %{compat-bsd: \
642	%{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
643	%{!p:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}} \
644	%{!R*: %{!L*: -R /usr/ucblib}} \
645    %{!compat-bsd: \
646	%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
647	%{!p:-Y P,/usr/ccs/lib:/usr/lib}}}}"
648
649#else
650#define LINK_PATH_SPEC ""
651#endif
652
653/* Default starting address if specified.  */
654#define LINK_START_SPEC "\
655%{mads         : %(link_start_ads)         ; \
656  myellowknife : %(link_start_yellowknife) ; \
657  mmvme        : %(link_start_mvme)        ; \
658  msim         : %(link_start_sim)         ; \
659  mwindiss     : %(link_start_windiss)     ; \
660  mcall-freebsd: %(link_start_freebsd)     ; \
661  mcall-linux  : %(link_start_linux)       ; \
662  mcall-gnu    : %(link_start_gnu)         ; \
663  mcall-netbsd : %(link_start_netbsd)      ; \
664  mcall-openbsd: %(link_start_openbsd)     ; \
665               : %(link_start_default)     }"
666
667#define LINK_START_DEFAULT_SPEC ""
668
669/* Override svr4.h definition.  */
670#undef	LINK_SPEC
671#define	LINK_SPEC "\
672%{h*} %{v:-V} %{!msdata=none:%{G*}} %{msdata=none:-G0} \
673%{YP,*} %{R*} \
674%{Qy:} %{!Qn:-Qy} \
675%(link_shlib) \
676%{!Wl,-T*: %{!T*: %(link_start) }} \
677%(link_target) \
678%(link_os)"
679
680/* For now, turn off shared libraries by default.  */
681#ifndef SHARED_LIB_SUPPORT
682#define NO_SHARED_LIB_SUPPORT
683#endif
684
685#ifndef NO_SHARED_LIB_SUPPORT
686/* Shared libraries are default.  */
687#define LINK_SHLIB_SPEC "\
688%{!static: %(link_path) %{!R*:%{L*:-R %*}}} \
689%{mshlib: } \
690%{static:-dn -Bstatic} \
691%{shared:-G -dy -z text} \
692%{symbolic:-Bsymbolic -G -dy -z text}"
693
694#else
695/* Shared libraries are not default.  */
696#define LINK_SHLIB_SPEC "\
697%{mshlib: %(link_path) } \
698%{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} \
699%{static: } \
700%{shared:-G -dy -z text %(link_path) } \
701%{symbolic:-Bsymbolic -G -dy -z text %(link_path) }"
702#endif
703
704/* Override the default target of the linker.  */
705#define	LINK_TARGET_SPEC "\
706%{mlittle: --oformat elf32-powerpcle } %{mlittle-endian: --oformat elf32-powerpcle } \
707%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
708    %{mcall-i960-old: --oformat elf32-powerpcle} \
709  }}}}"
710
711/* Any specific OS flags.  */
712#define LINK_OS_SPEC "\
713%{mads         : %(link_os_ads)         ; \
714  myellowknife : %(link_os_yellowknife) ; \
715  mmvme        : %(link_os_mvme)        ; \
716  msim         : %(link_os_sim)         ; \
717  mwindiss     : %(link_os_windiss)     ; \
718  mcall-freebsd: %(link_os_freebsd)     ; \
719  mcall-linux  : %(link_os_linux)       ; \
720  mcall-gnu    : %(link_os_gnu)         ; \
721  mcall-netbsd : %(link_os_netbsd)      ; \
722  mcall-openbsd: %(link_os_openbsd)     ; \
723               : %(link_os_default)     }"
724
725#define LINK_OS_DEFAULT_SPEC ""
726
727/* Override rs6000.h definition.  */
728#undef	CPP_SPEC
729#define	CPP_SPEC "%{posix: -D_POSIX_SOURCE} \
730%{mads         : %(cpp_os_ads)         ; \
731  myellowknife : %(cpp_os_yellowknife) ; \
732  mmvme        : %(cpp_os_mvme)        ; \
733  msim         : %(cpp_os_sim)         ; \
734  mwindiss     : %(cpp_os_windiss)     ; \
735  mcall-freebsd: %(cpp_os_freebsd)     ; \
736  mcall-linux  : %(cpp_os_linux)       ; \
737  mcall-gnu    : %(cpp_os_gnu)         ; \
738  mcall-netbsd : %(cpp_os_netbsd)      ; \
739  mcall-openbsd: %(cpp_os_openbsd)     ; \
740               : %(cpp_os_default)     }"
741
742#define	CPP_OS_DEFAULT_SPEC ""
743
744/* Override svr4.h definition.  */
745#undef	STARTFILE_SPEC
746#define	STARTFILE_SPEC "\
747%{mads         : %(startfile_ads)         ; \
748  myellowknife : %(startfile_yellowknife) ; \
749  mmvme        : %(startfile_mvme)        ; \
750  msim         : %(startfile_sim)         ; \
751  mwindiss     : %(startfile_windiss)     ; \
752  mcall-freebsd: %(startfile_freebsd)     ; \
753  mcall-linux  : %(startfile_linux)       ; \
754  mcall-gnu    : %(startfile_gnu)         ; \
755  mcall-netbsd : %(startfile_netbsd)      ; \
756  mcall-openbsd: %(startfile_openbsd)     ; \
757               : %(startfile_default)     }"
758
759#define	STARTFILE_DEFAULT_SPEC ""
760
761/* Override svr4.h definition.  */
762#undef	LIB_SPEC
763#define	LIB_SPEC "\
764%{mads         : %(lib_ads)         ; \
765  myellowknife : %(lib_yellowknife) ; \
766  mmvme        : %(lib_mvme)        ; \
767  msim         : %(lib_sim)         ; \
768  mwindiss     : %(lib_windiss)     ; \
769  mcall-freebsd: %(lib_freebsd)     ; \
770  mcall-linux  : %(lib_linux)       ; \
771  mcall-gnu    : %(lib_gnu)         ; \
772  mcall-netbsd : %(lib_netbsd)      ; \
773  mcall-openbsd: %(lib_openbsd)     ; \
774               : %(lib_default)     }"
775
776#define LIB_DEFAULT_SPEC ""
777
778/* Override svr4.h definition.  */
779#undef	ENDFILE_SPEC
780#define	ENDFILE_SPEC "\
781%{mads         : crtsavres.o%s        %(endfile_ads)         ; \
782  myellowknife : crtsavres.o%s        %(endfile_yellowknife) ; \
783  mmvme        : crtsavres.o%s        %(endfile_mvme)        ; \
784  msim         : crtsavres.o%s        %(endfile_sim)         ; \
785  mwindiss     :                      %(endfile_windiss)     ; \
786  mcall-freebsd: crtsavres.o%s        %(endfile_freebsd)     ; \
787  mcall-linux  : crtsavres.o%s        %(endfile_linux)       ; \
788  mcall-gnu    : crtsavres.o%s        %(endfile_gnu)         ; \
789  mcall-netbsd : crtsavres.o%s        %(endfile_netbsd)      ; \
790  mcall-openbsd: crtsavres.o%s        %(endfile_openbsd)     ; \
791               : %(crtsavres_default) %(endfile_default)     }"
792
793#define CRTSAVRES_DEFAULT_SPEC "crtsavres.o%s"
794
795#define	ENDFILE_DEFAULT_SPEC ""
796
797/* Motorola ADS support.  */
798#define LIB_ADS_SPEC "--start-group -lads -lc --end-group"
799
800#define	STARTFILE_ADS_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
801
802#define	ENDFILE_ADS_SPEC "crtend.o%s ecrtn.o%s"
803
804#define LINK_START_ADS_SPEC "-T ads.ld%s"
805
806#define LINK_OS_ADS_SPEC ""
807
808#define CPP_OS_ADS_SPEC ""
809
810/* Motorola Yellowknife support.  */
811#define LIB_YELLOWKNIFE_SPEC "--start-group -lyk -lc --end-group"
812
813#define	STARTFILE_YELLOWKNIFE_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
814
815#define	ENDFILE_YELLOWKNIFE_SPEC "crtend.o%s ecrtn.o%s"
816
817#define LINK_START_YELLOWKNIFE_SPEC "-T yellowknife.ld%s"
818
819#define LINK_OS_YELLOWKNIFE_SPEC ""
820
821#define CPP_OS_YELLOWKNIFE_SPEC ""
822
823/* Motorola MVME support.  */
824#define LIB_MVME_SPEC "--start-group -lmvme -lc --end-group"
825
826#define	STARTFILE_MVME_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
827
828#define	ENDFILE_MVME_SPEC "crtend.o%s ecrtn.o%s"
829
830#define LINK_START_MVME_SPEC "-Ttext 0x40000"
831
832#define LINK_OS_MVME_SPEC ""
833
834#define CPP_OS_MVME_SPEC ""
835
836/* PowerPC simulator based on netbsd system calls support.  */
837#define LIB_SIM_SPEC "--start-group -lsim -lc --end-group"
838
839#define	STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s crtbegin.o%s"
840
841#define	ENDFILE_SIM_SPEC "crtend.o%s ecrtn.o%s"
842
843#define LINK_START_SIM_SPEC ""
844
845#define LINK_OS_SIM_SPEC "-m elf32ppcsim"
846
847#define CPP_OS_SIM_SPEC ""
848
849/* FreeBSD support.  */
850
851#define CPP_OS_FREEBSD_SPEC	"\
852  -D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ \
853  -Acpu=powerpc -Amachine=powerpc"
854
855#define	STARTFILE_FREEBSD_SPEC	FBSD_STARTFILE_SPEC
856#define ENDFILE_FREEBSD_SPEC	FBSD_ENDFILE_SPEC
857#define LIB_FREEBSD_SPEC	FBSD_LIB_SPEC
858#define LINK_START_FREEBSD_SPEC	""
859
860#define LINK_OS_FREEBSD_SPEC "\
861  %{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \
862  %{v:-V} \
863  %{assert*} %{R*} %{rpath*} %{defsym*} \
864  %{shared:-Bshareable %{h*} %{soname*}} \
865  %{!shared: \
866    %{!static: \
867      %{rdynamic: -export-dynamic} \
868      %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \
869    %{static:-Bstatic}} \
870  %{symbolic:-Bsymbolic}"
871
872/* GNU/Linux support.  */
873#define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
874%{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \
875%{!shared: %{profile:-lc_p} %{!profile:-lc}}}"
876
877#ifdef HAVE_LD_PIE
878#define	STARTFILE_LINUX_SPEC "\
879%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
880%{mnewlib:ecrti.o%s;:crti.o%s} \
881%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
882#else
883#define	STARTFILE_LINUX_SPEC "\
884%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
885%{mnewlib:ecrti.o%s;:crti.o%s} \
886%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
887#endif
888
889#define	ENDFILE_LINUX_SPEC "\
890%{shared|pie:crtendS.o%s;:crtend.o%s} \
891%{mnewlib:ecrtn.o%s;:crtn.o%s}"
892
893#define LINK_START_LINUX_SPEC ""
894
895#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
896#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
897#if UCLIBC_DEFAULT
898#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:%{muclibc:%e-mglibc and -muclibc used together}" G ";:" U "}"
899#else
900#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:%{mglibc:%e-mglibc and -muclibc used together}" U ";:" G "}"
901#endif
902#define LINUX_DYNAMIC_LINKER \
903  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
904
905#define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
906  %{rdynamic:-export-dynamic} \
907  %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "}}}"
908
909#if defined(HAVE_LD_EH_FRAME_HDR)
910# define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
911#endif
912
913#define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
914%{!undef:							  \
915  %{!ansi:							  \
916    %{!std=*:-Dunix -D__unix -Dlinux -D__linux}			  \
917    %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}}		  \
918-Asystem=linux -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
919
920/* GNU/Hurd support.  */
921#define LIB_GNU_SPEC "%{mnewlib: --start-group -lgnu -lc --end-group } \
922%{!mnewlib: %{shared:-lc} %{!shared: %{pthread:-lpthread } \
923%{profile:-lc_p} %{!profile:-lc}}}"
924
925#define	STARTFILE_GNU_SPEC "\
926%{!shared: %{!static: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}} \
927%{static: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \
928%{mnewlib: ecrti.o%s} %{!mnewlib: crti.o%s} \
929%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
930
931#define	ENDFILE_GNU_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s} \
932%{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s}"
933
934#define LINK_START_GNU_SPEC ""
935
936#define LINK_OS_GNU_SPEC "-m elf32ppclinux %{!shared: %{!static: \
937  %{rdynamic:-export-dynamic} \
938  %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
939
940#define CPP_OS_GNU_SPEC "-D__unix__ -D__gnu_hurd__ -D__GNU__	\
941%{!undef:					                \
942  %{!ansi: -Dunix -D__unix}}			                \
943-Asystem=gnu -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
944
945/* NetBSD support.  */
946#define LIB_NETBSD_SPEC "\
947%{profile:-lgmon -lc_p} %{!profile:-lc}"
948
949#define	STARTFILE_NETBSD_SPEC "\
950ncrti.o%s crt0.o%s \
951%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
952
953#define ENDFILE_NETBSD_SPEC "\
954%{!shared:crtend.o%s} %{shared:crtendS.o%s} \
955ncrtn.o%s"
956
957#define LINK_START_NETBSD_SPEC "\
958"
959
960#define LINK_OS_NETBSD_SPEC "\
961%{!shared: %{!static: \
962  %{rdynamic:-export-dynamic} \
963  %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}}"
964
965#define CPP_OS_NETBSD_SPEC "\
966-D__powerpc__ -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__"
967
968/* OpenBSD support.  */
969#ifndef	LIB_OPENBSD_SPEC
970#define LIB_OPENBSD_SPEC "%{!shared:%{pthread:-lpthread%{p:_p}%{!p:%{pg:_p}}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}"
971#endif
972
973#ifndef	STARTFILE_OPENBSD_SPEC
974#define	STARTFILE_OPENBSD_SPEC "\
975%{!shared: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \
976%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
977#endif
978
979#ifndef	ENDFILE_OPENBSD_SPEC
980#define	ENDFILE_OPENBSD_SPEC "\
981%{!shared:crtend.o%s} %{shared:crtendS.o%s}"
982#endif
983
984#ifndef LINK_START_OPENBSD_SPEC
985#define LINK_START_OPENBSD_SPEC "-Ttext 0x400074"
986#endif
987
988#ifndef LINK_OS_OPENBSD_SPEC
989#define LINK_OS_OPENBSD_SPEC ""
990#endif
991
992#ifndef CPP_OS_OPENBSD_SPEC
993#define CPP_OS_OPENBSD_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
994#endif
995
996/* WindISS support.  */
997
998#define LIB_WINDISS_SPEC "--start-group -li -lcfp -lwindiss -lram -limpl -limpfp --end-group"
999
1000#define CPP_OS_WINDISS_SPEC "\
1001-D__rtasim \
1002-D__EABI__ \
1003-D__ppc \
1004%{!msoft-float: -D__hardfp} \
1005"
1006
1007#define STARTFILE_WINDISS_SPEC "crt0.o%s crtbegin.o%s"
1008
1009#define ENDFILE_WINDISS_SPEC "crtend.o%s"
1010
1011#define LINK_START_WINDISS_SPEC ""
1012
1013#define LINK_OS_WINDISS_SPEC ""
1014
1015/* Define any extra SPECS that the compiler needs to generate.  */
1016/* Override rs6000.h definition.  */
1017#undef	SUBTARGET_EXTRA_SPECS
1018#define	SUBTARGET_EXTRA_SPECS						\
1019  { "crtsavres_default",	CRTSAVRES_DEFAULT_SPEC },		\
1020  { "lib_ads",			LIB_ADS_SPEC },				\
1021  { "lib_yellowknife",		LIB_YELLOWKNIFE_SPEC },			\
1022  { "lib_mvme",			LIB_MVME_SPEC },			\
1023  { "lib_sim",			LIB_SIM_SPEC },				\
1024  { "lib_freebsd",		LIB_FREEBSD_SPEC },			\
1025  { "lib_gnu",			LIB_GNU_SPEC },				\
1026  { "lib_linux",		LIB_LINUX_SPEC },			\
1027  { "lib_netbsd",		LIB_NETBSD_SPEC },			\
1028  { "lib_openbsd",		LIB_OPENBSD_SPEC },			\
1029  { "lib_windiss",		LIB_WINDISS_SPEC },			\
1030  { "lib_default",		LIB_DEFAULT_SPEC },			\
1031  { "startfile_ads",		STARTFILE_ADS_SPEC },			\
1032  { "startfile_yellowknife",	STARTFILE_YELLOWKNIFE_SPEC },		\
1033  { "startfile_mvme",		STARTFILE_MVME_SPEC },			\
1034  { "startfile_sim",		STARTFILE_SIM_SPEC },			\
1035  { "startfile_freebsd",	STARTFILE_FREEBSD_SPEC },		\
1036  { "startfile_gnu",		STARTFILE_GNU_SPEC },			\
1037  { "startfile_linux",		STARTFILE_LINUX_SPEC },			\
1038  { "startfile_netbsd",		STARTFILE_NETBSD_SPEC },		\
1039  { "startfile_openbsd",	STARTFILE_OPENBSD_SPEC },		\
1040  { "startfile_windiss",	STARTFILE_WINDISS_SPEC },		\
1041  { "startfile_default",	STARTFILE_DEFAULT_SPEC },		\
1042  { "endfile_ads",		ENDFILE_ADS_SPEC },			\
1043  { "endfile_yellowknife",	ENDFILE_YELLOWKNIFE_SPEC },		\
1044  { "endfile_mvme",		ENDFILE_MVME_SPEC },			\
1045  { "endfile_sim",		ENDFILE_SIM_SPEC },			\
1046  { "endfile_freebsd",		ENDFILE_FREEBSD_SPEC },			\
1047  { "endfile_gnu",		ENDFILE_GNU_SPEC },			\
1048  { "endfile_linux",		ENDFILE_LINUX_SPEC },			\
1049  { "endfile_netbsd",		ENDFILE_NETBSD_SPEC },			\
1050  { "endfile_openbsd",		ENDFILE_OPENBSD_SPEC },			\
1051  { "endfile_windiss",		ENDFILE_WINDISS_SPEC },			\
1052  { "endfile_default",		ENDFILE_DEFAULT_SPEC },			\
1053  { "link_path",		LINK_PATH_SPEC },			\
1054  { "link_shlib",		LINK_SHLIB_SPEC },			\
1055  { "link_target",		LINK_TARGET_SPEC },			\
1056  { "link_start",		LINK_START_SPEC },			\
1057  { "link_start_ads",		LINK_START_ADS_SPEC },			\
1058  { "link_start_yellowknife",	LINK_START_YELLOWKNIFE_SPEC },		\
1059  { "link_start_mvme",		LINK_START_MVME_SPEC },			\
1060  { "link_start_sim",		LINK_START_SIM_SPEC },			\
1061  { "link_start_freebsd",	LINK_START_FREEBSD_SPEC },		\
1062  { "link_start_gnu",		LINK_START_GNU_SPEC },			\
1063  { "link_start_linux",		LINK_START_LINUX_SPEC },		\
1064  { "link_start_netbsd",	LINK_START_NETBSD_SPEC },		\
1065  { "link_start_openbsd",	LINK_START_OPENBSD_SPEC },		\
1066  { "link_start_windiss",	LINK_START_WINDISS_SPEC },		\
1067  { "link_start_default",	LINK_START_DEFAULT_SPEC },		\
1068  { "link_os",			LINK_OS_SPEC },				\
1069  { "link_os_ads",		LINK_OS_ADS_SPEC },			\
1070  { "link_os_yellowknife",	LINK_OS_YELLOWKNIFE_SPEC },		\
1071  { "link_os_mvme",		LINK_OS_MVME_SPEC },			\
1072  { "link_os_sim",		LINK_OS_SIM_SPEC },			\
1073  { "link_os_freebsd",		LINK_OS_FREEBSD_SPEC },			\
1074  { "link_os_linux",		LINK_OS_LINUX_SPEC },			\
1075  { "link_os_gnu",		LINK_OS_GNU_SPEC },			\
1076  { "link_os_netbsd",		LINK_OS_NETBSD_SPEC },			\
1077  { "link_os_openbsd",		LINK_OS_OPENBSD_SPEC },			\
1078  { "link_os_windiss",		LINK_OS_WINDISS_SPEC },			\
1079  { "link_os_default",		LINK_OS_DEFAULT_SPEC },			\
1080  { "cc1_endian_big",		CC1_ENDIAN_BIG_SPEC },			\
1081  { "cc1_endian_little",	CC1_ENDIAN_LITTLE_SPEC },		\
1082  { "cc1_endian_default",	CC1_ENDIAN_DEFAULT_SPEC },		\
1083  { "cc1_secure_plt_default",	CC1_SECURE_PLT_DEFAULT_SPEC },		\
1084  { "cpp_os_ads",		CPP_OS_ADS_SPEC },			\
1085  { "cpp_os_yellowknife",	CPP_OS_YELLOWKNIFE_SPEC },		\
1086  { "cpp_os_mvme",		CPP_OS_MVME_SPEC },			\
1087  { "cpp_os_sim",		CPP_OS_SIM_SPEC },			\
1088  { "cpp_os_freebsd",		CPP_OS_FREEBSD_SPEC },			\
1089  { "cpp_os_gnu",		CPP_OS_GNU_SPEC },			\
1090  { "cpp_os_linux",		CPP_OS_LINUX_SPEC },			\
1091  { "cpp_os_netbsd",		CPP_OS_NETBSD_SPEC },			\
1092  { "cpp_os_openbsd",		CPP_OS_OPENBSD_SPEC },			\
1093  { "cpp_os_windiss",		CPP_OS_WINDISS_SPEC },			\
1094  { "cpp_os_default",		CPP_OS_DEFAULT_SPEC },			\
1095  { "fbsd_dynamic_linker",	FBSD_DYNAMIC_LINKER },			\
1096  SUBSUBTARGET_EXTRA_SPECS
1097
1098#define	SUBSUBTARGET_EXTRA_SPECS
1099
1100/* Define this macro as a C expression for the initializer of an
1101   array of string to tell the driver program which options are
1102   defaults for this target and thus do not need to be handled
1103   specially when using `MULTILIB_OPTIONS'.
1104
1105   Do not define this macro if `MULTILIB_OPTIONS' is not defined in
1106   the target makefile fragment or if none of the options listed in
1107   `MULTILIB_OPTIONS' are set by default.  *Note Target Fragment::.  */
1108
1109#define	MULTILIB_DEFAULTS { "mbig", "mcall-sysv" }
1110
1111/* Define this macro if the code for function profiling should come
1112   before the function prologue.  Normally, the profiling code comes
1113   after.  */
1114#define PROFILE_BEFORE_PROLOGUE 1
1115
1116/* Function name to call to do profiling.  */
1117#define RS6000_MCOUNT "_mcount"
1118
1119/* Define this macro (to a value of 1) if you want to support the
1120   Win32 style pragmas #pragma pack(push,<n>)' and #pragma
1121   pack(pop)'.  The pack(push,<n>) pragma specifies the maximum
1122   alignment (in bytes) of fields within a structure, in much the
1123   same way as the __aligned__' and __packed__' __attribute__'s
1124   do.  A pack value of zero resets the behavior to the default.
1125   Successive invocations of this pragma cause the previous values to
1126   be stacked, so that invocations of #pragma pack(pop)' will return
1127   to the previous value.  */
1128
1129#define HANDLE_PRAGMA_PACK_PUSH_POP 1
1130
1131/* Select a format to encode pointers in exception handling data.  CODE
1132   is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
1133   true if the symbol may be affected by dynamic relocations.  */
1134#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)			     \
1135  ((flag_pic || TARGET_RELOCATABLE)					     \
1136   ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \
1137   : DW_EH_PE_absptr)
1138
1139#define DOUBLE_INT_ASM_OP "\t.quad\t"
1140
1141/* Generate entries in .fixup for relocatable addresses.  */
1142#define RELOCATABLE_NEEDS_FIXUP 1
1143
1144/* This target uses the sysv4.opt file.  */
1145#define TARGET_USES_SYSV4_OPT 1
1146