aix52.h revision 169690
1272343Sngie/* Definitions of target machine for GNU compiler,
2272343Sngie   for IBM RS/6000 POWER running AIX V5.2.
3272343Sngie   Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
4272343Sngie   Contributed by David Edelsohn (edelsohn@gnu.org).
5272343Sngie
6272343Sngie   This file is part of GCC.
7272343Sngie
8272343Sngie   GCC is free software; you can redistribute it and/or modify it
9272343Sngie   under the terms of the GNU General Public License as published
10272343Sngie   by the Free Software Foundation; either version 2, or (at your
11272343Sngie   option) any later version.
12272343Sngie
13272343Sngie   GCC is distributed in the hope that it will be useful, but WITHOUT
14272343Sngie   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15272343Sngie   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
16272343Sngie   License for more details.
17272343Sngie
18272343Sngie   You should have received a copy of the GNU General Public License
19272343Sngie   along with GCC; see the file COPYING.  If not, write to the
20272343Sngie   Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
21272343Sngie   MA 02110-1301, USA.  */
22272343Sngie
23272343Sngie/* Sometimes certain combinations of command options do not make sense
24272343Sngie   on a particular target machine.  You can define a macro
25272343Sngie   `OVERRIDE_OPTIONS' to take account of this.  This macro, if
26272343Sngie   defined, is executed once just after all the command options have
27272343Sngie   been parsed.
28272343Sngie
29272343Sngie   The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
30272343Sngie   get control.  */
31272343Sngie
32272343Sngie#define NON_POWERPC_MASKS (MASK_POWER | MASK_POWER2)
33272343Sngie#define SUBTARGET_OVERRIDE_OPTIONS					\
34272343Sngiedo {									\
35272343Sngie  if (TARGET_64BIT && (target_flags & NON_POWERPC_MASKS))		\
36272343Sngie    {									\
37272343Sngie      target_flags &= ~NON_POWERPC_MASKS;				\
38272343Sngie      warning (0, "-maix64 and POWER architecture are incompatible");	\
39272343Sngie    }									\
40272343Sngie  if (TARGET_64BIT && ! TARGET_POWERPC64)				\
41272343Sngie    {									\
42272343Sngie      target_flags |= MASK_POWERPC64;					\
43272343Sngie      warning (0, "-maix64 requires PowerPC64 architecture remain enabled"); \
44272343Sngie    }									\
45272343Sngie  if (TARGET_SOFT_FLOAT && TARGET_LONG_DOUBLE_128)			\
46272343Sngie    {									\
47272343Sngie      rs6000_long_double_type_size = 64;				\
48272343Sngie      if (rs6000_explicit_options.long_double)				\
49272343Sngie	warning (0, "soft-float and long-double-128 are incompatible");	\
50272343Sngie    }									\
51272343Sngie  if (TARGET_POWERPC64 && ! TARGET_64BIT)				\
52272343Sngie    {									\
53272343Sngie      error ("-maix64 required: 64-bit computation with 32-bit addressing not yet supported"); \
54272343Sngie    }									\
55272343Sngie} while (0);
56272343Sngie
57272343Sngie#undef ASM_SPEC
58272343Sngie#define ASM_SPEC "-u %{maix64:-a64 %{!mcpu*:-mppc64}} %(asm_cpu)"
59272343Sngie
60272343Sngie/* Common ASM definitions used by ASM_SPEC amongst the various targets
61272343Sngie   for handling -mcpu=xxx switches.  */
62272343Sngie#undef ASM_CPU_SPEC
63272343Sngie#define ASM_CPU_SPEC \
64272343Sngie"%{!mcpu*: %{!maix64: \
65272343Sngie  %{mpowerpc64: -mppc64} \
66272343Sngie  %{!mpower64: %(asm_default)}}} \
67272343Sngie%{mcpu=power3: -m620} \
68272343Sngie%{mcpu=power4: -m620} \
69272343Sngie%{mcpu=power5: -m620} \
70272343Sngie%{mcpu=power5+: -m620} \
71272343Sngie%{mcpu=power6: -m620} \
72272343Sngie%{mcpu=powerpc: -mppc} \
73272343Sngie%{mcpu=rs64a: -mppc} \
74272343Sngie%{mcpu=603: -m603} \
75272343Sngie%{mcpu=603e: -m603} \
76272343Sngie%{mcpu=604: -m604} \
77272343Sngie%{mcpu=604e: -m604} \
78272343Sngie%{mcpu=620: -m620} \
79272343Sngie%{mcpu=630: -m620} \
80272343Sngie%{mcpu=970: -m620} \
81272343Sngie%{mcpu=G5: -m620}"
82272343Sngie
83272343Sngie#undef	ASM_DEFAULT_SPEC
84272343Sngie#define ASM_DEFAULT_SPEC "-mppc"
85272343Sngie
86272343Sngie#undef TARGET_OS_CPP_BUILTINS
87272343Sngie#define TARGET_OS_CPP_BUILTINS()     \
88272343Sngie  do                                 \
89272343Sngie    {                                \
90272343Sngie      builtin_define ("_AIX43");     \
91272343Sngie      builtin_define ("_AIX51");     \
92272343Sngie      builtin_define ("_AIX52");     \
93272343Sngie      TARGET_OS_AIX_CPP_BUILTINS (); \
94272343Sngie    }                                \
95272343Sngie  while (0)
96272343Sngie
97272343Sngie#undef CPP_SPEC
98272343Sngie#define CPP_SPEC "%{posix: -D_POSIX_SOURCE}	\
99272343Sngie  %{ansi: -D_ANSI_C_SOURCE}			\
100272343Sngie  %{maix64: -D__64BIT__}			\
101272343Sngie  %{mpe: -I/usr/lpp/ppe.poe/include}		\
102272343Sngie  %{pthread: -D_THREAD_SAFE}"
103272343Sngie
104272343Sngie/* The GNU C++ standard library requires that these macros be
105272343Sngie   defined.  Synchronize with libstdc++ os_defines.h.  */
106272343Sngie#undef CPLUSPLUS_CPP_SPEC
107272343Sngie#define CPLUSPLUS_CPP_SPEC			\
108272343Sngie  "-D_ALL_SOURCE				\
109272343Sngie   %{maix64: -D__64BIT__}			\
110272343Sngie   %{mpe: -I/usr/lpp/ppe.poe/include}		\
111272343Sngie   %{pthread: -D_THREAD_SAFE}"
112272343Sngie
113272343Sngie#undef  TARGET_DEFAULT
114272343Sngie#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS)
115272343Sngie
116272343Sngie#undef  PROCESSOR_DEFAULT
117272343Sngie#define PROCESSOR_DEFAULT PROCESSOR_POWER4
118272343Sngie#undef  PROCESSOR_DEFAULT64
119272343Sngie#define PROCESSOR_DEFAULT64 PROCESSOR_POWER4
120272343Sngie
121272343Sngie#undef  TARGET_POWER
122272343Sngie#define TARGET_POWER 0
123272343Sngie
124272343Sngie/* Define this macro as a C expression for the initializer of an
125272343Sngie   array of string to tell the driver program which options are
126272343Sngie   defaults for this target and thus do not need to be handled
127272343Sngie   specially when using `MULTILIB_OPTIONS'.
128272343Sngie
129272343Sngie   Do not define this macro if `MULTILIB_OPTIONS' is not defined in
130272343Sngie   the target makefile fragment or if none of the options listed in
131272343Sngie   `MULTILIB_OPTIONS' are set by default.  *Note Target Fragment::.  */
132272343Sngie
133272343Sngie#undef	MULTILIB_DEFAULTS
134272343Sngie
135272343Sngie#undef LIB_SPEC
136272343Sngie#define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\
137272343Sngie   %{p:-L/lib/profiled -L/usr/lib/profiled}\
138272343Sngie   %{!maix64:%{!shared:%{g*:-lg}}}\
139272343Sngie   %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\
140272343Sngie   %{pthread:-lpthreads} -lc"
141272343Sngie
142272343Sngie#undef LINK_SPEC
143272343Sngie#define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\
144272343Sngie   %{static:-bnso %(link_syscalls) } %{shared:-bM:SRE %{!e:-bnoentry}}\
145272343Sngie   %{!maix64:%{!shared:%{g*: %(link_libg) }}} %{maix64:-b64}\
146272343Sngie   %{mpe:-binitfini:poe_remote_main}"
147272343Sngie
148272343Sngie#undef STARTFILE_SPEC
149272343Sngie#define STARTFILE_SPEC "%{!shared:\
150272343Sngie   %{maix64:%{pg:gcrt0_64%O%s}%{!pg:%{p:mcrt0_64%O%s}%{!p:crt0_64%O%s}}}\
151272343Sngie   %{!maix64:\
152272343Sngie     %{pthread:%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}}\
153272343Sngie     %{!pthread:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}}}"
154272343Sngie
155272343Sngie/* AIX V5 typedefs ptrdiff_t as "long" while earlier releases used "int".  */
156272343Sngie
157272343Sngie#undef PTRDIFF_TYPE
158272343Sngie#define PTRDIFF_TYPE "long int"
159272343Sngie
160272343Sngie/* Type used for wchar_t, as a string used in a declaration.  */
161272343Sngie#undef  WCHAR_TYPE
162272343Sngie#define WCHAR_TYPE (!TARGET_64BIT ? "short unsigned int" : "unsigned int")
163272343Sngie
164272343Sngie/* Width of wchar_t in bits.  */
165272343Sngie#undef  WCHAR_TYPE_SIZE
166272343Sngie#define WCHAR_TYPE_SIZE (!TARGET_64BIT ? 16 : 32)
167272343Sngie
168272343Sngie/* AIX V5 uses PowerPC nop (ori 0,0,0) instruction as call glue for PowerPC
169272343Sngie   and "cror 31,31,31" for POWER architecture.  */
170272343Sngie
171272343Sngie#undef RS6000_CALL_GLUE
172272343Sngie#define RS6000_CALL_GLUE "{cror 31,31,31|nop}"
173272343Sngie
174272343Sngie/* AIX 4.2 and above provides initialization and finalization function
175272343Sngie   support from linker command line.  */
176272343Sngie#undef HAS_INIT_SECTION
177272343Sngie#define HAS_INIT_SECTION
178272343Sngie
179272343Sngie#undef LD_INIT_SWITCH
180272343Sngie#define LD_INIT_SWITCH "-binitfini"
181272343Sngie
182272343Sngie/* AIX 5.2 has the float and long double forms of math functions.  */
183272343Sngie#undef TARGET_C99_FUNCTIONS
184272343Sngie#define TARGET_C99_FUNCTIONS  1
185272343Sngie
186272343Sngie#ifndef _AIX52
187272343Sngieextern long long int    atoll(const char *);
188272343Sngie#endif
189272343Sngie
190272343Sngie/* This target uses the aix64.opt file.  */
191272343Sngie#define TARGET_USES_AIX64_OPT 1
192272343Sngie