190075Sobrien/* Definitions of target machine for GNU compiler,
290075Sobrien   for IBM RS/6000 POWER running AIX V5.
3169689Skan   Copyright (C) 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
490075Sobrien   Contributed by David Edelsohn (edelsohn@gnu.org).
590075Sobrien
6132718Skan   This file is part of GCC.
790075Sobrien
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.
1290075Sobrien
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.
1790075Sobrien
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.  */
2290075Sobrien
2390075Sobrien/* Sometimes certain combinations of command options do not make sense
2490075Sobrien   on a particular target machine.  You can define a macro
2590075Sobrien   `OVERRIDE_OPTIONS' to take account of this.  This macro, if
2690075Sobrien   defined, is executed once just after all the command options have
2790075Sobrien   been parsed.
2890075Sobrien
2990075Sobrien   The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
3090075Sobrien   get control.  */
3190075Sobrien
3290075Sobrien#define NON_POWERPC_MASKS (MASK_POWER | MASK_POWER2)
3390075Sobrien#define SUBTARGET_OVERRIDE_OPTIONS					\
3490075Sobriendo {									\
3590075Sobrien  if (TARGET_64BIT && (target_flags & NON_POWERPC_MASKS))		\
3690075Sobrien    {									\
3790075Sobrien      target_flags &= ~NON_POWERPC_MASKS;				\
38169689Skan      warning (0, "-maix64 and POWER architecture are incompatible");	\
3990075Sobrien    }									\
4090075Sobrien  if (TARGET_64BIT && ! TARGET_POWERPC64)				\
4190075Sobrien    {									\
4290075Sobrien      target_flags |= MASK_POWERPC64;					\
43169689Skan      warning (0, "-maix64 requires PowerPC64 architecture remain enabled"); \
4490075Sobrien    }									\
4590075Sobrien  if (TARGET_POWERPC64 && ! TARGET_64BIT)				\
4690075Sobrien    {									\
4790075Sobrien      error ("-maix64 required: 64-bit computation with 32-bit addressing not yet supported"); \
4890075Sobrien    }									\
4990075Sobrien} while (0);
5090075Sobrien
5190075Sobrien#undef ASM_SPEC
52132718Skan#define ASM_SPEC "-u %{maix64:-a64 %{!mcpu*:-mppc64}} %(asm_cpu)"
5390075Sobrien
54132718Skan/* Common ASM definitions used by ASM_SPEC amongst the various targets
5590075Sobrien   for handling -mcpu=xxx switches.  */
5690075Sobrien#undef ASM_CPU_SPEC
5790075Sobrien#define ASM_CPU_SPEC \
5890075Sobrien"%{!mcpu*: %{!maix64: \
5990075Sobrien  %{mpower: %{!mpower2: -mpwr}} \
6090075Sobrien  %{mpower2: -mpwr2} \
6190075Sobrien  %{mpowerpc*: %{!mpowerpc64: -mppc}} \
6290075Sobrien  %{mpowerpc64: -mppc64} \
6390075Sobrien  %{!mpower*: %{!mpowerpc*: %(asm_default)}}}} \
6490075Sobrien%{mcpu=common: -mcom} \
6590075Sobrien%{mcpu=power: -mpwr} \
6690075Sobrien%{mcpu=power2: -mpwr2} \
67132718Skan%{mcpu=power3: -m620} \
68132718Skan%{mcpu=power4: -m620} \
6990075Sobrien%{mcpu=powerpc: -mppc} \
7090075Sobrien%{mcpu=rios: -mpwr} \
7190075Sobrien%{mcpu=rios1: -mpwr} \
7290075Sobrien%{mcpu=rios2: -mpwr2} \
7390075Sobrien%{mcpu=rsc: -mpwr} \
7490075Sobrien%{mcpu=rsc1: -mpwr} \
7590075Sobrien%{mcpu=rs64a: -mppc} \
7690075Sobrien%{mcpu=601: -m601} \
7790075Sobrien%{mcpu=602: -mppc} \
7890075Sobrien%{mcpu=603: -m603} \
7990075Sobrien%{mcpu=603e: -m603} \
8090075Sobrien%{mcpu=604: -m604} \
8190075Sobrien%{mcpu=604e: -m604} \
82132718Skan%{mcpu=620: -m620} \
83169689Skan%{mcpu=630: -m620} \
84169689Skan%{mcpu=970: -m620} \
85169689Skan%{mcpu=G5: -m620}"
8690075Sobrien
8790075Sobrien#undef	ASM_DEFAULT_SPEC
8890075Sobrien#define ASM_DEFAULT_SPEC "-mcom"
8990075Sobrien
90117395Skan#undef TARGET_OS_CPP_BUILTINS
91169689Skan#define TARGET_OS_CPP_BUILTINS()     \
92169689Skan  do                                 \
93169689Skan    {                                \
94169689Skan      builtin_define ("_AIX43");     \
95169689Skan      builtin_define ("_AIX51");     \
96169689Skan      TARGET_OS_AIX_CPP_BUILTINS (); \
97169689Skan    }                                \
98117395Skan  while (0)
9990075Sobrien
10090075Sobrien#undef CPP_SPEC
101117395Skan#define CPP_SPEC "%{posix: -D_POSIX_SOURCE}	\
102117395Skan  %{ansi: -D_ANSI_C_SOURCE}			\
103117395Skan  %{maix64: -D__64BIT__}			\
104117395Skan  %{mpe: -I/usr/lpp/ppe.poe/include}		\
105117395Skan  %{pthread: -D_THREAD_SAFE}"
10690075Sobrien
10790075Sobrien/* The GNU C++ standard library requires that these macros be
10890075Sobrien   defined.  */
10990075Sobrien#undef CPLUSPLUS_CPP_SPEC
110117395Skan#define CPLUSPLUS_CPP_SPEC			\
111169689Skan  "-D_ALL_SOURCE				\
112117395Skan   %{maix64: -D__64BIT__}			\
113117395Skan   %{mpe: -I/usr/lpp/ppe.poe/include}		\
114117395Skan   %{pthread: -D_THREAD_SAFE}"
11590075Sobrien
11690075Sobrien#undef TARGET_DEFAULT
11790075Sobrien#define TARGET_DEFAULT MASK_NEW_MNEMONICS
11890075Sobrien
11990075Sobrien#undef PROCESSOR_DEFAULT
120117395Skan#define PROCESSOR_DEFAULT PROCESSOR_PPC604e
12190075Sobrien
12290075Sobrien/* Define this macro as a C expression for the initializer of an
12390075Sobrien   array of string to tell the driver program which options are
12490075Sobrien   defaults for this target and thus do not need to be handled
12590075Sobrien   specially when using `MULTILIB_OPTIONS'.
12690075Sobrien
12790075Sobrien   Do not define this macro if `MULTILIB_OPTIONS' is not defined in
12890075Sobrien   the target makefile fragment or if none of the options listed in
12990075Sobrien   `MULTILIB_OPTIONS' are set by default.  *Note Target Fragment::.  */
13090075Sobrien
13190075Sobrien#undef	MULTILIB_DEFAULTS
13290075Sobrien#define	MULTILIB_DEFAULTS { "mcpu=common" }
13390075Sobrien
13490075Sobrien#undef LIB_SPEC
13590075Sobrien#define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\
13690075Sobrien   %{p:-L/lib/profiled -L/usr/lib/profiled}\
13790075Sobrien   %{!maix64:%{!shared:%{g*:-lg}}}\
13890075Sobrien   %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\
13990075Sobrien   %{pthread:-lpthreads} -lc"
14090075Sobrien
14190075Sobrien#undef LINK_SPEC
14290075Sobrien#define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\
14390075Sobrien   %{static:-bnso %(link_syscalls) } %{shared:-bM:SRE %{!e:-bnoentry}}\
144102780Skan   %{!maix64:%{!shared:%{g*: %(link_libg) }}} %{maix64:-b64}\
145102780Skan   %{mpe:-binitfini:poe_remote_main}"
14690075Sobrien
14790075Sobrien#undef STARTFILE_SPEC
14890075Sobrien#define STARTFILE_SPEC "%{!shared:\
149102780Skan   %{maix64:%{pg:gcrt0_64%O%s}%{!pg:%{p:mcrt0_64%O%s}%{!p:crt0_64%O%s}}}\
150102780Skan   %{!maix64:\
151102780Skan     %{pthread:%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}}\
152102780Skan     %{!pthread:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}}}"
15390075Sobrien
15490075Sobrien/* AIX V5 typedefs ptrdiff_t as "long" while earlier releases used "int".  */
15590075Sobrien
15690075Sobrien#undef PTRDIFF_TYPE
15790075Sobrien#define PTRDIFF_TYPE "long int"
15890075Sobrien
15996263Sobrien/* Type used for wchar_t, as a string used in a declaration.  */
16096263Sobrien#undef  WCHAR_TYPE
16196263Sobrien#define WCHAR_TYPE (!TARGET_64BIT ? "short unsigned int" : "unsigned int")
16296263Sobrien
16390075Sobrien/* Width of wchar_t in bits.  */
16496263Sobrien#undef  WCHAR_TYPE_SIZE
16590075Sobrien#define WCHAR_TYPE_SIZE (!TARGET_64BIT ? 16 : 32)
16690075Sobrien
16790075Sobrien/* AIX V5 uses PowerPC nop (ori 0,0,0) instruction as call glue for PowerPC
16890075Sobrien   and "cror 31,31,31" for POWER architecture.  */
16990075Sobrien
17090075Sobrien#undef RS6000_CALL_GLUE
17190075Sobrien#define RS6000_CALL_GLUE "{cror 31,31,31|nop}"
17290075Sobrien
17390075Sobrien/* AIX 4.2 and above provides initialization and finalization function
17490075Sobrien   support from linker command line.  */
17590075Sobrien#undef HAS_INIT_SECTION
17690075Sobrien#define HAS_INIT_SECTION
17790075Sobrien
17890075Sobrien#undef LD_INIT_SWITCH
17990075Sobrien#define LD_INIT_SWITCH "-binitfini"
180132718Skan
181169689Skan/* This target uses the aix64.opt file.  */
182169689Skan#define TARGET_USES_AIX64_OPT 1
183