190075Sobrien/* Definitions of target machine for GNU compiler,
290075Sobrien   for IBM RS/6000 POWER running AIX version 4.3.
3169689Skan   Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006
4169689Skan   Free Software Foundation, Inc.
590075Sobrien   Contributed by David Edelsohn (edelsohn@gnu.org).
690075Sobrien
7132718Skan   This file is part of GCC.
890075Sobrien
9132718Skan   GCC is free software; you can redistribute it and/or modify it
10132718Skan   under the terms of the GNU General Public License as published
11132718Skan   by the Free Software Foundation; either version 2, or (at your
12132718Skan   option) any later version.
1390075Sobrien
14132718Skan   GCC is distributed in the hope that it will be useful, but WITHOUT
15132718Skan   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16132718Skan   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
17132718Skan   License for more details.
1890075Sobrien
19132718Skan   You should have received a copy of the GNU General Public License
20132718Skan   along with GCC; see the file COPYING.  If not, write to the
21169689Skan   Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
22169689Skan   MA 02110-1301, USA.  */
2390075Sobrien
2490075Sobrien/* Sometimes certain combinations of command options do not make sense
2590075Sobrien   on a particular target machine.  You can define a macro
2690075Sobrien   `OVERRIDE_OPTIONS' to take account of this.  This macro, if
2790075Sobrien   defined, is executed once just after all the command options have
2890075Sobrien   been parsed.
2990075Sobrien
3090075Sobrien   The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
3190075Sobrien   get control.  */
3290075Sobrien
3390075Sobrien#define NON_POWERPC_MASKS (MASK_POWER | MASK_POWER2)
3490075Sobrien#define SUBTARGET_OVERRIDE_OPTIONS					\
3590075Sobriendo {									\
3690075Sobrien  if (TARGET_64BIT && (target_flags & NON_POWERPC_MASKS))		\
3790075Sobrien    {									\
3890075Sobrien      target_flags &= ~NON_POWERPC_MASKS;				\
39169689Skan      warning (0, "-maix64 and POWER architecture are incompatible");	\
4090075Sobrien    }									\
4190075Sobrien  if (TARGET_64BIT && ! TARGET_POWERPC64)				\
4290075Sobrien    {									\
4390075Sobrien      target_flags |= MASK_POWERPC64;					\
44169689Skan      warning (0, "-maix64 requires PowerPC64 architecture remain enabled"); \
4590075Sobrien    }									\
46169689Skan  if (TARGET_SOFT_FLOAT && TARGET_LONG_DOUBLE_128)			\
47169689Skan    {									\
48169689Skan      rs6000_long_double_type_size = 64;				\
49169689Skan      if (rs6000_explicit_options.long_double)				\
50169689Skan	warning (0, "soft-float and long-double-128 are incompatible");	\
51169689Skan    }									\
5290075Sobrien  if (TARGET_POWERPC64 && ! TARGET_64BIT)				\
5390075Sobrien    {									\
5490075Sobrien      error ("-maix64 required: 64-bit computation with 32-bit addressing not yet supported"); \
5590075Sobrien    }									\
5690075Sobrien} while (0);
5790075Sobrien
5890075Sobrien#undef ASM_SPEC
59132718Skan#define ASM_SPEC "-u %{maix64:-a64 %{!mcpu*:-mppc64}} %(asm_cpu)"
6090075Sobrien
61132718Skan/* Common ASM definitions used by ASM_SPEC amongst the various targets
6290075Sobrien   for handling -mcpu=xxx switches.  */
6390075Sobrien#undef ASM_CPU_SPEC
6490075Sobrien#define ASM_CPU_SPEC \
6590075Sobrien"%{!mcpu*: %{!maix64: \
6690075Sobrien  %{mpower: %{!mpower2: -mpwr}} \
6790075Sobrien  %{mpower2: -mpwr2} \
6890075Sobrien  %{mpowerpc*: %{!mpowerpc64: -mppc}} \
6990075Sobrien  %{mpowerpc64: -mppc64} \
7090075Sobrien  %{!mpower*: %{!mpowerpc*: %(asm_default)}}}} \
7190075Sobrien%{mcpu=common: -mcom} \
7290075Sobrien%{mcpu=power: -mpwr} \
7390075Sobrien%{mcpu=power2: -mpwr2} \
74132718Skan%{mcpu=power3: -m620} \
75132718Skan%{mcpu=power4: -m620} \
7690075Sobrien%{mcpu=powerpc: -mppc} \
7790075Sobrien%{mcpu=rios: -mpwr} \
7890075Sobrien%{mcpu=rios1: -mpwr} \
7990075Sobrien%{mcpu=rios2: -mpwr2} \
8090075Sobrien%{mcpu=rsc: -mpwr} \
8190075Sobrien%{mcpu=rsc1: -mpwr} \
8290075Sobrien%{mcpu=rs64a: -mppc} \
8390075Sobrien%{mcpu=601: -m601} \
8490075Sobrien%{mcpu=602: -mppc} \
8590075Sobrien%{mcpu=603: -m603} \
8690075Sobrien%{mcpu=603e: -m603} \
8790075Sobrien%{mcpu=604: -m604} \
8890075Sobrien%{mcpu=604e: -m604} \
89132718Skan%{mcpu=620: -m620} \
90132718Skan%{mcpu=630: -m620}"
9190075Sobrien
9290075Sobrien#undef	ASM_DEFAULT_SPEC
9390075Sobrien#define ASM_DEFAULT_SPEC "-mcom"
9490075Sobrien
95117395Skan#undef TARGET_OS_CPP_BUILTINS
96169689Skan#define TARGET_OS_CPP_BUILTINS()     \
97169689Skan  do                                 \
98169689Skan    {                                \
99169689Skan      builtin_define ("_AIX43");     \
100169689Skan      TARGET_OS_AIX_CPP_BUILTINS (); \
101169689Skan    }                                \
102117395Skan  while (0)
10390075Sobrien
10490075Sobrien#undef CPP_SPEC
10590075Sobrien#define CPP_SPEC "%{posix: -D_POSIX_SOURCE}\
10690075Sobrien   %{ansi: -D_ANSI_C_SOURCE}\
107117395Skan   %{maix64: -D__64BIT__}\
10890075Sobrien   %{mpe: -I/usr/lpp/ppe.poe/include}\
109117395Skan   %{pthread: -D_THREAD_SAFE}"
11090075Sobrien
11190075Sobrien/* The GNU C++ standard library requires that these macros be
11290075Sobrien   defined.  */
11390075Sobrien#undef CPLUSPLUS_CPP_SPEC
11490075Sobrien#define CPLUSPLUS_CPP_SPEC			\
115169689Skan  "-D_ALL_SOURCE				\
116117395Skan   %{maix64: -D__64BIT__}			\
117117395Skan   %{mpe: -I/usr/lpp/ppe.poe/include}		\
118117395Skan   %{pthread: -D_THREAD_SAFE}"
11990075Sobrien
12090075Sobrien#undef TARGET_DEFAULT
12190075Sobrien#define TARGET_DEFAULT MASK_NEW_MNEMONICS
12290075Sobrien
12390075Sobrien#undef PROCESSOR_DEFAULT
124117395Skan#define PROCESSOR_DEFAULT PROCESSOR_PPC604e
12590075Sobrien
12690075Sobrien/* Define this macro as a C expression for the initializer of an
12790075Sobrien   array of string to tell the driver program which options are
12890075Sobrien   defaults for this target and thus do not need to be handled
12990075Sobrien   specially when using `MULTILIB_OPTIONS'.
13090075Sobrien
13190075Sobrien   Do not define this macro if `MULTILIB_OPTIONS' is not defined in
13290075Sobrien   the target makefile fragment or if none of the options listed in
13390075Sobrien   `MULTILIB_OPTIONS' are set by default.  *Note Target Fragment::.  */
13490075Sobrien
13590075Sobrien#undef	MULTILIB_DEFAULTS
13690075Sobrien#define	MULTILIB_DEFAULTS { "mcpu=common" }
13790075Sobrien
13890075Sobrien#undef LIB_SPEC
13990075Sobrien#define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\
14090075Sobrien   %{p:-L/lib/profiled -L/usr/lib/profiled}\
14190075Sobrien   %{!maix64:%{!shared:%{g*:-lg}}}\
14290075Sobrien   %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\
14390075Sobrien   %{pthread:-L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a}\
14490075Sobrien   %{!pthread:-lc}"
14590075Sobrien
14690075Sobrien#undef LINK_SPEC
14790075Sobrien#define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\
14890075Sobrien   %{static:-bnso %(link_syscalls) } %{shared:-bM:SRE %{!e:-bnoentry}}\
149102780Skan   %{!maix64:%{!shared:%{g*: %(link_libg) }}} %{maix64:-b64}\
150102780Skan   %{mpe:-binitfini:poe_remote_main}"
15190075Sobrien
15290075Sobrien#undef STARTFILE_SPEC
15390075Sobrien#define STARTFILE_SPEC "%{!shared:\
154102780Skan   %{maix64:%{pg:gcrt0_64%O%s}%{!pg:%{p:mcrt0_64%O%s}%{!p:crt0_64%O%s}}}\
155102780Skan   %{!maix64:\
156102780Skan     %{pthread:%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}}\
157102780Skan     %{!pthread:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}}}"
15890075Sobrien
15990075Sobrien/* AIX 4.3 typedefs ptrdiff_t as "long" while earlier releases used "int".  */
16090075Sobrien
16190075Sobrien#undef PTRDIFF_TYPE
16290075Sobrien#define PTRDIFF_TYPE "long int"
16390075Sobrien
16490075Sobrien/* AIX 4 uses PowerPC nop (ori 0,0,0) instruction as call glue for PowerPC
16590075Sobrien   and "cror 31,31,31" for POWER architecture.  */
16690075Sobrien
16790075Sobrien#undef RS6000_CALL_GLUE
16890075Sobrien#define RS6000_CALL_GLUE "{cror 31,31,31|nop}"
16990075Sobrien
17090075Sobrien/* AIX 4.2 and above provides initialization and finalization function
17190075Sobrien   support from linker command line.  */
17290075Sobrien#undef HAS_INIT_SECTION
17390075Sobrien#define HAS_INIT_SECTION
17490075Sobrien
17590075Sobrien#undef LD_INIT_SWITCH
17690075Sobrien#define LD_INIT_SWITCH "-binitfini"
177146895Skan
178146895Skan/* The IBM AIX 4.x assembler doesn't support forward references in
179146895Skan   .set directives.  We handle this by deferring the output of .set
180146895Skan   directives to the end of the compilation unit.  */
181146895Skan#define TARGET_DEFERRED_OUTPUT_DEFS(DECL,TARGET) true
182169689Skan
183169689Skan/* This target uses the aix64.opt file.  */
184169689Skan#define TARGET_USES_AIX64_OPT 1
185