aix.h revision 96263
1/* Definitions of target machine for GNU compiler,
2   for IBM RS/6000 POWER running AIX.
3   Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU CC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU CC; see the file COPYING.  If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA.  */
21
22/* Yes!  We are AIX!  */
23#define DEFAULT_ABI ABI_AIX
24#undef TARGET_AIX
25#define TARGET_AIX 1
26/* The AIX linker will discard static constructors in object files before
27   collect has a chance to see them, so scan the object files directly.  */
28#define COLLECT_EXPORT_LIST
29
30/* Handle #pragma weak and #pragma pack.  */
31#define HANDLE_SYSV_PRAGMA
32
33/* This is the only version of nm that collect2 can work with.  */
34#define REAL_NM_FILE_NAME "/usr/ucb/nm"
35
36#define USER_LABEL_PREFIX  ""
37/* Don't turn -B into -L if the argument specifies a relative file name.  */
38#define RELATIVE_PREFIX_NOT_LINKDIR
39
40/* Because of the above, we must have gcc search itself to find libgcc.a.  */
41#define LINK_LIBGCC_SPECIAL_1
42
43/* Names to predefine in the preprocessor for this target machine.  */
44#define CPP_PREDEFINES "-D_IBMR2 -D_POWER -D_AIX -D_AIX32 -D_LONG_LONG \
45-Asystem=unix -Asystem=aix -Acpu=rs6000 -Amachine=rs6000"
46
47/* Define appropriate architecture macros for preprocessor depending on
48   target switches.  */
49
50#define CPP_SPEC "%{posix: -D_POSIX_SOURCE}\
51   %{ansi: -D_ANSI_C_SOURCE}\
52   %(cpp_cpu)"
53
54#undef CPP_DEFAULT_SPEC
55#define CPP_DEFAULT_SPEC "-D_ARCH_PWR"
56
57#undef ASM_DEFAULT_SPEC
58#define ASM_DEFAULT_SPEC ""
59
60/* Tell the assembler to assume that all undefined names are external.
61
62   Don't do this until the fixed IBM assembler is more generally available.
63   When this becomes permanently defined, the ASM_OUTPUT_EXTERNAL,
64   ASM_OUTPUT_EXTERNAL_LIBCALL, and RS6000_OUTPUT_BASENAME macros will no
65   longer be needed.  Also, the extern declaration of mcount in ASM_FILE_START
66   will no longer be needed.  */
67
68/* #define ASM_SPEC "-u %(asm_cpu)" */
69
70/* Default location of syscalls.exp under AIX */
71#ifndef CROSS_COMPILE
72#define LINK_SYSCALLS_SPEC "-bI:/lib/syscalls.exp"
73#else
74#define LINK_SYSCALLS_SPEC ""
75#endif
76
77/* Default location of libg.exp under AIX */
78#ifndef CROSS_COMPILE
79#define LINK_LIBG_SPEC "-bexport:/usr/lib/libg.exp"
80#else
81#define LINK_LIBG_SPEC ""
82#endif
83
84/* Define the options for the binder: Start text at 512, align all segments
85   to 512 bytes, and warn if there is text relocation.
86
87   The -bhalt:4 option supposedly changes the level at which ld will abort,
88   but it also suppresses warnings about multiply defined symbols and is
89   used by the AIX cc command.  So we use it here.
90
91   -bnodelcsect undoes a poor choice of default relating to multiply-defined
92   csects.  See AIX documentation for more information about this.
93
94   -bM:SRE tells the linker that the output file is Shared REusable.  Note
95   that to actually build a shared library you will also need to specify an
96   export list with the -Wl,-bE option.  */
97
98#define LINK_SPEC "-T512 -H512 %{!r:-btextro} -bhalt:4 -bnodelcsect\
99%{static:-bnso %(link_syscalls) } \
100%{!shared:%{g*: %(link_libg) }} %{shared:-bM:SRE}"
101
102/* Profiled library versions are used by linking with special directories.  */
103#define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\
104%{p:-L/lib/profiled -L/usr/lib/profiled} %{!shared:%{g*:-lg}} -lc"
105
106/* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints.  */
107#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
108  (TYPE_MODE (TREE_CODE (TREE_TYPE (FIELD)) == ARRAY_TYPE \
109	      ? get_inner_array_type (FIELD) \
110	      : TREE_TYPE (FIELD)) == DFmode \
111   ? MIN ((COMPUTED), 32) : (COMPUTED))
112
113/* AIX increases natural record alignment to doubleword if the first
114   field is an FP double while the FP fields remain word aligned.  */
115#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED)	\
116  ((TREE_CODE (STRUCT) == RECORD_TYPE			\
117    || TREE_CODE (STRUCT) == UNION_TYPE			\
118    || TREE_CODE (STRUCT) == QUAL_UNION_TYPE)		\
119   && TYPE_FIELDS (STRUCT) != 0				\
120   && DECL_MODE (TYPE_FIELDS (STRUCT)) == DFmode	\
121   ? MAX (MAX ((COMPUTED), (SPECIFIED)), 64)		\
122   : MAX ((COMPUTED), (SPECIFIED)))
123
124
125
126/* Indicate that jump tables go in the text section.  */
127
128#define JUMP_TABLES_IN_TEXT_SECTION 1
129
130/* Enable AIX XL compiler calling convention breakage compatibility.  */
131#undef TARGET_XL_CALL
132#define MASK_XL_CALL		0x40000000
133#define	TARGET_XL_CALL		(target_flags & MASK_XL_CALL)
134#undef  SUBTARGET_SWITCHES
135#define SUBTARGET_SWITCHES		\
136  {"xl-call", 		MASK_XL_CALL,					\
137   N_("Always pass floating-point arguments in memory") },		\
138  {"no-xl-call",	- MASK_XL_CALL,					\
139   N_("Don't always pass floating-point arguments in memory") },	\
140  SUBSUBTARGET_SWITCHES
141#define SUBSUBTARGET_SWITCHES
142
143/* Define any extra SPECS that the compiler needs to generate.  */
144#undef  SUBTARGET_EXTRA_SPECS
145#define SUBTARGET_EXTRA_SPECS						\
146  { "link_syscalls",            LINK_SYSCALLS_SPEC },			\
147  { "link_libg",                LINK_LIBG_SPEC }
148
149/* Define cutoff for using external functions to save floating point.  */
150#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == 62 || (FIRST_REG) == 63)
151
152/* Optabs entries for the int->float routines and quad FP operations
153   using the standard AIX names.  */
154#define ADDTF3_LIBCALL "_xlqadd"
155#define DIVTF3_LIBCALL "_xlqdiv"
156#define MULTF3_LIBCALL "_xlqmul"
157#define SUBTF3_LIBCALL "_xlqsub"
158
159#define INIT_TARGET_OPTABS						\
160  do {									\
161    if (! TARGET_POWER2 && ! TARGET_POWERPC && TARGET_HARD_FLOAT)	\
162      {									\
163	fixdfsi_libfunc = init_one_libfunc (RS6000_ITRUNC);		\
164	fixunsdfsi_libfunc = init_one_libfunc (RS6000_UITRUNC);		\
165      }									\
166    if (TARGET_HARD_FLOAT)						\
167      {									\
168	add_optab->handlers[(int) TFmode].libfunc			\
169	  = init_one_libfunc (ADDTF3_LIBCALL);				\
170	sub_optab->handlers[(int) TFmode].libfunc			\
171	  = init_one_libfunc (SUBTF3_LIBCALL);				\
172	smul_optab->handlers[(int) TFmode].libfunc			\
173	  = init_one_libfunc (MULTF3_LIBCALL);				\
174	sdiv_optab->handlers[(int) TFmode].libfunc			\
175	  = init_one_libfunc (DIVTF3_LIBCALL);				\
176      }									\
177  } while (0)
178
179/* AIX always has a TOC.  */
180#define TARGET_NO_TOC		0
181#define	TARGET_TOC		1
182
183#define FIXED_R2 1
184/* AIX allows r13 to be used.  */
185#define FIXED_R13 0
186
187/* __throw will restore its own return address to be the same as the
188   return address of the function that the throw is being made to.
189   This is unfortunate, because we want to check the original
190   return address to see if we need to restore the TOC.
191   So we have to squirrel it away with this.  */
192#define SETUP_FRAME_ADDRESSES() rs6000_aix_emit_builtin_unwind_init ()
193
194#define PROFILE_HOOK(LABEL)   output_profile_hook (LABEL)
195
196/* Print subsidiary information on the compiler version in use.  */
197#define TARGET_VERSION ;
198