Home | History | Annotate | Line # | Download | only in rs6000
netbsd64.h revision 1.1.1.4
      1 /* Definitions of target machine for GNU compiler,
      2    for 64 bit PowerPC NetBSD.
      3    Copyright (C) 2006 Free Software Foundation, Inc.
      4    Contributed by Matthew Green (mrg (at) eterna.com.au).
      5 
      6    This file is part of GCC.
      7 
      8    GCC is free software; you can redistribute it and/or modify it
      9    under the terms of the GNU General Public License as published
     10    by the Free Software Foundation; either version 2, or (at your
     11    option) any later version.
     12 
     13    GCC is distributed in the hope that it will be useful, but WITHOUT
     14    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
     15    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
     16    License for more details.
     17 
     18    You should have received a copy of the GNU General Public License
     19    along with GCC; see the file COPYING.  If not, write to the
     20    Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
     21    MA 02110-1301, USA.  */
     22 
     23 #ifndef RS6000_BI_ARCH
     24 
     25 #undef	DEFAULT_ABI
     26 #define	DEFAULT_ABI ABI_AIX
     27 
     28 #undef	TARGET_64BIT
     29 #define	TARGET_64BIT 1
     30 
     31 #define	DEFAULT_ARCH64_P 1
     32 #define	RS6000_BI_ARCH_P 0
     33 
     34 #else
     35 
     36 #define	DEFAULT_ARCH64_P (TARGET_DEFAULT & MASK_64BIT)
     37 #define	RS6000_BI_ARCH_P 1
     38 
     39 #endif
     40 
     41 #ifdef IN_LIBGCC2
     42 #undef TARGET_64BIT
     43 #ifdef __powerpc64__
     44 #define TARGET_64BIT 1
     45 #else
     46 #define TARGET_64BIT 0
     47 #endif
     48 #endif
     49 
     50 #undef	TARGET_AIX
     51 #define	TARGET_AIX TARGET_64BIT
     52 
     53 #ifdef HAVE_LD_NO_DOT_SYMS
     54 /* New ABI uses a local sym for the function entry point.  */
     55 extern int dot_symbols;
     56 #undef DOT_SYMBOLS
     57 #define DOT_SYMBOLS dot_symbols
     58 #endif
     59 
     60 #define TARGET_PROFILE_KERNEL profile_kernel
     61 
     62 #define TARGET_USES_LINUX64_OPT 1
     63 #ifdef HAVE_LD_LARGE_TOC
     64 #undef TARGET_CMODEL
     65 #define TARGET_CMODEL rs6000_current_cmodel
     66 #define SET_CMODEL(opt) rs6000_current_cmodel = opt
     67 #else
     68 #define SET_CMODEL(opt) do {} while (0)
     69 #endif
     70 
     71 #undef  PROCESSOR_DEFAULT
     72 #define PROCESSOR_DEFAULT PROCESSOR_POWER4
     73 #undef  PROCESSOR_DEFAULT64
     74 #define PROCESSOR_DEFAULT64 PROCESSOR_POWER4
     75 
     76 /* We don't need to generate entries in .fixup, except when
     77    -mrelocatable or -mrelocatable-lib is given.  */
     78 #undef RELOCATABLE_NEEDS_FIXUP
     79 #define RELOCATABLE_NEEDS_FIXUP \
     80   (rs6000_isa_flags & rs6000_isa_flags_explicit & OPTION_MASK_RELOCATABLE)
     81 
     82 #undef	RS6000_ABI_NAME
     83 #define	RS6000_ABI_NAME "netbsd"
     84 
     85 #define INVALID_64BIT "-m%s not supported in this configuration"
     86 #define INVALID_32BIT INVALID_64BIT
     87 
     88 #define ELFv2_ABI_CHECK (rs6000_elf_abi == 2)
     89 
     90 #undef CC1_OS_NETBSD_SPEC
     91 #define CC1_OS_NETBSD_SPEC \
     92   NETBSD_CC1_AND_CC1PLUS_SPEC \
     93   "%{!m32: %{!mrelocatable: %{!fno-pie: %{!fno-pic: \
     94      %{!fpie: %{!fpic: \
     95        %{!fPIE: %{!fPIC:-fPIC}}}}}}}}"
     96 /* %{!m32: %{!mcmodel*: -mcmodel=medium}}" */
     97 
     98 #undef CC1PLUS_SPEC
     99 #define CC1PLUS_SPEC CC1_OS_NETBSD_SPEC
    100 
    101 #undef	SUBSUBTARGET_OVERRIDE_OPTIONS
    102 #define	SUBSUBTARGET_OVERRIDE_OPTIONS				\
    103   do								\
    104     {								\
    105       if (!global_options_set.x_rs6000_alignment_flags)		\
    106 	rs6000_alignment_flags = MASK_ALIGN_NATURAL;		\
    107       if (TARGET_64BIT)						\
    108 	{							\
    109 	  if (DEFAULT_ABI != ABI_AIX)				\
    110 	    {							\
    111 	      rs6000_current_abi = ABI_AIX;			\
    112 	      error (INVALID_64BIT, "call");			\
    113 	    }							\
    114 	  dot_symbols = !strcmp (rs6000_abi_name, "aixdesc");	\
    115 	  if (ELFv2_ABI_CHECK)					\
    116 	    {							\
    117 	      rs6000_current_abi = ABI_ELFv2;			\
    118 	      if (dot_symbols)					\
    119 		error ("-mcall-aixdesc incompatible with -mabi=elfv2"); \
    120 	    }							\
    121 	  if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE)	\
    122 	    {							\
    123 	      rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE;	\
    124 	      error (INVALID_64BIT, "relocatable");		\
    125 	    }							\
    126 	  if (rs6000_isa_flags & OPTION_MASK_EABI)		\
    127 	    {							\
    128 	      rs6000_isa_flags &= ~OPTION_MASK_EABI;		\
    129 	      error (INVALID_64BIT, "eabi");			\
    130 	    }							\
    131 	  if (TARGET_PROTOTYPE)					\
    132 	    {							\
    133 	      target_prototype = 0;				\
    134 	      error (INVALID_64BIT, "prototype");		\
    135 	    }							\
    136 	  if ((rs6000_isa_flags & OPTION_MASK_POWERPC64) == 0)	\
    137 	    {							\
    138 	      rs6000_isa_flags |= OPTION_MASK_POWERPC64;	\
    139 	      error ("-m64 requires a PowerPC64 cpu");		\
    140 	    }							\
    141 	  if ((rs6000_isa_flags_explicit			\
    142 	       & OPTION_MASK_MINIMAL_TOC) != 0)			\
    143 	    {							\
    144 	      if (global_options_set.x_rs6000_current_cmodel	\
    145 		  && rs6000_current_cmodel != CMODEL_SMALL)	\
    146 		error ("-mcmodel incompatible with other toc options"); \
    147 	      SET_CMODEL (CMODEL_SMALL);			\
    148 	    }							\
    149 	    {							\
    150 	      if (!global_options_set.x_rs6000_current_cmodel)	\
    151 		SET_CMODEL (CMODEL_MEDIUM);			\
    152 	      if (rs6000_current_cmodel != CMODEL_SMALL)	\
    153 		{						\
    154 		  TARGET_NO_FP_IN_TOC = 0;			\
    155 		  TARGET_NO_SUM_IN_TOC = 0;			\
    156 		}						\
    157 	    }							\
    158 	}							\
    159       else							\
    160 	{							\
    161 	  if (!RS6000_BI_ARCH_P)				\
    162 	    error (INVALID_32BIT, "32");			\
    163 	  if (TARGET_PROFILE_KERNEL)				\
    164 	    {							\
    165 	      TARGET_PROFILE_KERNEL = 0;			\
    166 	      error (INVALID_32BIT, "profile-kernel");		\
    167 	    }							\
    168 	  if (global_options_set.x_rs6000_current_cmodel)	\
    169 	    {							\
    170 	      SET_CMODEL (CMODEL_SMALL);			\
    171 	      error (INVALID_32BIT, "cmodel");			\
    172 	    }							\
    173 	}							\
    174     }								\
    175   while (0)
    176 
    177 #ifdef	RS6000_BI_ARCH
    178 
    179 #if 0
    180 #undef	OVERRIDE_OPTIONS
    181 #define	OVERRIDE_OPTIONS \
    182   rs6000_override_options (((TARGET_DEFAULT ^ target_flags) & MASK_64BIT) \
    183 			   ? (char *) 0 : TARGET_CPU_DEFAULT)
    184 #endif
    185 
    186 #endif
    187 
    188 #undef	ASM_DEFAULT_SPEC
    189 #undef	ASM_SPEC
    190 #undef	LINK_OS_NETBSD_SPEC
    191 #undef	LINK_SECURE_PLT_SPEC
    192 
    193 #ifndef	RS6000_BI_ARCH
    194 #define	ASM_DEFAULT_SPEC "-mppc64"
    195 #define	ASM_SPEC	 "%(asm_spec64) %(asm_spec_common)"
    196 #define	LINK_OS_NETBSD_SPEC "%(link_os_netbsd_spec64)"
    197 #define	LINK_SECURE_PLT_SPEC ""
    198 #else
    199 #if DEFAULT_ARCH64_P
    200 #define	ASM_DEFAULT_SPEC "-mppc%{!m32:64}"
    201 #define	ASM_SPEC	 "%{m32:%(asm_spec32)}%{!m32:%(asm_spec64)} %(asm_spec_common)"
    202 #define	LINK_OS_NETBSD_SPEC "%{m32:%(link_os_netbsd_spec32)}%{!m32:%(link_os_netbsd_spec64)}"
    203 #define	LINK_SECURE_PLT_SPEC "%{m32: " LINK_SECURE_PLT_DEFAULT_SPEC "}"
    204 #else
    205 #define	ASM_DEFAULT_SPEC "-mppc%{m64:64}"
    206 #define	ASM_SPEC	 "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)"
    207 #define	LINK_OS_NETBSD_SPEC "%{!m64:%(link_os_netbsd_spec32)}%{m64:%(link_os_netbsd_spec64)}"
    208 #define	LINK_SECURE_PLT_SPEC "%{!m64: " LINK_SECURE_PLT_DEFAULT_SPEC "}"
    209 #endif
    210 #endif
    211 
    212 #define ASM_SPEC32 "-a32 \
    213 %{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \
    214 %{memb|msdata=eabi: -memb}"
    215 
    216 #define ASM_SPEC64 "-a64"
    217 
    218 #define ASM_SPEC_COMMON "%(asm_cpu) \
    219 %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}}" \
    220   ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
    221 
    222 #undef	SUBSUBTARGET_EXTRA_SPECS
    223 #define SUBSUBTARGET_EXTRA_SPECS \
    224   { "asm_spec_common",		ASM_SPEC_COMMON },			\
    225   { "asm_spec32",		ASM_SPEC32 },				\
    226   { "asm_spec64",		ASM_SPEC64 },				\
    227   { "link_os_netbsd_spec32",	LINK_OS_NETBSD_SPEC32 },		\
    228   { "link_os_netbsd_spec64",	LINK_OS_NETBSD_SPEC64 },
    229 
    230 #undef	MULTILIB_DEFAULTS
    231 #if DEFAULT_ARCH64_P
    232 #define MULTILIB_DEFAULTS { "m64" }
    233 #else
    234 #define MULTILIB_DEFAULTS { "m32" }
    235 #endif
    236 
    237 #ifndef RS6000_BI_ARCH
    238 
    239 /* 64-bit PowerPC NetBSD is always big-endian.  */
    240 #undef	TARGET_LITTLE_ENDIAN
    241 #define TARGET_LITTLE_ENDIAN	0
    242 
    243 /* 64-bit PowerPC NetBSD always has a TOC.  */
    244 #undef  TARGET_TOC
    245 #define	TARGET_TOC		1
    246 
    247 /* Some things from sysv4.h we don't do when 64 bit.  */
    248 #undef	TARGET_RELOCATABLE
    249 #define	TARGET_RELOCATABLE	0
    250 #undef	TARGET_EABI
    251 #define	TARGET_EABI		0
    252 #undef	TARGET_PROTOTYPE
    253 #define	TARGET_PROTOTYPE	0
    254 #undef RELOCATABLE_NEEDS_FIXUP
    255 #define RELOCATABLE_NEEDS_FIXUP 0
    256 
    257 #endif
    258 
    259 /* PowerPC64 NetBSD word-aligns FP doubles when -malign-power is given.  */
    260 #undef  ADJUST_FIELD_ALIGN
    261 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
    262   ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE)	\
    263    ? 128								\
    264    : (TARGET_64BIT							\
    265       && TARGET_ALIGN_NATURAL == 0					\
    266       && TYPE_MODE (strip_array_types (TREE_TYPE (FIELD))) == DFmode)	\
    267    ? MIN ((COMPUTED), 32)						\
    268    : (COMPUTED))
    269 
    270 /* PowerPC64 NetBSD increases natural record alignment to doubleword if
    271    the first field is an FP double, only if in power alignment mode.  */
    272 #undef  ROUND_TYPE_ALIGN
    273 #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED)			\
    274   ((TARGET_64BIT							\
    275     && (TREE_CODE (STRUCT) == RECORD_TYPE				\
    276 	|| TREE_CODE (STRUCT) == UNION_TYPE				\
    277 	|| TREE_CODE (STRUCT) == QUAL_UNION_TYPE)			\
    278     && TARGET_ALIGN_NATURAL == 0)					\
    279    ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED)	\
    280    : MAX ((COMPUTED), (SPECIFIED)))
    281 
    282 /* Use the default for compiling target libs.  */
    283 #ifdef IN_TARGET_LIBS
    284 #undef TARGET_ALIGN_NATURAL
    285 #define TARGET_ALIGN_NATURAL 1
    286 #endif
    287 
    288 /* Indicate that jump tables go in the text section.  */
    289 #undef  JUMP_TABLES_IN_TEXT_SECTION
    290 #define JUMP_TABLES_IN_TEXT_SECTION TARGET_64BIT
    291 
    292 /* The linux ppc64 ABI isn't explicit on whether aggregates smaller
    293    than a doubleword should be padded upward or downward.  You could
    294    reasonably assume that they follow the normal rules for structure
    295    layout treating the parameter area as any other block of memory,
    296    then map the reg param area to registers.  i.e. pad upward.
    297    Setting both of the following defines results in this behavior.
    298    Setting just the first one will result in aggregates that fit in a
    299    doubleword being padded downward, and others being padded upward.
    300    Not a bad idea as this results in struct { int x; } being passed
    301    the same way as an int.  */
    302 #define AGGREGATE_PADDING_FIXED TARGET_64BIT
    303 #define AGGREGATES_PAD_UPWARD_ALWAYS 0
    304 
    305 /* Specify padding for the last element of a block move between
    306    registers and memory.  FIRST is nonzero if this is the only
    307    element.  */
    308 #define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
    309   (!(FIRST) ? upward : FUNCTION_ARG_PADDING (MODE, TYPE))
    310 
    311 /* NetBSD doesn't support saving and restoring 64-bit regs in a 32-bit
    312    process.  XXXMRG?  */
    313 #define OS_MISSING_POWERPC64 !TARGET_64BIT
    314 
    315 #undef  TARGET_OS_CPP_BUILTINS
    316 #define TARGET_OS_CPP_BUILTINS()			\
    317   do							\
    318     {							\
    319       NETBSD_OS_CPP_BUILTINS_ELF();			\
    320       if (TARGET_ISEL)					\
    321 	builtin_define ("__PPC_ISEL__");		\
    322       if (TARGET_64BIT)					\
    323 	{						\
    324 	  builtin_define ("__PPC__");			\
    325 	  builtin_define ("__PPC64__");			\
    326 	  builtin_define ("__powerpc__");		\
    327 	  builtin_define ("__powerpc64__");		\
    328 	  builtin_define_with_int_value ("__PIC__", 2);	\
    329 	  builtin_assert ("cpu=powerpc64");		\
    330 	  builtin_assert ("machine=powerpc64");		\
    331 	}						\
    332       else						\
    333 	{						\
    334 	  builtin_define_std ("PPC");			\
    335 	  builtin_define_std ("powerpc");		\
    336 	  builtin_assert ("cpu=powerpc");		\
    337 	  builtin_assert ("machine=powerpc");		\
    338 	  TARGET_OS_SYSV_CPP_BUILTINS ();		\
    339 	}						\
    340     }							\
    341   while (0)
    342 
    343 /* Override the default from rs6000.h to avoid conflicts with macros
    344    defined in NetBSD header files.  */
    345 
    346 #undef  RS6000_CPU_CPP_ENDIAN_BUILTINS
    347 #define RS6000_CPU_CPP_ENDIAN_BUILTINS()	\
    348   do						\
    349     {						\
    350       builtin_define ("__BIG_ENDIAN__");	\
    351       builtin_assert ("machine=bigendian");	\
    352     }						\
    353   while (0)
    354 
    355 #undef  CPP_OS_DEFAULT_SPEC
    356 #define CPP_OS_DEFAULT_SPEC "%(cpp_os_netbsd)"
    357 
    358 #undef  LINK_SHLIB_SPEC
    359 #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
    360 
    361 #undef  LIB_DEFAULT_SPEC
    362 #define LIB_DEFAULT_SPEC "%(lib_netbsd)"
    363 
    364 #undef  STARTFILE_DEFAULT_SPEC
    365 #define STARTFILE_DEFAULT_SPEC "%(startfile_netbsd)"
    366 
    367 #undef	ENDFILE_DEFAULT_SPEC
    368 #define ENDFILE_DEFAULT_SPEC "%(endfile_netbsd)"
    369 
    370 #undef	LINK_START_DEFAULT_SPEC
    371 #define LINK_START_DEFAULT_SPEC "%(link_start_netbsd)"
    372 
    373 #undef	LINK_OS_DEFAULT_SPEC
    374 #define LINK_OS_DEFAULT_SPEC "%(link_os_netbsd)"
    375 
    376 #define LINK_OS_NETBSD_SPEC32 "-m elf32ppc %{!shared: %{!static: \
    377   %{rdynamic:-export-dynamic} \
    378   %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}}"
    379 
    380 #define LINK_OS_NETBSD_SPEC64 "-m elf64ppc %{!shared: %{!static: \
    381   %{rdynamic:-export-dynamic} \
    382   %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}}"
    383 
    384 #undef  TOC_SECTION_ASM_OP
    385 #define TOC_SECTION_ASM_OP \
    386   (TARGET_64BIT						\
    387    ? "\t.section\t\".toc\",\"aw\""			\
    388    : "\t.section\t\".got\",\"aw\"")
    389 
    390 #undef  MINIMAL_TOC_SECTION_ASM_OP
    391 #define MINIMAL_TOC_SECTION_ASM_OP \
    392   (TARGET_64BIT						\
    393    ? "\t.section\t\".toc1\",\"aw\""			\
    394    : ((TARGET_RELOCATABLE || flag_pic)			\
    395       ? "\t.section\t\".got2\",\"aw\""			\
    396       : "\t.section\t\".got1\",\"aw\""))
    397 
    398 /* Make GCC agree with <machine/ansi.h>.  */
    399 
    400 #undef	SIZE_TYPE
    401 #define	SIZE_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
    402 
    403 #undef	PTRDIFF_TYPE
    404 #define	PTRDIFF_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
    405 
    406 #undef INTPTR_TYPE
    407 #define INTPTR_TYPE PTRDIFF_TYPE
    408 
    409 #undef UINTPTR_TYPE
    410 #define UINTPTR_TYPE SIZE_TYPE
    411 
    412 #undef	WCHAR_TYPE
    413 #define	WCHAR_TYPE "int"
    414 
    415 #undef INT8_TYPE
    416 #define INT8_TYPE "signed char"
    417 
    418 #undef INT16_TYPE
    419 #define INT16_TYPE "short int"
    420 
    421 #undef INT32_TYPE
    422 #define INT32_TYPE "int"
    423 
    424 #undef INT64_TYPE
    425 #define	INT64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
    426 
    427 #undef UINT8_TYPE
    428 #define UINT8_TYPE "unsigned char"
    429 
    430 #undef UINT16_TYPE
    431 #define UINT16_TYPE "short unsigned int"
    432 
    433 #undef UINT32_TYPE
    434 #define UINT32_TYPE "unsigned int"
    435 
    436 #undef UINT64_TYPE
    437 #define	UINT64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
    438 
    439 #undef INT_FAST8_TYPE
    440 #define INT_FAST8_TYPE "int"
    441 
    442 #undef INT_FAST16_TYPE
    443 #define INT_FAST16_TYPE "int"
    444 
    445 #undef INT_FAST32_TYPE
    446 #define INT_FAST32_TYPE "int"
    447 
    448 #undef INT_FAST64_TYPE
    449 #define INT_FAST64_TYPE INT64_TYPE
    450 
    451 #undef UINT_FAST8_TYPE
    452 #define UINT_FAST8_TYPE "unsigned int"
    453 
    454 #undef UINT_FAST16_TYPE
    455 #define UINT_FAST16_TYPE "unsigned int"
    456 
    457 #undef UINT_FAST32_TYPE
    458 #define UINT_FAST32_TYPE "unsigned int"
    459 
    460 #undef UINT_FAST8_TYPE
    461 #define UINT_FAST8_TYPE "unsigned int"
    462 
    463 #undef UINT_FAST16_TYPE
    464 #define UINT_FAST16_TYPE "unsigned int"
    465 
    466 #undef UINT_FAST32_TYPE
    467 #define UINT_FAST32_TYPE "unsigned int"
    468 
    469 #undef UINT_FAST64_TYPE
    470 #define UINT_FAST64_TYPE UINT64_TYPE
    471 
    472 #undef INT_LEAST8_TYPE
    473 #define INT_LEAST8_TYPE INT8_TYPE
    474 
    475 #undef INT_LEAST16_TYPE
    476 #define INT_LEAST16_TYPE INT16_TYPE
    477 
    478 #undef INT_LEAST32_TYPE
    479 #define INT_LEAST32_TYPE "int"
    480 
    481 #undef INT_LEAST64_TYPE
    482 #define INT_LEAST64_TYPE INT64_TYPE
    483 
    484 #undef UINT_LEAST8_TYPE
    485 #define UINT_LEAST8_TYPE UINT8_TYPE
    486 
    487 #undef UINT_LEAST16_TYPE
    488 #define UINT_LEAST16_TYPE UINT16_TYPE
    489 
    490 #undef UINT_LEAST32_TYPE
    491 #define UINT_LEAST32_TYPE "unsigned int"
    492 
    493 #undef UINT_LEAST64_TYPE
    494 #define UINT_LEAST64_TYPE UINT64_TYPE
    495 
    496 #undef INTMAX_TYPE
    497 #define INTMAX_TYPE INT64_TYPE
    498 
    499 #undef UINTMAX_TYPE
    500 #define UINTMAX_TYPE UINT64_TYPE
    501 
    502 /* Override rs6000.h definition.  */
    503 #undef  ASM_APP_ON
    504 #define ASM_APP_ON "#APP\n"
    505 
    506 /* Override rs6000.h definition.  */
    507 #undef  ASM_APP_OFF
    508 #define ASM_APP_OFF "#NO_APP\n"
    509 
    510 /* PowerPC no-op instruction.  */
    511 #undef  RS6000_CALL_GLUE
    512 #define RS6000_CALL_GLUE (TARGET_64BIT ? "nop" : "cror 31,31,31")
    513 
    514 #undef  RS6000_MCOUNT
    515 #define RS6000_MCOUNT "_mcount"
    516 
    517 #ifdef __powerpc64__
    518 /* _init and _fini functions are built from bits spread across many
    519    object files, each potentially with a different TOC pointer.  For
    520    that reason, place a nop after the call so that the linker can
    521    restore the TOC pointer if a TOC adjusting call stub is needed.  */
    522 #if DOT_SYMBOLS
    523 #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)	\
    524   asm (SECTION_OP "\n"					\
    525 "	bl ." #FUNC "\n"				\
    526 "	nop\n"						\
    527 "	.previous");
    528 #else
    529 #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)	\
    530   asm (SECTION_OP "\n"					\
    531 "	bl " #FUNC "\n"					\
    532 "	nop\n"						\
    533 "	.previous");
    534 #endif
    535 #endif
    536 
    537 /* FP save and restore routines.  */
    538 #undef  SAVE_FP_PREFIX
    539 #define SAVE_FP_PREFIX (TARGET_64BIT ? "._savef" : "_savefpr_")
    540 #undef  SAVE_FP_SUFFIX
    541 #define SAVE_FP_SUFFIX (TARGET_64BIT ? "" : "_l")
    542 #undef  RESTORE_FP_PREFIX
    543 #define RESTORE_FP_PREFIX (TARGET_64BIT ? "._restf" : "_restfpr_")
    544 #undef  RESTORE_FP_SUFFIX
    545 #define RESTORE_FP_SUFFIX (TARGET_64BIT ? "" : "_l")
    546 
    547 /* Dwarf2 debugging.  */
    548 #undef  PREFERRED_DEBUGGING_TYPE
    549 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
    550 
    551 /* This is how to declare the size of a function.  */
    552 #undef	ASM_DECLARE_FUNCTION_SIZE
    553 #define	ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)			\
    554   do									\
    555     {									\
    556       if (!flag_inhibit_size_directive)					\
    557 	{								\
    558 	  fputs ("\t.size\t", (FILE));					\
    559 	  if (TARGET_64BIT && DOT_SYMBOLS)				\
    560 	    putc ('.', (FILE));						\
    561 	  assemble_name ((FILE), (FNAME));				\
    562 	  fputs (",.-", (FILE));					\
    563 	  rs6000_output_function_entry (FILE, FNAME);			\
    564 	  putc ('\n', (FILE));						\
    565 	}								\
    566     }									\
    567   while (0)
    568 
    569 /* Return nonzero if this entry is to be written into the constant
    570    pool in a special way.  We do so if this is a SYMBOL_REF, LABEL_REF
    571    or a CONST containing one of them.  If -mfp-in-toc (the default),
    572    we also do this for floating-point constants.  We actually can only
    573    do this if the FP formats of the target and host machines are the
    574    same, but we can't check that since not every file that uses
    575    the macros includes real.h.  We also do this when we can write the
    576    entry into the TOC and the entry is not larger than a TOC entry.  */
    577 
    578 #undef  ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
    579 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE)			\
    580   (TARGET_TOC								\
    581    && (GET_CODE (X) == SYMBOL_REF					\
    582        || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS	\
    583 	   && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF)		\
    584        || GET_CODE (X) == LABEL_REF					\
    585        || (GET_CODE (X) == CONST_INT 					\
    586 	   && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode))	\
    587        || (GET_CODE (X) == CONST_DOUBLE					\
    588 	   && ((TARGET_64BIT						\
    589 		&& (TARGET_MINIMAL_TOC					\
    590 		    || (SCALAR_FLOAT_MODE_P (GET_MODE (X))		\
    591 			&& ! TARGET_NO_FP_IN_TOC)))			\
    592 	       || (!TARGET_64BIT					\
    593 		   && !TARGET_NO_FP_IN_TOC				\
    594 		   && !TARGET_RELOCATABLE				\
    595 		   && SCALAR_FLOAT_MODE_P (GET_MODE (X))		\
    596 		   && BITS_PER_WORD == HOST_BITS_PER_INT)))))
    597 
    598 /* Select a format to encode pointers in exception handling data.  CODE
    599    is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
    600    true if the symbol may be affected by dynamic relocations.  */
    601 #undef	ASM_PREFERRED_EH_DATA_FORMAT
    602 #define	ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
    603   ((TARGET_64BIT || flag_pic || TARGET_RELOCATABLE)			\
    604    ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel		\
    605       | (TARGET_64BIT ? DW_EH_PE_udata8 : DW_EH_PE_sdata4))		\
    606    : DW_EH_PE_absptr)
    607 
    608 /* For backward compatibility, we must continue to use the AIX
    609    structure return convention.  */
    610 #undef DRAFT_V4_STRUCT_RET
    611 #define DRAFT_V4_STRUCT_RET (!TARGET_64BIT)
    612 
    613 #define TARGET_POSIX_IO
    614 
    615 #define LINK_GCC_C_SEQUENCE_SPEC \
    616   "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
    617 
    618 /* Use --as-needed -lgcc_s for eh support.  */
    619 #ifdef HAVE_LD_AS_NEEDED
    620 #define USE_LD_AS_NEEDED 1
    621 #endif
    622 
    623 /* NetBSD ppc64 has 128-bit long double support.  */
    624 #undef	RS6000_DEFAULT_LONG_DOUBLE_SIZE
    625 #define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128
    626 #define POWERPC_NETBSD
    627