xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/config/rs6000/netbsd.h (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1 /* Definitions of target machine for GNU compiler,
2    for PowerPC NetBSD systems.
3    Copyright (C) 2002-2015 Free Software Foundation, Inc.
4    Contributed by Wasabi Systems, Inc.
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 3, 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 COPYING3.  If not see
20    <http://www.gnu.org/licenses/>.  */
21 
22 #undef  TARGET_OS_CPP_BUILTINS	/* FIXME: sysv4.h should not define this! */
23 #define TARGET_OS_CPP_BUILTINS()		\
24   do						\
25     {						\
26       NETBSD_OS_CPP_BUILTINS_ELF();		\
27       builtin_define ("__powerpc__");		\
28       builtin_assert ("cpu=powerpc");		\
29       builtin_assert ("machine=powerpc");	\
30       if (TARGET_SECURE_PLT)			\
31         builtin_define ("_SECURE_PLT");		\
32       if (TARGET_SOFT_FLOAT)			\
33         builtin_define ("_SOFT_FLOAT");		\
34       if (TARGET_ISEL)				\
35         builtin_define ("__PPC_ISEL__");	\
36     }						\
37   while (0)
38 
39 /* Override the default from rs6000.h to avoid conflicts with macros
40    defined in NetBSD header files.  */
41 
42 #undef  RS6000_CPU_CPP_ENDIAN_BUILTINS
43 #define RS6000_CPU_CPP_ENDIAN_BUILTINS()	\
44   do						\
45     {						\
46       if (BYTES_BIG_ENDIAN)			\
47 	{					\
48 	  builtin_define ("__BIG_ENDIAN__");	\
49 	  builtin_assert ("machine=bigendian");	\
50 	}					\
51       else					\
52 	{					\
53 	  builtin_define ("__LITTLE_ENDIAN__");	\
54 	  builtin_assert ("machine=littleendian"); \
55 	}					\
56     }						\
57   while (0)
58 
59 /* Make GCC agree with <machine/ansi.h>.  */
60 
61 #undef  SIZE_TYPE
62 #define SIZE_TYPE "unsigned int"
63 
64 #undef  PTRDIFF_TYPE
65 #define PTRDIFF_TYPE "int"
66 
67 /* Redefine some types that where redefined by rs6000 include files.  */
68 
69 #undef WCHAR_TYPE
70 #define WCHAR_TYPE "int"
71 
72 #undef WCHAR_TYPE_SIZE
73 #define WCHAR_TYPE_SIZE 32
74 
75 #undef WINT_TYPE
76 #define WINT_TYPE "int"
77 
78 #undef INT64_TYPE
79 #define INT64_TYPE "long long int"
80 
81 #undef UINT64_TYPE
82 #define UINT64_TYPE "long long unsigned int"
83 
84 #undef INTMAX_TYPE
85 #define INTMAX_TYPE "long long int"
86 
87 #undef UINTMAX_TYPE
88 #define UINTMAX_TYPE "long long unsigned int"
89 
90 /* Undo the spec mess from sysv4.h, and just define the specs
91    the way NetBSD systems actually expect.  */
92 
93 #undef  CPP_SPEC
94 #define CPP_SPEC NETBSD_CPP_SPEC
95 
96 #undef  LINK_SPEC
97 #define LINK_SPEC \
98   "%{!msdata=none:%{G*}} %{msdata=none:-G0} \
99    %(netbsd_link_spec)"
100 
101 #define NETBSD_ENTRY_POINT "_start"
102 
103 #undef  STARTFILE_SPEC
104 #define STARTFILE_SPEC NETBSD_STARTFILE_SPEC
105 
106 #undef  ENDFILE_SPEC
107 #define ENDFILE_SPEC NETBSD_ENDFILE_SPEC
108 
109 #undef  LIB_SPEC
110 #define LIB_SPEC NETBSD_LIB_SPEC
111 
112 #undef  SUBTARGET_EXTRA_SPECS
113 #define SUBTARGET_EXTRA_SPECS					\
114   { "cc1_secure_plt_default",	CC1_SECURE_PLT_DEFAULT_SPEC },	\
115   NETBSD_SUBTARGET_EXTRA_SPECS
116 
117 /*
118  * Add NetBSD specific defaults: -mstrict-align
119  */
120 #undef TARGET_DEFAULT
121 #define TARGET_DEFAULT (MASK_STRICT_ALIGN)
122 
123 /*
124  * We know we have the right binutils for this (we shouldn't need to do this
125  * but until the cross build does the right thing...)
126  */
127 #undef TARGET_SECURE_PLT
128 #define TARGET_SECURE_PLT secure_plt
129 #undef HAVE_AS_TLS
130 #define HAVE_AS_TLS 1
131 #define POWERPC_NETBSD
132 
133 /* Attempt to enable execute permissions on the stack.  */
134 //#define TRANSFER_FROM_TRAMPOLINE NETBSD_ENABLE_EXECUTE_STACK
135 // XXXMRG use enable-execute-stack-mprotect.c ?
136 #ifdef L_trampoline
137 #undef TRAMPOLINE_SIZE
138 #define TRAMPOLINE_SIZE 48
139 #endif
140 
141 /* Override STACK_BOUNDARY to use Altivec compliant one.  */
142 #undef STACK_BOUNDARY
143 #define STACK_BOUNDARY	128
144 
145 /* Use standard DWARF numbering for DWARF debugging information.  */
146 #define RS6000_USE_DWARF_NUMBERING
147 
148