h8300.h: Fix comment formatting.
[gcc.git] / gcc / config / ia64 / aix.h
1 /* Definitions of target machine GNU compiler. IA-64/AIX version.
2 Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
3 Contributed by Timothy Wall (twall@cygnus.com)
4
5 This file is part of GNU CC.
6
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22 /* AIX5 (aka Monterey): a mix of AIX and UnixWare.
23 This file is loosely based on ia64/linux.h. */
24
25 /* This macro is a C statement to print on `stderr' a string describing the
26 particular machine description choice. */
27
28 #define TARGET_VERSION fprintf (stderr, " (IA-64) AIX");
29
30 #undef ASM_APP_ON
31 #define ASM_APP_ON "#APP\n"
32
33 #undef ASM_APP_OFF
34 #define ASM_APP_OFF "#NO_APP\n"
35
36 #define SET_ASM_OP "\t.set\t"
37
38 #undef MD_EXEC_PREFIX
39 #undef MD_STARTFILE_PREFIX
40 #define MD_STARTFILE_PREFIX "/usr/lib/ia64l64/"
41
42 /* Output at beginning of assembler file. */
43 /* The .file command should always begin the output. */
44 #undef ASM_FILE_START
45 #define ASM_FILE_START(FILE) \
46 do { \
47 output_file_directive (FILE, main_input_filename); \
48 fprintf (FILE, "\t.version\t\"01.01\"\n"); \
49 } while (0)
50
51 /* Provide a STARTFILE_SPEC appropriate for AIX. Here we add
52 the crti C++ startup files file which provide part of the support
53 for getting C++ file-scope static object constructed before entering
54 `main'. */
55
56 #undef STARTFILE_SPEC
57 #define STARTFILE_SPEC \
58 "%{!shared: \
59 %{pg:gcrt1_64.o%s} %{!pg:%{p:mcrt1_64.o%s} \
60 %{!p:%{profile:gcrt1_64.o%s} \
61 %{!profile:crt1_64.o%s}}}} \
62 crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
63
64 /* Provide a ENDFILE_SPEC appropriate for AIX. Here we tack on
65 the crtn file which provides termination of the support for getting C++
66 file-scope static object constructed before entering `main'. */
67
68 #undef ENDFILE_SPEC
69 #define ENDFILE_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
70
71 /* Define this so we can compile MS code for use with WINE. */
72 #define HANDLE_PRAGMA_PACK_PUSH_POP
73
74 /* A C string constant that tells the GNU CC driver program options to pass to
75 CPP. It can also specify how to translate options you give to GNU CC into
76 options for GNU CC to pass to the CPP. */
77
78 /* If -ansi, we need to define _ANSI_C_SOURCE to get the right headers. */
79 #undef CPP_SPEC
80 #define CPP_SPEC "\
81 %{mcpu=itanium:-D__itanium__} %{mbig-endian:-D__BIG_ENDIAN__} \
82 %{ansi:-D_ANSI_C_SOURCE} \
83 %{posix:-D_POSIX_SOURCE} \
84 %{cpp_cpu} \
85 -D__LONG_MAX__=9223372036854775807L"
86
87 #undef CPP_PREDEFINES
88 #define CPP_PREDEFINES "\
89 -D__ia64 -D__ia64__ -D_AIX -D_AIX64 -D_LONGLONG -Dunix \
90 -D__LP64__ -D__ELF__ -Asystem=unix -Asystem=aix -Acpu=ia64 -Amachine=ia64 \
91 -D__64BIT__ -D_LONG_LONG -D_IA64 -D__int128=__size128_t"
92
93 /* The GNU C++ standard library requires that these macros be defined. */
94 #undef CPLUSPLUS_CPP_SPEC
95 #define CPLUSPLUS_CPP_SPEC \
96 "-D_XOPEN_SOURCE=500 \
97 -D_XOPEN_SOURCE_EXTENDED=1 \
98 -D_LARGE_FILE_API \
99 -D_ALL_SOURCE \
100 -D__LONG_MAX__=9223372036854775807L \
101 %{cpp_cpu}"
102
103 /* ia64-specific options for gas */
104 #undef ASM_SPEC
105 #define ASM_SPEC "-x %{mconstant-gp} %{mauto-pic}"
106
107 /* Define this for shared library support. */
108
109 #undef LINK_SPEC
110 #define LINK_SPEC "\
111 %{shared:-shared} \
112 %{!shared: \
113 %{!static: \
114 %{rdynamic:-export-dynamic} \
115 %{!dynamic-linker:-dynamic-linker /usr/lib/ia64l64/libc.so.1}} \
116 %{static:-static}}"
117
118 #define DONT_USE_BUILTIN_SETJMP
119 #define JMP_BUF_SIZE 85
120
121 /* Output any profiling code before the prologue. */
122
123 #undef PROFILE_BEFORE_PROLOGUE
124 #define PROFILE_BEFORE_PROLOGUE 1
125
126 /* A C statement or compound statement to output to FILE some assembler code to
127 call the profiling subroutine `mcount'.
128
129 FIXME this is not supported until xlC supports it and can thus tell us
130 how to do it.
131 */
132
133 #undef FUNCTION_PROFILER
134 #define FUNCTION_PROFILER(FILE, LABELNO) \
135 do { \
136 } while (0)
137
138 /* Tell the linker where to find the crt*.o files. */
139
140 #ifndef CROSS_COMPILE
141 #undef STANDARD_STARTFILE_PREFIX
142 #define STANDARD_STARTFILE_PREFIX "/usr/lib/ia64l64/"
143 #endif
144
145 /* Override SELECT_SECTION and SELECT_RTX_SECTION from config/ia64/sysv4.h;
146 these definitions ignore flag_pic as if it were always set;
147 it is illegal to have relocations in shared segments on AIX. */
148
149 /* A C statement or statements to switch to the appropriate
150 section for output of DECL. DECL is either a `VAR_DECL' node
151 or a constant of some sort. RELOC indicates whether forming
152 the initial value of DECL requires link-time relocations. */
153
154 #undef SELECT_SECTION
155 #define SELECT_SECTION(DECL,RELOC,ALIGN) \
156 { \
157 if (TREE_CODE (DECL) == STRING_CST) \
158 { \
159 if (! flag_writable_strings) \
160 const_section (); \
161 else \
162 data_section (); \
163 } \
164 else if (TREE_CODE (DECL) == VAR_DECL) \
165 { \
166 if (XSTR (XEXP (DECL_RTL (DECL), 0), 0)[0] \
167 == SDATA_NAME_FLAG_CHAR) \
168 sdata_section (); \
169 /* ??? We need the extra ! RELOC check, because the default is to \
170 only check RELOC if flag_pic is set, and we don't set flag_pic \
171 (yet?). */ \
172 else if (DECL_READONLY_SECTION (DECL, RELOC) && ! (RELOC)) \
173 const_section (); \
174 else \
175 data_section (); \
176 } \
177 /* This could be a CONSTRUCTOR containing ADDR_EXPR of a VAR_DECL, \
178 in which case we can't put it in a shared library rodata. */ \
179 else if (RELOC) \
180 data_section (); \
181 else \
182 const_section (); \
183 }
184
185 /* Similarly for constant pool data. */
186
187 extern unsigned int ia64_section_threshold;
188 #undef SELECT_RTX_SECTION
189 #define SELECT_RTX_SECTION(MODE, RTX, ALIGN) \
190 { \
191 if (GET_MODE_SIZE (MODE) > 0 \
192 && GET_MODE_SIZE (MODE) <= ia64_section_threshold) \
193 sdata_section (); \
194 else if (symbolic_operand ((RTX), (MODE))) \
195 data_section (); \
196 else \
197 const_section (); \
198 }
199
200 #undef UNIQUE_SECTION
201 #define UNIQUE_SECTION(DECL, RELOC) \
202 do \
203 { \
204 int len; \
205 int sec; \
206 const char *name; \
207 char *string; \
208 const char *prefix; \
209 static const char *const prefixes[/*4*/3][2] = \
210 { \
211 { ".text.", ".gnu.linkonce.t." }, \
212 { ".rodata.", ".gnu.linkonce.r." }, \
213 { ".data.", ".gnu.linkonce.d." } \
214 /* Do not generate unique sections for uninitialised \
215 data since we do not have support for this in the \
216 linker scripts yet... \
217 ,{ ".bss.", ".gnu.linkonce.b." } */ \
218 }; \
219 \
220 if (TREE_CODE (DECL) == FUNCTION_DECL) \
221 sec = 0; \
222 /* else if (DECL_INITIAL (DECL) == 0 \
223 || DECL_INITIAL (DECL) == error_mark_node) \
224 sec = 3; */ \
225 else if (DECL_READONLY_SECTION (DECL, RELOC) && ! (RELOC))\
226 sec = 1; \
227 else \
228 sec = 2; \
229 \
230 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \
231 /* Strip off any encoding in name. */ \
232 STRIP_NAME_ENCODING (name, name); \
233 prefix = prefixes[sec][DECL_ONE_ONLY(DECL)]; \
234 len = strlen (name) + strlen (prefix); \
235 string = alloca (len + 1); \
236 \
237 sprintf (string, "%s%s", prefix, name); \
238 \
239 DECL_SECTION_NAME (DECL) = build_string (len, string); \
240 } \
241 while (0)
242
243 /* Override ia64/sysv4.h setting with that used by AIX5. */
244 #undef WCHAR_TYPE
245 #ifdef __64BIT__
246 #define WCHAR_TYPE "unsigned int"
247 #else
248 #define WCHAR_TYPE "unsigned short"
249 #endif
250
251 /* Define the `__builtin_va_list' type for AIX. Use char* b/c that's what the
252 system headers expect. */
253 #define BUILD_VA_LIST_TYPE(VALIST) \
254 (VALIST) = build_pointer_type(char_type_node)
255
256 /* End of aix.h */