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)
5 This file is part of GNU CC.
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)
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.
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. */
22 /* AIX5 (aka Monterey): a mix of AIX and UnixWare.
23 This file is loosely based on ia64/linux.h. */
25 /* This macro is a C statement to print on `stderr' a string describing the
26 particular machine description choice. */
28 #define TARGET_VERSION fprintf (stderr, " (IA-64) AIX");
31 #define ASM_APP_ON "#APP\n"
34 #define ASM_APP_OFF "#NO_APP\n"
36 #define SET_ASM_OP "\t.set\t"
39 #undef MD_STARTFILE_PREFIX
40 #define MD_STARTFILE_PREFIX "/usr/lib/ia64l64/"
42 /* Output at beginning of assembler file. */
43 /* The .file command should always begin the output. */
45 #define ASM_FILE_START(FILE) \
47 output_file_directive (FILE, main_input_filename); \
48 fprintf (FILE, "\t.version\t\"01.01\"\n"); \
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
57 #define STARTFILE_SPEC \
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}"
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'. */
69 #define ENDFILE_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
71 /* Define this so we can compile MS code for use with WINE. */
72 #define HANDLE_PRAGMA_PACK_PUSH_POP
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. */
78 /* If -ansi, we need to define _ANSI_C_SOURCE to get the right headers. */
81 %{mcpu=itanium:-D__itanium__} %{mbig-endian:-D__BIG_ENDIAN__} \
82 %{ansi:-D_ANSI_C_SOURCE} \
83 %{posix:-D_POSIX_SOURCE} \
85 -D__LONG_MAX__=9223372036854775807L"
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"
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 \
100 -D__LONG_MAX__=9223372036854775807L \
103 /* ia64-specific options for gas */
105 #define ASM_SPEC "-x %{mconstant-gp} %{mauto-pic}"
107 /* Define this for shared library support. */
114 %{rdynamic:-export-dynamic} \
115 %{!dynamic-linker:-dynamic-linker /usr/lib/ia64l64/libc.so.1}} \
118 #define DONT_USE_BUILTIN_SETJMP
119 #define JMP_BUF_SIZE 85
121 /* Output any profiling code before the prologue. */
123 #undef PROFILE_BEFORE_PROLOGUE
124 #define PROFILE_BEFORE_PROLOGUE 1
126 /* A C statement or compound statement to output to FILE some assembler code to
127 call the profiling subroutine `mcount'.
129 FIXME this is not supported until xlC supports it and can thus tell us
133 #undef FUNCTION_PROFILER
134 #define FUNCTION_PROFILER(FILE, LABELNO) \
138 /* Tell the linker where to find the crt*.o files. */
140 #ifndef CROSS_COMPILE
141 #undef STANDARD_STARTFILE_PREFIX
142 #define STANDARD_STARTFILE_PREFIX "/usr/lib/ia64l64/"
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. */
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. */
154 #undef SELECT_SECTION
155 #define SELECT_SECTION(DECL,RELOC,ALIGN) \
157 if (TREE_CODE (DECL) == STRING_CST) \
159 if (! flag_writable_strings) \
164 else if (TREE_CODE (DECL) == VAR_DECL) \
166 if (XSTR (XEXP (DECL_RTL (DECL), 0), 0)[0] \
167 == SDATA_NAME_FLAG_CHAR) \
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 \
172 else if (DECL_READONLY_SECTION (DECL, RELOC) && ! (RELOC)) \
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. */ \
185 /* Similarly for constant pool data. */
187 extern unsigned int ia64_section_threshold
;
188 #undef SELECT_RTX_SECTION
189 #define SELECT_RTX_SECTION(MODE, RTX, ALIGN) \
191 if (GET_MODE_SIZE (MODE) > 0 \
192 && GET_MODE_SIZE (MODE) <= ia64_section_threshold) \
194 else if (symbolic_operand ((RTX), (MODE))) \
200 #undef UNIQUE_SECTION
201 #define UNIQUE_SECTION(DECL, RELOC) \
208 const char *prefix; \
209 static const char *const prefixes[/*4*/3][2] = \
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." } */ \
220 if (TREE_CODE (DECL) == FUNCTION_DECL) \
222 /* else if (DECL_INITIAL (DECL) == 0 \
223 || DECL_INITIAL (DECL) == error_mark_node) \
225 else if (DECL_READONLY_SECTION (DECL, RELOC) && ! (RELOC))\
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); \
237 sprintf (string, "%s%s", prefix, name); \
239 DECL_SECTION_NAME (DECL) = build_string (len, string); \
243 /* Override ia64/sysv4.h setting with that used by AIX5. */
246 #define WCHAR_TYPE "unsigned int"
248 #define WCHAR_TYPE "unsigned short"
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)