OSDN Git Service

Fix PR target/42093
[pf3gnuchains/gcc-fork.git] / gcc / config / mips / iris.h
1 /* Definitions of target machine for GNU compiler.  Generic IRIX version.
2    Copyright (C) 1993, 1995, 1996, 1998, 2000,
3    2001, 2002, 2003, 2004, 2007, 2008 Free Software Foundation, Inc.
4
5 This file is part of GCC.
6
7 GCC 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 3, or (at your option)
10 any later version.
11
12 GCC 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 GCC; see the file COPYING3.  If not see
19 <http://www.gnu.org/licenses/>.  */
20
21 /* We are compiling for IRIX now.  */
22 #undef TARGET_IRIX
23 #define TARGET_IRIX 1
24
25 /* MIPS specific debugging info */
26 #define MIPS_DEBUGGING_INFO 1
27
28 /* The size in bytes of a DWARF field indicating an offset or length
29    relative to a debug info section, specified to be 4 bytes in the DWARF-2
30    specification.  The SGI/MIPS ABI defines it to be the same as PTR_SIZE.  */
31 #define DWARF_OFFSET_SIZE PTR_SIZE
32
33 /* The size in bytes of the initial length field in a debug info
34    section.  The DWARF 3 (draft) specification defines this to be
35    either 4 or 12 (with a 4-byte "escape" word when it's 12), but the
36    SGI/MIPS ABI predates this standard and defines it to be the same
37    as DWARF_OFFSET_SIZE.  */
38 #define DWARF_INITIAL_LENGTH_SIZE DWARF_OFFSET_SIZE
39
40 /* MIPS assemblers don't have the usual .set foo,bar construct;
41    .set is used for assembler options instead.  */
42 #undef SET_ASM_OP
43 #define ASM_OUTPUT_DEF(FILE, LABEL1, LABEL2)                    \
44   do                                                            \
45     {                                                           \
46       fputc ('\t', FILE);                                       \
47       assemble_name (FILE, LABEL1);                             \
48       fputs (" = ", FILE);                                      \
49       assemble_name (FILE, LABEL2);                             \
50       fputc ('\n', FILE);                                       \
51     }                                                           \
52   while (0)
53
54 /* The MIPSpro o32 linker warns about not linking .comment sections.  */
55 #undef IDENT_ASM_OP
56
57 #undef LOCAL_LABEL_PREFIX
58 #define LOCAL_LABEL_PREFIX (TARGET_NEWABI ? "." : "$")
59
60 #undef ASM_DECLARE_OBJECT_NAME
61 #define ASM_DECLARE_OBJECT_NAME mips_declare_object_name
62
63 #undef ASM_FINISH_DECLARE_OBJECT
64 #define ASM_FINISH_DECLARE_OBJECT mips_finish_declare_object
65
66 /* Specify wchar_t types.  */
67 #undef WCHAR_TYPE
68 #define WCHAR_TYPE (Pmode == DImode ? "int" : "long int")
69
70 #undef WCHAR_TYPE_SIZE
71 #define WCHAR_TYPE_SIZE INT_TYPE_SIZE
72
73 /* Same for wint_t.  */
74 #undef WINT_TYPE
75 #define WINT_TYPE (Pmode == DImode ? "int" : "long int")
76
77 #undef WINT_TYPE_SIZE
78 #define WINT_TYPE_SIZE 32
79
80 /* Plain char is unsigned in the SGI compiler.  */
81 #undef DEFAULT_SIGNED_CHAR
82 #define DEFAULT_SIGNED_CHAR 0
83
84 #define WORD_SWITCH_TAKES_ARG(STR)                      \
85   (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)                  \
86    || strcmp (STR, "rpath") == 0)
87
88 #define TARGET_OS_CPP_BUILTINS()                                \
89   do                                                            \
90     {                                                           \
91       builtin_define_std ("host_mips");                         \
92       builtin_define_std ("sgi");                               \
93       builtin_define_std ("unix");                              \
94       builtin_define_std ("SYSTYPE_SVR4");                      \
95       builtin_define ("_MODERN_C");                             \
96       builtin_define ("_SVR4_SOURCE");                          \
97       builtin_define ("__DSO__");                               \
98       builtin_assert ("system=unix");                           \
99       builtin_assert ("system=svr4");                           \
100       builtin_assert ("machine=sgi");                           \
101                                                                 \
102       if (!ISA_MIPS1 && !ISA_MIPS2)                             \
103         builtin_define ("_COMPILER_VERSION=601");               \
104                                                                 \
105       /* We must always define _LONGLONG, even when -ansi is    \
106          used, because IRIX 5 system header files require it.   \
107          This is OK, because gcc never warns when long long     \
108          is used in system header files.                        \
109                                                                 \
110          An alternative would be to support the SGI builtin     \
111          type __long_long.  */                                  \
112       builtin_define ("_LONGLONG");                             \
113                                                                 \
114       /* IRIX 6.5.18 and above provide many ISO C99             \
115          features protected by the __c99 macro.                 \
116          libstdc++ v3 needs them as well.  */                   \
117       if (TARGET_IRIX6)                                         \
118         if (flag_isoc99 || c_dialect_cxx ())                    \
119           builtin_define ("__c99");                             \
120                                                                 \
121       /* The GNU C++ standard library requires that             \
122          __EXTENSIONS__ and _SGI_SOURCE be defined on at        \
123          least IRIX 6.2 and probably all IRIX 6 prior to 6.5.   \
124          We don't need this on IRIX 6.5 itself, but it          \
125          shouldn't hurt other than the namespace pollution.  */ \
126       if (!flag_iso || (TARGET_IRIX6 && c_dialect_cxx ()))      \
127         {                                                       \
128           builtin_define ("__EXTENSIONS__");                    \
129           builtin_define ("_SGI_SOURCE");                       \
130         }                                                       \
131     }                                                           \
132   while (0)
133
134 #undef SUBTARGET_CC1_SPEC
135 #define SUBTARGET_CC1_SPEC "%{static: -mno-abicalls}"
136
137 #undef INIT_SECTION_ASM_OP
138 #define INIT_SECTION_ASM_OP "\t.section\t.gcc_init,\"ax\",@progbits"
139
140 #undef FINI_SECTION_ASM_OP
141 #define FINI_SECTION_ASM_OP "\t.section\t.gcc_fini,\"ax\",@progbits"
142
143 #ifdef IRIX_USING_GNU_LD
144 #define IRIX_NO_UNRESOLVED ""
145 #else
146 #define IRIX_NO_UNRESOLVED "-no_unresolved"
147 #endif
148
149 /* Generic part of the LINK_SPEC.  */
150 #undef LINK_SPEC
151 #define LINK_SPEC "\
152 %{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \
153 %{bestGnum} %{shared} %{non_shared} \
154 %{call_shared} %{no_archive} %{exact_version} \
155 %{!shared: \
156   %{!non_shared: %{!call_shared:%{!r: -call_shared " IRIX_NO_UNRESOLVED "}}}} \
157 %{rpath} -init __gcc_init -fini __gcc_fini " IRIX_SUBTARGET_LINK_SPEC
158
159 /* A linker error can empirically be avoided by removing duplicate
160    library search directories.  */
161 #define LINK_ELIMINATE_DUPLICATE_LDIRECTORIES 1
162
163 /* Add -g to mips.h default to avoid confusing gas with local symbols
164    generated from stabs info.  */
165 #undef NM_FLAGS
166 #define NM_FLAGS "-Bng"
167
168 /* The system header files are C++ aware.  */
169 /* ??? Unfortunately, most but not all of the headers are C++ aware.
170    Specifically, curses.h is not, and as a consequence, defining this
171    used to prevent libg++ building.  This is no longer the case so
172    define it again to prevent other problems, e.g. with getopt in
173    unistd.h.  We still need some way to fix just those files that need
174    fixing.  */
175 #define NO_IMPLICIT_EXTERN_C 1
176
177 /* -G is incompatible with -KPIC which is the default, so only allow objects
178    in the small data section if the user explicitly asks for it.  */
179 #undef MIPS_DEFAULT_GVALUE
180 #define MIPS_DEFAULT_GVALUE 0
181
182 /* The native o32 IRIX linker does not support merging without a
183    special elspec(5) file.  */
184 #ifndef IRIX_USING_GNU_LD
185 #undef HAVE_GAS_SHF_MERGE
186 #define HAVE_GAS_SHF_MERGE 0
187 #endif