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@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/* Undef gnu-user.h macros we don't want.  */
24#undef CPLUSPLUS_CPP_SPEC
25#undef LINK_GCC_C_SEQUENCE_SPEC
26
27#ifndef RS6000_BI_ARCH
28
29#undef	DEFAULT_ABI
30#define	DEFAULT_ABI ABI_AIX
31
32#undef	TARGET_64BIT
33#define	TARGET_64BIT 1
34
35#define	DEFAULT_ARCH64_P 1
36#define	RS6000_BI_ARCH_P 0
37
38#else
39
40#define	DEFAULT_ARCH64_P (TARGET_DEFAULT & MASK_64BIT)
41#define	RS6000_BI_ARCH_P 1
42
43#endif
44
45#ifdef IN_LIBGCC2
46#undef TARGET_64BIT
47#ifdef __powerpc64__
48#define TARGET_64BIT 1
49#else
50#define TARGET_64BIT 0
51#endif
52#endif
53
54#undef	TARGET_AIX
55#define	TARGET_AIX TARGET_64BIT
56
57#ifdef HAVE_LD_NO_DOT_SYMS
58/* New ABI uses a local sym for the function entry point.  */
59extern int dot_symbols;
60#undef DOT_SYMBOLS
61#define DOT_SYMBOLS dot_symbols
62#endif
63
64#define TARGET_PROFILE_KERNEL profile_kernel
65
66#define TARGET_USES_LINUX64_OPT 1
67#ifdef HAVE_LD_LARGE_TOC
68#undef TARGET_CMODEL
69#define TARGET_CMODEL rs6000_current_cmodel
70#define SET_CMODEL(opt) rs6000_current_cmodel = opt
71#else
72#define SET_CMODEL(opt) do {} while (0)
73#endif
74
75#undef  PROCESSOR_DEFAULT
76#define PROCESSOR_DEFAULT PROCESSOR_POWER4
77#undef  PROCESSOR_DEFAULT64
78#define PROCESSOR_DEFAULT64 PROCESSOR_POWER4
79
80/* We don't need to generate entries in .fixup, except when
81   -mrelocatable or -mrelocatable-lib is given.  */
82#undef RELOCATABLE_NEEDS_FIXUP
83#define RELOCATABLE_NEEDS_FIXUP \
84  (rs6000_isa_flags & rs6000_isa_flags_explicit & OPTION_MASK_RELOCATABLE)
85
86#undef	RS6000_ABI_NAME
87#define	RS6000_ABI_NAME "netbsd"
88
89#define INVALID_64BIT "-m%s not supported in this configuration"
90#define INVALID_32BIT INVALID_64BIT
91
92#define ELFv2_ABI_CHECK (rs6000_elf_abi == 2)
93
94#undef	SUBSUBTARGET_OVERRIDE_OPTIONS
95#define	SUBSUBTARGET_OVERRIDE_OPTIONS				\
96  do								\
97    {								\
98      if (!global_options_set.x_rs6000_alignment_flags)		\
99	rs6000_alignment_flags = MASK_ALIGN_NATURAL;		\
100      if (TARGET_64BIT)						\
101	{							\
102	  if (DEFAULT_ABI != ABI_AIX)				\
103	    {							\
104	      rs6000_current_abi = ABI_AIX;			\
105	      error (INVALID_64BIT, "call");			\
106	    }							\
107	  dot_symbols = !strcmp (rs6000_abi_name, "aixdesc");	\
108	  if (ELFv2_ABI_CHECK)					\
109	    {							\
110	      rs6000_current_abi = ABI_ELFv2;			\
111	      if (dot_symbols)					\
112		error ("%<-mcall-aixdesc%> incompatible with %<-mabi=elfv2%>"); \
113	    }							\
114	  if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE)	\
115	    {							\
116	      rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE;	\
117	      error (INVALID_64BIT, "relocatable");		\
118	    }							\
119	  if (ELFv2_ABI_CHECK)					\
120	    {							\
121	      rs6000_current_abi = ABI_ELFv2;			\
122	      if (dot_symbols)					\
123		error ("-mcall-aixdesc incompatible with -mabi=elfv2"); \
124	    }							\
125	  if (rs6000_isa_flags & OPTION_MASK_EABI)		\
126	    {							\
127	      rs6000_isa_flags &= ~OPTION_MASK_EABI;		\
128	      error (INVALID_64BIT, "eabi");			\
129	    }							\
130	  if (TARGET_PROTOTYPE)					\
131	    {							\
132	      target_prototype = 0;				\
133	      error (INVALID_64BIT, "prototype");		\
134	    }							\
135	  if ((rs6000_isa_flags & OPTION_MASK_POWERPC64) == 0)	\
136	    {							\
137	      rs6000_isa_flags |= OPTION_MASK_POWERPC64;	\
138	      error ("%<-m64%> requires a PowerPC64 cpu");	\
139	    }							\
140	  if ((rs6000_isa_flags_explicit			\
141	       & OPTION_MASK_MINIMAL_TOC) != 0)			\
142	    {							\
143	      if (global_options_set.x_rs6000_current_cmodel	\
144		  && rs6000_current_cmodel != CMODEL_SMALL)	\
145		error ("%<-mcmodel%> incompatible with other toc options"); \
146	      SET_CMODEL (CMODEL_SMALL);			\
147	    }							\
148	  else							\
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#undef	ASM_DEFAULT_SPEC
178#undef	ASM_SPEC
179#undef	LINK_OS_NETBSD_SPEC
180#undef	LINK_SECURE_PLT_SPEC
181
182#ifndef	RS6000_BI_ARCH
183#define	ASM_DEFAULT_SPEC "-mppc64"
184#define	ASM_SPEC	 "%(asm_spec64) %(asm_spec_common)"
185#define	LINK_OS_NETBSD_SPEC "%(link_os_netbsd_spec64)"
186#define	LINK_SECURE_PLT_SPEC ""
187#else
188#if DEFAULT_ARCH64_P
189#define	ASM_DEFAULT_SPEC "-mppc%{!m32:64}"
190#define	ASM_SPEC	 "%{m32:%(asm_spec32)}%{!m32:%(asm_spec64)} %(asm_spec_common)"
191#define	LINK_OS_NETBSD_SPEC "%{m32:%(link_os_netbsd_spec32)}%{!m32:%(link_os_netbsd_spec64)}"
192#define	LINK_SECURE_PLT_SPEC "%{m32: " LINK_SECURE_PLT_DEFAULT_SPEC "}"
193#else
194#define	ASM_DEFAULT_SPEC "-mppc%{m64:64}"
195#define	ASM_SPEC	 "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)"
196#define	LINK_OS_NETBSD_SPEC "%{!m64:%(link_os_netbsd_spec32)}%{m64:%(link_os_netbsd_spec64)}"
197#define	LINK_SECURE_PLT_SPEC "%{!m64: " LINK_SECURE_PLT_DEFAULT_SPEC "}"
198#endif
199#endif
200
201#define ASM_SPEC32 "-a32 \
202%{mrelocatable} %{mrelocatable-lib} %{" FPIE_OR_FPIC_SPEC ":-K PIC} \
203%{memb|msdata=eabi: -memb}"
204
205#define ASM_SPEC64 "-a64"
206
207#define ASM_SPEC_COMMON "%(asm_cpu) \
208%{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}}" \
209  ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
210
211#undef	SUBSUBTARGET_EXTRA_SPECS
212#define SUBSUBTARGET_EXTRA_SPECS \
213  { "asm_spec_common",		ASM_SPEC_COMMON },			\
214  { "asm_spec32",		ASM_SPEC32 },				\
215  { "asm_spec64",		ASM_SPEC64 },				\
216  { "link_os_netbsd_spec32",	LINK_OS_NETBSD_SPEC32 },		\
217  { "link_os_netbsd_spec64",	LINK_OS_NETBSD_SPEC64 },
218
219#undef	MULTILIB_DEFAULTS
220#if DEFAULT_ARCH64_P
221#define MULTILIB_DEFAULTS { "m64" }
222#else
223#define MULTILIB_DEFAULTS { "m32" }
224#endif
225
226#ifndef RS6000_BI_ARCH
227
228/* 64-bit PowerPC NetBSD is always big-endian.  */
229#undef	TARGET_LITTLE_ENDIAN
230#define TARGET_LITTLE_ENDIAN	0
231
232/* 64-bit PowerPC NetBSD always has a TOC.  */
233#undef  TARGET_TOC
234#define	TARGET_TOC		1
235
236/* Some things from sysv4.h we don't do when 64 bit.  */
237#undef	TARGET_RELOCATABLE
238#define	TARGET_RELOCATABLE	0
239#undef	TARGET_EABI
240#define	TARGET_EABI		0
241#undef	TARGET_PROTOTYPE
242#define	TARGET_PROTOTYPE	0
243#undef RELOCATABLE_NEEDS_FIXUP
244#define RELOCATABLE_NEEDS_FIXUP 0
245
246#endif
247
248/* We use NetBSD libc _mcount for profiling.  */
249#define NO_PROFILE_COUNTERS 1
250#define PROFILE_HOOK(LABEL) \
251  do { if (TARGET_64BIT) output_profile_hook (LABEL); } while (0)
252
253/* PowerPC64 NetBSD word-aligns FP doubles when -malign-power is given.  */
254#undef  ADJUST_FIELD_ALIGN
255#define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED) \
256  (rs6000_special_adjust_field_align_p ((TYPE), (COMPUTED))		\
257   ? 128								\
258   : (TARGET_64BIT							\
259      && TARGET_ALIGN_NATURAL == 0					\
260      && TYPE_MODE (strip_array_types (TYPE)) == DFmode)		\
261   ? MIN ((COMPUTED), 32)						\
262   : (COMPUTED))
263
264/* PowerPC64 NetBSD increases natural record alignment to doubleword if
265   the first field is an FP double, only if in power alignment mode.  */
266#undef  ROUND_TYPE_ALIGN
267#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED)			\
268  ((TARGET_64BIT							\
269    && (TREE_CODE (STRUCT) == RECORD_TYPE				\
270	|| TREE_CODE (STRUCT) == UNION_TYPE				\
271	|| TREE_CODE (STRUCT) == QUAL_UNION_TYPE)			\
272    && TARGET_ALIGN_NATURAL == 0)					\
273   ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED)	\
274   : MAX ((COMPUTED), (SPECIFIED)))
275
276/* Use the default for compiling target libs.  */
277#ifdef IN_TARGET_LIBS
278#undef TARGET_ALIGN_NATURAL
279#define TARGET_ALIGN_NATURAL 1
280#endif
281
282/* Indicate that jump tables go in the text section.  */
283#undef  JUMP_TABLES_IN_TEXT_SECTION
284#define JUMP_TABLES_IN_TEXT_SECTION TARGET_64BIT
285
286/* The linux ppc64 ABI isn't explicit on whether aggregates smaller
287   than a doubleword should be padded upward or downward.  You could
288   reasonably assume that they follow the normal rules for structure
289   layout treating the parameter area as any other block of memory,
290   then map the reg param area to registers.  i.e. pad upward.
291   Setting both of the following defines results in this behavior.
292   Setting just the first one will result in aggregates that fit in a
293   doubleword being padded downward, and others being padded upward.
294   Not a bad idea as this results in struct { int x; } being passed
295   the same way as an int.  */
296#define AGGREGATE_PADDING_FIXED TARGET_64BIT
297#define AGGREGATES_PAD_UPWARD_ALWAYS 0
298
299/* Specify padding for the last element of a block move between
300   registers and memory.  FIRST is nonzero if this is the only
301   element.  */
302#define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
303  (!(FIRST) ? PAD_UPWARD : targetm.calls.function_arg_padding (MODE, TYPE))
304
305/* NetBSD doesn't support saving and restoring 64-bit regs in a 32-bit
306   process.  */
307#define OS_MISSING_POWERPC64 (!TARGET_64BIT)
308
309#undef  TARGET_OS_CPP_BUILTINS
310#define TARGET_OS_CPP_BUILTINS()			\
311  do							\
312    {							\
313      NETBSD_OS_CPP_BUILTINS_ELF();			\
314      builtin_define ("__PPC__");			\
315      builtin_define ("__ppc__");			\
316      builtin_define ("__powerpc__");			\
317      if (TARGET_ISEL)					\
318	builtin_define ("__PPC_ISEL__");		\
319      if (TARGET_64BIT)					\
320	{						\
321	  builtin_define ("__arch64__");		\
322	  builtin_define ("__PPC64__");			\
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 CC1_OS_NETBSD_SPEC
352#define CC1_OS_NETBSD_SPEC \
353  NETBSD_CC1_AND_CC1PLUS_SPEC \
354  "%{!m32: %{!mrelocatable: %{!fno-pie: %{!fno-pic: \
355     %{!fpie: %{!fpic: \
356       %{!fPIE: %{!fPIC:-fPIC}}}}}}}}"
357/* %{!m32: %{!mcmodel*: -mcmodel=medium}}" */
358
359#undef CC1PLUS_SPEC
360#define CC1PLUS_SPEC CC1_OS_NETBSD_SPEC
361
362#undef  CPP_OS_DEFAULT_SPEC
363#define CPP_OS_DEFAULT_SPEC "%(cpp_os_netbsd)"
364
365#undef  LINK_SHLIB_SPEC
366#define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
367
368#undef  LIB_DEFAULT_SPEC
369#define LIB_DEFAULT_SPEC "%(lib_netbsd)"
370
371#undef  STARTFILE_DEFAULT_SPEC
372#define STARTFILE_DEFAULT_SPEC "%(startfile_netbsd)"
373
374#undef	ENDFILE_DEFAULT_SPEC
375#define ENDFILE_DEFAULT_SPEC "%(endfile_netbsd)"
376
377#undef	LINK_START_DEFAULT_SPEC
378#define LINK_START_DEFAULT_SPEC "%(link_start_netbsd)"
379
380#undef	LINK_OS_DEFAULT_SPEC
381#define LINK_OS_DEFAULT_SPEC "%(link_os_netbsd)"
382
383#define LINK_OS_NETBSD_SPEC32 "-m elf32ppc %{!shared: %{!static: \
384  %{rdynamic:-export-dynamic} \
385  %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}}"
386
387#define LINK_OS_NETBSD_SPEC64 "-m elf64ppc %{!shared: %{!static: \
388  %{rdynamic:-export-dynamic} \
389  %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}}"
390
391/* Use standard DWARF numbering for DWARF debugging information.  */
392#define RS6000_USE_DWARF_NUMBERING
393
394#undef  TOC_SECTION_ASM_OP
395#define TOC_SECTION_ASM_OP \
396  (TARGET_64BIT						\
397   ? "\t.section\t\".toc\",\"aw\""			\
398   : "\t.section\t\".got\",\"aw\"")
399
400#undef  MINIMAL_TOC_SECTION_ASM_OP
401#define MINIMAL_TOC_SECTION_ASM_OP \
402  (TARGET_64BIT						\
403   ? "\t.section\t\".toc1\",\"aw\""			\
404   : (flag_pic						\
405      ? "\t.section\t\".got2\",\"aw\""			\
406      : "\t.section\t\".got1\",\"aw\""))
407
408/* This is how to declare the size of a function.  */
409#undef  ASM_DECLARE_FUNCTION_SIZE
410#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)                    \
411  do                                                                    \
412    {                                                                   \
413      if (!flag_inhibit_size_directive)                                 \
414        {                                                               \
415          fputs ("\t.size\t", (FILE));                                  \
416          if (TARGET_64BIT && DOT_SYMBOLS)                              \
417            putc ('.', (FILE));                                         \
418          assemble_name ((FILE), (FNAME));                              \
419          fputs (",.-", (FILE));                                        \
420          rs6000_output_function_entry (FILE, FNAME);                   \
421          putc ('\n', (FILE));                                          \
422        }                                                               \
423    }                                                                   \
424  while (0)
425
426#undef  ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
427#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE)                        \
428  (TARGET_TOC                                                           \
429   && (SYMBOL_REF_P (X)							\
430       || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS      \
431           && SYMBOL_REF_P (XEXP (XEXP (X, 0), 0)))			\
432       || GET_CODE (X) == LABEL_REF                                     \
433       || (CONST_INT_P (X)						\
434           && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode))      \
435       || (CONST_DOUBLE_P (X)						\
436           && ((TARGET_64BIT                                            \
437                && (TARGET_MINIMAL_TOC                                  \
438                    || (SCALAR_FLOAT_MODE_P (GET_MODE (X))              \
439                        && ! TARGET_NO_FP_IN_TOC)))                     \
440               || (!TARGET_64BIT                                        \
441                   && !TARGET_NO_FP_IN_TOC                              \
442                   && SCALAR_FLOAT_MODE_P (GET_MODE (X))                \
443                   && BITS_PER_WORD == HOST_BITS_PER_INT)))))
444
445/* Make GCC agree with <machine/ansi.h>.  */
446
447#undef	SIZE_TYPE
448#define	SIZE_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
449
450#undef	PTRDIFF_TYPE
451#define	PTRDIFF_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
452
453#undef INTPTR_TYPE
454#define INTPTR_TYPE PTRDIFF_TYPE
455
456#undef UINTPTR_TYPE
457#define UINTPTR_TYPE SIZE_TYPE
458
459#undef	WCHAR_TYPE
460#define	WCHAR_TYPE "int"
461
462#undef INT8_TYPE
463#define INT8_TYPE "signed char"
464
465#undef INT16_TYPE
466#define INT16_TYPE "short int"
467
468#undef INT32_TYPE
469#define INT32_TYPE "int"
470
471#undef INT64_TYPE
472#define	INT64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
473
474#undef UINT8_TYPE
475#define UINT8_TYPE "unsigned char"
476
477#undef UINT16_TYPE
478#define UINT16_TYPE "short unsigned int"
479
480#undef UINT32_TYPE
481#define UINT32_TYPE "unsigned int"
482
483#undef UINT64_TYPE
484#define	UINT64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
485
486#undef INT_FAST8_TYPE
487#define INT_FAST8_TYPE "int"
488
489#undef INT_FAST16_TYPE
490#define INT_FAST16_TYPE "int"
491
492#undef INT_FAST32_TYPE
493#define INT_FAST32_TYPE "int"
494
495#undef INT_FAST64_TYPE
496#define INT_FAST64_TYPE INT64_TYPE
497
498#undef UINT_FAST8_TYPE
499#define UINT_FAST8_TYPE "unsigned int"
500
501#undef UINT_FAST16_TYPE
502#define UINT_FAST16_TYPE "unsigned int"
503
504#undef UINT_FAST32_TYPE
505#define UINT_FAST32_TYPE "unsigned int"
506
507#undef UINT_FAST8_TYPE
508#define UINT_FAST8_TYPE "unsigned int"
509
510#undef UINT_FAST16_TYPE
511#define UINT_FAST16_TYPE "unsigned int"
512
513#undef UINT_FAST32_TYPE
514#define UINT_FAST32_TYPE "unsigned int"
515
516#undef UINT_FAST64_TYPE
517#define UINT_FAST64_TYPE UINT64_TYPE
518
519#undef INT_LEAST8_TYPE
520#define INT_LEAST8_TYPE INT8_TYPE
521
522#undef INT_LEAST16_TYPE
523#define INT_LEAST16_TYPE INT16_TYPE
524
525#undef INT_LEAST32_TYPE
526#define INT_LEAST32_TYPE "int"
527
528#undef INT_LEAST64_TYPE
529#define INT_LEAST64_TYPE INT64_TYPE
530
531#undef UINT_LEAST8_TYPE
532#define UINT_LEAST8_TYPE UINT8_TYPE
533
534#undef UINT_LEAST16_TYPE
535#define UINT_LEAST16_TYPE UINT16_TYPE
536
537#undef UINT_LEAST32_TYPE
538#define UINT_LEAST32_TYPE "unsigned int"
539
540#undef UINT_LEAST64_TYPE
541#define UINT_LEAST64_TYPE UINT64_TYPE
542
543#undef INTMAX_TYPE
544#define INTMAX_TYPE INT64_TYPE
545
546#undef UINTMAX_TYPE
547#define UINTMAX_TYPE UINT64_TYPE
548
549#if 0
550/* Override rs6000.h definition.  */
551#undef  ASM_APP_ON
552#define ASM_APP_ON "#APP\n"
553
554/* Override rs6000.h definition.  */
555#undef  ASM_APP_OFF
556#define ASM_APP_OFF "#NO_APP\n"
557#endif
558
559#undef  RS6000_MCOUNT
560#define RS6000_MCOUNT "_mcount"
561
562#ifdef __powerpc64__
563/* _init and _fini functions are built from bits spread across many
564   object files, each potentially with a different TOC pointer.  For
565   that reason, place a nop after the call so that the linker can
566   restore the TOC pointer if a TOC adjusting call stub is needed.  */
567#if DOT_SYMBOLS
568#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)	\
569  asm (SECTION_OP "\n"					\
570"	bl ." #FUNC "\n"				\
571"	nop\n"						\
572"	.previous");
573#else
574#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)	\
575  asm (SECTION_OP "\n"					\
576"	bl " #FUNC "\n"					\
577"	nop\n"						\
578"	.previous");
579#endif
580#endif
581
582/* FP save and restore routines.  */
583#undef  SAVE_FP_PREFIX
584#define SAVE_FP_PREFIX (TARGET_64BIT ? "._savef" : "_savefpr_")
585#undef  RESTORE_FP_PREFIX
586#define RESTORE_FP_PREFIX (TARGET_64BIT ? "._restf" : "_restfpr_")
587
588/* For backward compatibility, we must continue to use the AIX
589   structure return convention.  */
590#undef DRAFT_V4_STRUCT_RET
591#define DRAFT_V4_STRUCT_RET (!TARGET_64BIT)
592
593/* Use --as-needed -lgcc_s for eh support.  */
594#ifdef HAVE_LD_AS_NEEDED
595#define USE_LD_AS_NEEDED 1
596#endif
597
598/*
599 * NetBSD ppc64 used to have 128-bit long double support.
600 * But it does not work anymore:
601 * (insn 23 22 24 5 (set (reg:CCFP 179)
602 *	 (compare:CCFP (reg/v:TF 171 [ a ])
603 * 		     (reg:TF 177)))
604 *  "/usr/src/sys/external/bsd/compiler_rt/dist/lib/builtins/fixxfti.c":43 -1
605 */
606#undef	RS6000_DEFAULT_LONG_DOUBLE_SIZE
607#define RS6000_DEFAULT_LONG_DOUBLE_SIZE 64
608
609#define POWERPC_NETBSD
610
611/* The IEEE 128-bit emulator is only built on Linux systems.  Flag that we
612   should enable the type handling for KFmode on VSX systems even if we are not
613   enabling the __float128 keyword.  */
614#undef	TARGET_FLOAT128_ENABLE_TYPE
615#define TARGET_FLOAT128_ENABLE_TYPE 1
616