Home | History | Annotate | Line # | Download | only in rs6000
netbsd64.h revision 1.7
      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 
    192 #ifndef	RS6000_BI_ARCH
    193 #define	ASM_DEFAULT_SPEC "-mppc64"
    194 #define	ASM_SPEC	 "%(asm_spec64) %(asm_spec_common)"
    195 #define	LINK_OS_NETBSD_SPEC "%(link_os_netbsd_spec64)"
    196 #else
    197 #if DEFAULT_ARCH64_P
    198 #define	ASM_DEFAULT_SPEC "-mppc%{!m32:64}"
    199 #define	ASM_SPEC	 "%{m32:%(asm_spec32)}%{!m32:%(asm_spec64)} %(asm_spec_common)"
    200 #define	LINK_OS_NETBSD_SPEC "%{m32:%(link_os_netbsd_spec32)}%{!m32:%(link_os_netbsd_spec64)}"
    201 #else
    202 #define	ASM_DEFAULT_SPEC "-mppc%{m64:64}"
    203 #define	ASM_SPEC	 "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)"
    204 #define	LINK_OS_NETBSD_SPEC "%{!m64:%(link_os_netbsd_spec32)}%{m64:%(link_os_netbsd_spec64)}"
    205 #endif
    206 #endif
    207 
    208 #define ASM_SPEC32 "-a32 \
    209 %{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \
    210 %{memb|msdata=eabi: -memb}"
    211 
    212 #define ASM_SPEC64 "-a64"
    213 
    214 #define ASM_SPEC_COMMON "%(asm_cpu) \
    215 %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}}" \
    216   ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
    217 
    218 #undef	SUBSUBTARGET_EXTRA_SPECS
    219 #define SUBSUBTARGET_EXTRA_SPECS \
    220   { "asm_spec_common",		ASM_SPEC_COMMON },			\
    221   { "asm_spec32",		ASM_SPEC32 },				\
    222   { "asm_spec64",		ASM_SPEC64 },				\
    223   { "link_os_netbsd_spec32",	LINK_OS_NETBSD_SPEC32 },		\
    224   { "link_os_netbsd_spec64",	LINK_OS_NETBSD_SPEC64 },
    225 
    226 #undef	MULTILIB_DEFAULTS
    227 #if DEFAULT_ARCH64_P
    228 #define MULTILIB_DEFAULTS { "m64" }
    229 #else
    230 #define MULTILIB_DEFAULTS { "m32" }
    231 #endif
    232 
    233 #ifndef RS6000_BI_ARCH
    234 
    235 /* 64-bit PowerPC NetBSD is always big-endian.  */
    236 #undef	TARGET_LITTLE_ENDIAN
    237 #define TARGET_LITTLE_ENDIAN	0
    238 
    239 /* 64-bit PowerPC NetBSD always has a TOC.  */
    240 #undef  TARGET_TOC
    241 #define	TARGET_TOC		1
    242 
    243 /* Some things from sysv4.h we don't do when 64 bit.  */
    244 #undef	TARGET_RELOCATABLE
    245 #define	TARGET_RELOCATABLE	0
    246 #undef	TARGET_EABI
    247 #define	TARGET_EABI		0
    248 #undef	TARGET_PROTOTYPE
    249 #define	TARGET_PROTOTYPE	0
    250 #undef RELOCATABLE_NEEDS_FIXUP
    251 #define RELOCATABLE_NEEDS_FIXUP 0
    252 
    253 #endif
    254 
    255 /* PowerPC64 NetBSD word-aligns FP doubles when -malign-power is given.  */
    256 #undef  ADJUST_FIELD_ALIGN
    257 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
    258   ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE)	\
    259    ? 128								\
    260    : (TARGET_64BIT							\
    261       && TARGET_ALIGN_NATURAL == 0					\
    262       && TYPE_MODE (strip_array_types (TREE_TYPE (FIELD))) == DFmode)	\
    263    ? MIN ((COMPUTED), 32)						\
    264    : (COMPUTED))
    265 
    266 /* PowerPC64 NetBSD increases natural record alignment to doubleword if
    267    the first field is an FP double, only if in power alignment mode.  */
    268 #undef  ROUND_TYPE_ALIGN
    269 #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED)			\
    270   ((TARGET_64BIT							\
    271     && (TREE_CODE (STRUCT) == RECORD_TYPE				\
    272 	|| TREE_CODE (STRUCT) == UNION_TYPE				\
    273 	|| TREE_CODE (STRUCT) == QUAL_UNION_TYPE)			\
    274     && TARGET_ALIGN_NATURAL == 0)					\
    275    ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED)	\
    276    : MAX ((COMPUTED), (SPECIFIED)))
    277 
    278 /* Use the default for compiling target libs.  */
    279 #ifdef IN_TARGET_LIBS
    280 #undef TARGET_ALIGN_NATURAL
    281 #define TARGET_ALIGN_NATURAL 1
    282 #endif
    283 
    284 /* Indicate that jump tables go in the text section.  */
    285 #undef  JUMP_TABLES_IN_TEXT_SECTION
    286 #define JUMP_TABLES_IN_TEXT_SECTION TARGET_64BIT
    287 
    288 /* The linux ppc64 ABI isn't explicit on whether aggregates smaller
    289    than a doubleword should be padded upward or downward.  You could
    290    reasonably assume that they follow the normal rules for structure
    291    layout treating the parameter area as any other block of memory,
    292    then map the reg param area to registers.  i.e. pad upward.
    293    Setting both of the following defines results in this behavior.
    294    Setting just the first one will result in aggregates that fit in a
    295    doubleword being padded downward, and others being padded upward.
    296    Not a bad idea as this results in struct { int x; } being passed
    297    the same way as an int.  */
    298 #define AGGREGATE_PADDING_FIXED TARGET_64BIT
    299 #define AGGREGATES_PAD_UPWARD_ALWAYS 0
    300 
    301 /* Specify padding for the last element of a block move between
    302    registers and memory.  FIRST is nonzero if this is the only
    303    element.  */
    304 #define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
    305   (!(FIRST) ? upward : FUNCTION_ARG_PADDING (MODE, TYPE))
    306 
    307 /* NetBSD doesn't support saving and restoring 64-bit regs in a 32-bit
    308    process.  XXXMRG?  */
    309 #define OS_MISSING_POWERPC64 !TARGET_64BIT
    310 
    311 #undef  TARGET_OS_CPP_BUILTINS
    312 #define TARGET_OS_CPP_BUILTINS()			\
    313   do							\
    314     {							\
    315       NETBSD_OS_CPP_BUILTINS_ELF();			\
    316       if (TARGET_ISEL)					\
    317 	builtin_define ("__PPC_ISEL__");		\
    318       if (TARGET_64BIT)					\
    319 	{						\
    320 	  builtin_define ("__PPC__");			\
    321 	  builtin_define ("__PPC64__");			\
    322 	  builtin_define ("__powerpc__");		\
    323 	  builtin_define ("__powerpc64__");		\
    324 	  builtin_define_with_int_value ("__PIC__", 2);	\
    325 	  builtin_assert ("cpu=powerpc64");		\
    326 	  builtin_assert ("machine=powerpc64");		\
    327 	}						\
    328       else						\
    329 	{						\
    330 	  builtin_define_std ("PPC");			\
    331 	  builtin_define_std ("powerpc");		\
    332 	  builtin_assert ("cpu=powerpc");		\
    333 	  builtin_assert ("machine=powerpc");		\
    334 	  TARGET_OS_SYSV_CPP_BUILTINS ();		\
    335 	}						\
    336     }							\
    337   while (0)
    338 
    339 /* Override the default from rs6000.h to avoid conflicts with macros
    340    defined in NetBSD header files.  */
    341 
    342 #undef  RS6000_CPU_CPP_ENDIAN_BUILTINS
    343 #define RS6000_CPU_CPP_ENDIAN_BUILTINS()	\
    344   do						\
    345     {						\
    346       builtin_define ("__BIG_ENDIAN__");	\
    347       builtin_assert ("machine=bigendian");	\
    348     }						\
    349   while (0)
    350 
    351 #undef  CPP_OS_DEFAULT_SPEC
    352 #define CPP_OS_DEFAULT_SPEC "%(cpp_os_netbsd)"
    353 
    354 #undef  LINK_SHLIB_SPEC
    355 #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
    356 
    357 #undef  LIB_DEFAULT_SPEC
    358 #define LIB_DEFAULT_SPEC "%(lib_netbsd)"
    359 
    360 #undef  STARTFILE_DEFAULT_SPEC
    361 #define STARTFILE_DEFAULT_SPEC "%(startfile_netbsd)"
    362 
    363 #undef	ENDFILE_DEFAULT_SPEC
    364 #define ENDFILE_DEFAULT_SPEC "%(endfile_netbsd)"
    365 
    366 #undef	LINK_START_DEFAULT_SPEC
    367 #define LINK_START_DEFAULT_SPEC "%(link_start_netbsd)"
    368 
    369 #undef	LINK_OS_DEFAULT_SPEC
    370 #define LINK_OS_DEFAULT_SPEC "%(link_os_netbsd)"
    371 
    372 #define LINK_OS_NETBSD_SPEC32 "-m elf32ppc %{!shared: %{!static: \
    373   %{rdynamic:-export-dynamic} \
    374   %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}}"
    375 
    376 #define LINK_OS_NETBSD_SPEC64 "-m elf64ppc %{!shared: %{!static: \
    377   %{rdynamic:-export-dynamic} \
    378   %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}}"
    379 
    380 #undef  TOC_SECTION_ASM_OP
    381 #define TOC_SECTION_ASM_OP \
    382   (TARGET_64BIT						\
    383    ? "\t.section\t\".toc\",\"aw\""			\
    384    : "\t.section\t\".got\",\"aw\"")
    385 
    386 #undef  MINIMAL_TOC_SECTION_ASM_OP
    387 #define MINIMAL_TOC_SECTION_ASM_OP \
    388   (TARGET_64BIT						\
    389    ? "\t.section\t\".toc1\",\"aw\""			\
    390    : ((TARGET_RELOCATABLE || flag_pic)			\
    391       ? "\t.section\t\".got2\",\"aw\""			\
    392       : "\t.section\t\".got1\",\"aw\""))
    393 
    394 /* Make GCC agree with <machine/ansi.h>.  */
    395 
    396 #undef	SIZE_TYPE
    397 #define	SIZE_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
    398 
    399 #undef	PTRDIFF_TYPE
    400 #define	PTRDIFF_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
    401 
    402 #undef INTPTR_TYPE
    403 #define INTPTR_TYPE PTRDIFF_TYPE
    404 
    405 #undef UINTPTR_TYPE
    406 #define UINTPTR_TYPE SIZE_TYPE
    407 
    408 #undef	WCHAR_TYPE
    409 #define	WCHAR_TYPE "int"
    410 
    411 #undef INT8_TYPE
    412 #define INT8_TYPE "signed char"
    413 
    414 #undef INT16_TYPE
    415 #define INT16_TYPE "short int"
    416 
    417 #undef INT32_TYPE
    418 #define INT32_TYPE "int"
    419 
    420 #undef INT64_TYPE
    421 #define INT64_TYPE "long long int"
    422 
    423 #undef UINT8_TYPE
    424 #define UINT8_TYPE "unsigned char"
    425 
    426 #undef UINT16_TYPE
    427 #define UINT16_TYPE "short unsigned int"
    428 
    429 #undef UINT32_TYPE
    430 #define UINT32_TYPE "unsigned int"
    431 
    432 #undef UINT64_TYPE
    433 #define UINT64_TYPE "long long unsigned int"
    434 
    435 #undef INT_FAST8_TYPE
    436 #define INT_FAST8_TYPE "int"
    437 
    438 #undef INT_FAST16_TYPE
    439 #define INT_FAST16_TYPE "int"
    440 
    441 #undef INT_FAST32_TYPE
    442 #define INT_FAST32_TYPE "int"
    443 
    444 #undef INT_FAST64_TYPE
    445 #define INT_FAST64_TYPE INT64_TYPE
    446 
    447 #undef UINT_FAST8_TYPE
    448 #define UINT_FAST8_TYPE "unsigned int"
    449 
    450 #undef UINT_FAST16_TYPE
    451 #define UINT_FAST16_TYPE "unsigned int"
    452 
    453 #undef UINT_FAST32_TYPE
    454 #define UINT_FAST32_TYPE "unsigned int"
    455 
    456 #undef UINT_FAST8_TYPE
    457 #define UINT_FAST8_TYPE "unsigned int"
    458 
    459 #undef UINT_FAST16_TYPE
    460 #define UINT_FAST16_TYPE "unsigned int"
    461 
    462 #undef UINT_FAST32_TYPE
    463 #define UINT_FAST32_TYPE "unsigned int"
    464 
    465 #undef UINT_FAST64_TYPE
    466 #define UINT_FAST64_TYPE UINT64_TYPE
    467 
    468 #undef INT_LEAST8_TYPE
    469 #define INT_LEAST8_TYPE INT8_TYPE
    470 
    471 #undef INT_LEAST16_TYPE
    472 #define INT_LEAST16_TYPE INT16_TYPE
    473 
    474 #undef INT_LEAST32_TYPE
    475 #define INT_LEAST32_TYPE "int"
    476 
    477 #undef INT_LEAST64_TYPE
    478 #define INT_LEAST64_TYPE INT64_TYPE
    479 
    480 #undef UINT_LEAST8_TYPE
    481 #define UINT_LEAST8_TYPE UINT8_TYPE
    482 
    483 #undef UINT_LEAST16_TYPE
    484 #define UINT_LEAST16_TYPE UINT16_TYPE
    485 
    486 #undef UINT_LEAST32_TYPE
    487 #define UINT_LEAST32_TYPE "unsigned int"
    488 
    489 #undef UINT_LEAST64_TYPE
    490 #define UINT_LEAST64_TYPE UINT64_TYPE
    491 
    492 #undef INTMAX_TYPE
    493 #define INTMAX_TYPE INT64_TYPE
    494 
    495 #undef UINTMAX_TYPE
    496 #define UINTMAX_TYPE UINT64_TYPE
    497 
    498 /* Override rs6000.h definition.  */
    499 #undef  ASM_APP_ON
    500 #define ASM_APP_ON "#APP\n"
    501 
    502 /* Override rs6000.h definition.  */
    503 #undef  ASM_APP_OFF
    504 #define ASM_APP_OFF "#NO_APP\n"
    505 
    506 /* PowerPC no-op instruction.  */
    507 #undef  RS6000_CALL_GLUE
    508 #define RS6000_CALL_GLUE (TARGET_64BIT ? "nop" : "cror 31,31,31")
    509 
    510 #undef  RS6000_MCOUNT
    511 #define RS6000_MCOUNT "_mcount"
    512 
    513 #ifdef __powerpc64__
    514 /* _init and _fini functions are built from bits spread across many
    515    object files, each potentially with a different TOC pointer.  For
    516    that reason, place a nop after the call so that the linker can
    517    restore the TOC pointer if a TOC adjusting call stub is needed.  */
    518 #if DOT_SYMBOLS
    519 #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)	\
    520   asm (SECTION_OP "\n"					\
    521 "	bl ." #FUNC "\n"				\
    522 "	nop\n"						\
    523 "	.previous");
    524 #else
    525 #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)	\
    526   asm (SECTION_OP "\n"					\
    527 "	bl " #FUNC "\n"					\
    528 "	nop\n"						\
    529 "	.previous");
    530 #endif
    531 #endif
    532 
    533 /* FP save and restore routines.  */
    534 #undef  SAVE_FP_PREFIX
    535 #define SAVE_FP_PREFIX (TARGET_64BIT ? "._savef" : "_savefpr_")
    536 #undef  SAVE_FP_SUFFIX
    537 #define SAVE_FP_SUFFIX (TARGET_64BIT ? "" : "_l")
    538 #undef  RESTORE_FP_PREFIX
    539 #define RESTORE_FP_PREFIX (TARGET_64BIT ? "._restf" : "_restfpr_")
    540 #undef  RESTORE_FP_SUFFIX
    541 #define RESTORE_FP_SUFFIX (TARGET_64BIT ? "" : "_l")
    542 
    543 /* Dwarf2 debugging.  */
    544 #undef  PREFERRED_DEBUGGING_TYPE
    545 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
    546 
    547 /* This is how to declare the size of a function.  */
    548 #undef	ASM_DECLARE_FUNCTION_SIZE
    549 #define	ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)			\
    550   do									\
    551     {									\
    552       if (!flag_inhibit_size_directive)					\
    553 	{								\
    554 	  fputs ("\t.size\t", (FILE));					\
    555 	  if (TARGET_64BIT && DOT_SYMBOLS)				\
    556 	    putc ('.', (FILE));						\
    557 	  assemble_name ((FILE), (FNAME));				\
    558 	  fputs (",.-", (FILE));					\
    559 	  rs6000_output_function_entry (FILE, FNAME);			\
    560 	  putc ('\n', (FILE));						\
    561 	}								\
    562     }									\
    563   while (0)
    564 
    565 /* Return nonzero if this entry is to be written into the constant
    566    pool in a special way.  We do so if this is a SYMBOL_REF, LABEL_REF
    567    or a CONST containing one of them.  If -mfp-in-toc (the default),
    568    we also do this for floating-point constants.  We actually can only
    569    do this if the FP formats of the target and host machines are the
    570    same, but we can't check that since not every file that uses
    571    the macros includes real.h.  We also do this when we can write the
    572    entry into the TOC and the entry is not larger than a TOC entry.  */
    573 
    574 #undef  ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
    575 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE)			\
    576   (TARGET_TOC								\
    577    && (GET_CODE (X) == SYMBOL_REF					\
    578        || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS	\
    579 	   && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF)		\
    580        || GET_CODE (X) == LABEL_REF					\
    581        || (GET_CODE (X) == CONST_INT 					\
    582 	   && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode))	\
    583        || (GET_CODE (X) == CONST_DOUBLE					\
    584 	   && ((TARGET_64BIT						\
    585 		&& (TARGET_MINIMAL_TOC					\
    586 		    || (SCALAR_FLOAT_MODE_P (GET_MODE (X))		\
    587 			&& ! TARGET_NO_FP_IN_TOC)))			\
    588 	       || (!TARGET_64BIT					\
    589 		   && !TARGET_NO_FP_IN_TOC				\
    590 		   && !TARGET_RELOCATABLE				\
    591 		   && SCALAR_FLOAT_MODE_P (GET_MODE (X))		\
    592 		   && BITS_PER_WORD == HOST_BITS_PER_INT)))))
    593 
    594 /* Select a format to encode pointers in exception handling data.  CODE
    595    is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
    596    true if the symbol may be affected by dynamic relocations.  */
    597 #undef	ASM_PREFERRED_EH_DATA_FORMAT
    598 #define	ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
    599   ((TARGET_64BIT || flag_pic || TARGET_RELOCATABLE)			\
    600    ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel		\
    601       | (TARGET_64BIT ? DW_EH_PE_udata8 : DW_EH_PE_sdata4))		\
    602    : DW_EH_PE_absptr)
    603 
    604 /* For backward compatibility, we must continue to use the AIX
    605    structure return convention.  */
    606 #undef DRAFT_V4_STRUCT_RET
    607 #define DRAFT_V4_STRUCT_RET (!TARGET_64BIT)
    608 
    609 #define TARGET_POSIX_IO
    610 
    611 #define LINK_GCC_C_SEQUENCE_SPEC \
    612   "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
    613 
    614 /* Use --as-needed -lgcc_s for eh support.  */
    615 #ifdef HAVE_LD_AS_NEEDED
    616 #define USE_LD_AS_NEEDED 1
    617 #endif
    618 
    619 /* NetBSD ppc64 has 128-bit long double support.  */
    620 #undef	RS6000_DEFAULT_LONG_DOUBLE_SIZE
    621 #define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128
    622 #define POWERPC_NETBSD
    623