1117395Skan/* Definitions of target machine for GNU compiler,
2117395Skan   for IBM RS/6000 POWER running AIX V5.2.
3169689Skan   Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
4117395Skan   Contributed by David Edelsohn (edelsohn@gnu.org).
5117395Skan
6132718Skan   This file is part of GCC.
7117395Skan
8132718Skan   GCC is free software; you can redistribute it and/or modify it
9132718Skan   under the terms of the GNU General Public License as published
10132718Skan   by the Free Software Foundation; either version 2, or (at your
11132718Skan   option) any later version.
12117395Skan
13132718Skan   GCC is distributed in the hope that it will be useful, but WITHOUT
14132718Skan   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15132718Skan   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
16132718Skan   License for more details.
17117395Skan
18132718Skan   You should have received a copy of the GNU General Public License
19132718Skan   along with GCC; see the file COPYING.  If not, write to the
20169689Skan   Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
21169689Skan   MA 02110-1301, USA.  */
22117395Skan
23117395Skan/* Sometimes certain combinations of command options do not make sense
24117395Skan   on a particular target machine.  You can define a macro
25117395Skan   `OVERRIDE_OPTIONS' to take account of this.  This macro, if
26117395Skan   defined, is executed once just after all the command options have
27117395Skan   been parsed.
28117395Skan
29117395Skan   The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
30117395Skan   get control.  */
31117395Skan
32117395Skan#define NON_POWERPC_MASKS (MASK_POWER | MASK_POWER2)
33117395Skan#define SUBTARGET_OVERRIDE_OPTIONS					\
34117395Skando {									\
35117395Skan  if (TARGET_64BIT && (target_flags & NON_POWERPC_MASKS))		\
36117395Skan    {									\
37117395Skan      target_flags &= ~NON_POWERPC_MASKS;				\
38169689Skan      warning (0, "-maix64 and POWER architecture are incompatible");	\
39117395Skan    }									\
40117395Skan  if (TARGET_64BIT && ! TARGET_POWERPC64)				\
41117395Skan    {									\
42117395Skan      target_flags |= MASK_POWERPC64;					\
43169689Skan      warning (0, "-maix64 requires PowerPC64 architecture remain enabled"); \
44117395Skan    }									\
45169689Skan  if (TARGET_SOFT_FLOAT && TARGET_LONG_DOUBLE_128)			\
46169689Skan    {									\
47169689Skan      rs6000_long_double_type_size = 64;				\
48169689Skan      if (rs6000_explicit_options.long_double)				\
49169689Skan	warning (0, "soft-float and long-double-128 are incompatible");	\
50169689Skan    }									\
51117395Skan  if (TARGET_POWERPC64 && ! TARGET_64BIT)				\
52117395Skan    {									\
53117395Skan      error ("-maix64 required: 64-bit computation with 32-bit addressing not yet supported"); \
54117395Skan    }									\
55117395Skan} while (0);
56117395Skan
57117395Skan#undef ASM_SPEC
58132718Skan#define ASM_SPEC "-u %{maix64:-a64 %{!mcpu*:-mppc64}} %(asm_cpu)"
59117395Skan
60132718Skan/* Common ASM definitions used by ASM_SPEC amongst the various targets
61117395Skan   for handling -mcpu=xxx switches.  */
62117395Skan#undef ASM_CPU_SPEC
63117395Skan#define ASM_CPU_SPEC \
64117395Skan"%{!mcpu*: %{!maix64: \
65117395Skan  %{mpowerpc64: -mppc64} \
66117395Skan  %{!mpower64: %(asm_default)}}} \
67132718Skan%{mcpu=power3: -m620} \
68132718Skan%{mcpu=power4: -m620} \
69169689Skan%{mcpu=power5: -m620} \
70169689Skan%{mcpu=power5+: -m620} \
71169689Skan%{mcpu=power6: -m620} \
72117395Skan%{mcpu=powerpc: -mppc} \
73117395Skan%{mcpu=rs64a: -mppc} \
74117395Skan%{mcpu=603: -m603} \
75117395Skan%{mcpu=603e: -m603} \
76117395Skan%{mcpu=604: -m604} \
77117395Skan%{mcpu=604e: -m604} \
78132718Skan%{mcpu=620: -m620} \
79169689Skan%{mcpu=630: -m620} \
80169689Skan%{mcpu=970: -m620} \
81169689Skan%{mcpu=G5: -m620}"
82117395Skan
83117395Skan#undef	ASM_DEFAULT_SPEC
84117395Skan#define ASM_DEFAULT_SPEC "-mppc"
85117395Skan
86117395Skan#undef TARGET_OS_CPP_BUILTINS
87169689Skan#define TARGET_OS_CPP_BUILTINS()     \
88169689Skan  do                                 \
89169689Skan    {                                \
90169689Skan      builtin_define ("_AIX43");     \
91169689Skan      builtin_define ("_AIX51");     \
92169689Skan      builtin_define ("_AIX52");     \
93169689Skan      TARGET_OS_AIX_CPP_BUILTINS (); \
94169689Skan    }                                \
95117395Skan  while (0)
96117395Skan
97117395Skan#undef CPP_SPEC
98117395Skan#define CPP_SPEC "%{posix: -D_POSIX_SOURCE}	\
99117395Skan  %{ansi: -D_ANSI_C_SOURCE}			\
100117395Skan  %{maix64: -D__64BIT__}			\
101117395Skan  %{mpe: -I/usr/lpp/ppe.poe/include}		\
102117395Skan  %{pthread: -D_THREAD_SAFE}"
103117395Skan
104117395Skan/* The GNU C++ standard library requires that these macros be
105169689Skan   defined.  Synchronize with libstdc++ os_defines.h.  */
106117395Skan#undef CPLUSPLUS_CPP_SPEC
107117395Skan#define CPLUSPLUS_CPP_SPEC			\
108169689Skan  "-D_ALL_SOURCE				\
109117395Skan   %{maix64: -D__64BIT__}			\
110117395Skan   %{mpe: -I/usr/lpp/ppe.poe/include}		\
111117395Skan   %{pthread: -D_THREAD_SAFE}"
112117395Skan
113117395Skan#undef  TARGET_DEFAULT
114117395Skan#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS)
115117395Skan
116117395Skan#undef  PROCESSOR_DEFAULT
117169689Skan#define PROCESSOR_DEFAULT PROCESSOR_POWER4
118117395Skan#undef  PROCESSOR_DEFAULT64
119117395Skan#define PROCESSOR_DEFAULT64 PROCESSOR_POWER4
120117395Skan
121117395Skan#undef  TARGET_POWER
122117395Skan#define TARGET_POWER 0
123117395Skan
124117395Skan/* Define this macro as a C expression for the initializer of an
125117395Skan   array of string to tell the driver program which options are
126117395Skan   defaults for this target and thus do not need to be handled
127117395Skan   specially when using `MULTILIB_OPTIONS'.
128117395Skan
129117395Skan   Do not define this macro if `MULTILIB_OPTIONS' is not defined in
130117395Skan   the target makefile fragment or if none of the options listed in
131117395Skan   `MULTILIB_OPTIONS' are set by default.  *Note Target Fragment::.  */
132117395Skan
133117395Skan#undef	MULTILIB_DEFAULTS
134117395Skan
135117395Skan#undef LIB_SPEC
136117395Skan#define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\
137117395Skan   %{p:-L/lib/profiled -L/usr/lib/profiled}\
138117395Skan   %{!maix64:%{!shared:%{g*:-lg}}}\
139117395Skan   %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\
140117395Skan   %{pthread:-lpthreads} -lc"
141117395Skan
142117395Skan#undef LINK_SPEC
143117395Skan#define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\
144117395Skan   %{static:-bnso %(link_syscalls) } %{shared:-bM:SRE %{!e:-bnoentry}}\
145117395Skan   %{!maix64:%{!shared:%{g*: %(link_libg) }}} %{maix64:-b64}\
146117395Skan   %{mpe:-binitfini:poe_remote_main}"
147117395Skan
148117395Skan#undef STARTFILE_SPEC
149117395Skan#define STARTFILE_SPEC "%{!shared:\
150117395Skan   %{maix64:%{pg:gcrt0_64%O%s}%{!pg:%{p:mcrt0_64%O%s}%{!p:crt0_64%O%s}}}\
151117395Skan   %{!maix64:\
152117395Skan     %{pthread:%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}}\
153117395Skan     %{!pthread:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}}}"
154117395Skan
155117395Skan/* AIX V5 typedefs ptrdiff_t as "long" while earlier releases used "int".  */
156117395Skan
157117395Skan#undef PTRDIFF_TYPE
158117395Skan#define PTRDIFF_TYPE "long int"
159117395Skan
160117395Skan/* Type used for wchar_t, as a string used in a declaration.  */
161117395Skan#undef  WCHAR_TYPE
162117395Skan#define WCHAR_TYPE (!TARGET_64BIT ? "short unsigned int" : "unsigned int")
163117395Skan
164117395Skan/* Width of wchar_t in bits.  */
165117395Skan#undef  WCHAR_TYPE_SIZE
166117395Skan#define WCHAR_TYPE_SIZE (!TARGET_64BIT ? 16 : 32)
167117395Skan
168117395Skan/* AIX V5 uses PowerPC nop (ori 0,0,0) instruction as call glue for PowerPC
169117395Skan   and "cror 31,31,31" for POWER architecture.  */
170117395Skan
171117395Skan#undef RS6000_CALL_GLUE
172117395Skan#define RS6000_CALL_GLUE "{cror 31,31,31|nop}"
173117395Skan
174117395Skan/* AIX 4.2 and above provides initialization and finalization function
175117395Skan   support from linker command line.  */
176117395Skan#undef HAS_INIT_SECTION
177117395Skan#define HAS_INIT_SECTION
178117395Skan
179117395Skan#undef LD_INIT_SWITCH
180117395Skan#define LD_INIT_SWITCH "-binitfini"
181132718Skan
182132718Skan/* AIX 5.2 has the float and long double forms of math functions.  */
183132718Skan#undef TARGET_C99_FUNCTIONS
184132718Skan#define TARGET_C99_FUNCTIONS  1
185132718Skan
186146895Skan#ifndef _AIX52
187146895Skanextern long long int    atoll(const char *);
188146895Skan#endif
189146895Skan
190169689Skan/* This target uses the aix64.opt file.  */
191169689Skan#define TARGET_USES_AIX64_OPT 1
192