OSDN Git Service

GNU CC -> GCC
[pf3gnuchains/gcc-fork.git] / gcc / config / mips / linux.h
1 /* Definitions for MIPS running Linux-based GNU systems with ELF format.
2    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
3    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 2, 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 COPYING.  If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.  */
21
22 #undef WCHAR_TYPE
23 #define WCHAR_TYPE "int"
24
25 #undef WCHAR_TYPE_SIZE
26 #define WCHAR_TYPE_SIZE 32
27
28 /* If defined, a C expression whose value is a string containing the
29    assembler operation to identify the following data as
30    uninitialized global data.  If not defined, and neither
31    `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
32    uninitialized global data will be output in the data section if
33    `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
34    used.  */
35 #define BSS_SECTION_ASM_OP      "\t.section\t.bss"
36
37 #define ASM_OUTPUT_ALIGNED_BSS mips_output_aligned_bss
38
39 #undef ASM_DECLARE_OBJECT_NAME
40 #define ASM_DECLARE_OBJECT_NAME mips_declare_object_name
41
42 #undef TARGET_VERSION
43 #if TARGET_ENDIAN_DEFAULT == 0
44 #define TARGET_VERSION fprintf (stderr, " (MIPSel GNU/Linux with ELF)");
45 #else
46 #define TARGET_VERSION fprintf (stderr, " (MIPS GNU/Linux with ELF)");
47 #endif
48
49 #undef MD_EXEC_PREFIX
50 #undef MD_STARTFILE_PREFIX
51
52 /* If we don't set MASK_ABICALLS, we can't default to PIC.  */
53 #undef TARGET_DEFAULT
54 #define TARGET_DEFAULT (MASK_ABICALLS|MASK_GAS)
55
56 #define TARGET_OS_CPP_BUILTINS()                                \
57     do {                                                        \
58         builtin_define ("__gnu_linux__");                       \
59         builtin_define ("__PIC__");                             \
60         builtin_define ("__pic__");                             \
61         builtin_define_std ("unix");                            \
62         builtin_define_std ("linux");                           \
63         builtin_assert ("system=linux");                        \
64         /* The GNU C++ standard library requires this.  */      \
65         if (c_dialect_cxx ())                                   \
66           builtin_define ("_GNU_SOURCE");                       \
67                                                                 \
68       if (mips_abi == ABI_N32)                                  \
69       {                                                         \
70         builtin_define ("_ABIN32=2");                           \
71         builtin_define ("_MIPS_SIM=_ABIN32");                   \
72         builtin_define ("_MIPS_SZLONG=32");                     \
73         builtin_define ("_MIPS_SZPTR=32");                      \
74       }                                                         \
75      else if (mips_abi == ABI_64)                               \
76       {                                                         \
77         builtin_define ("_ABI64=3");                            \
78         builtin_define ("_MIPS_SIM=_ABI64");                    \
79         builtin_define ("_MIPS_SZLONG=64");                     \
80         builtin_define ("_MIPS_SZPTR=64");                      \
81       }                                                         \
82      else                                                       \
83       {                                                         \
84         builtin_define ("_MIPS_SIM=_MIPS_SIM_ABI32");           \
85         builtin_define ("_MIPS_SZLONG=32");                     \
86         builtin_define ("_MIPS_SZPTR=32");                      \
87       }                                                         \
88      if (TARGET_FLOAT64)                                        \
89         builtin_define ("_MIPS_FPSET=32");                      \
90      else                                                       \
91         builtin_define ("_MIPS_FPSET=16");                      \
92                                                                 \
93      if (TARGET_INT64)                                          \
94         builtin_define ("_MIPS_SZINT=64");                      \
95      else                                                       \
96         builtin_define ("_MIPS_SZINT=32");                      \
97 } while (0)
98
99 #undef  SUBTARGET_CPP_SPEC
100 #define SUBTARGET_CPP_SPEC "\
101 %{fno-PIC:-U__PIC__ -U__pic__} %{fno-pic:-U__PIC__ -U__pic__} \
102 %{fPIC|fPIE|fpic|fpie:-D__PIC__ -D__pic__} \
103 %{pthread:-D_REENTRANT}"
104
105 /* From iris5.h */
106 /* -G is incompatible with -KPIC which is the default, so only allow objects
107    in the small data section if the user explicitly asks for it.  */
108 #undef MIPS_DEFAULT_GVALUE
109 #define MIPS_DEFAULT_GVALUE 0
110
111 /* Borrowed from sparc/linux.h */
112 #undef LINK_SPEC
113 #define LINK_SPEC \
114  "%(endian_spec) \
115   %{shared:-shared} \
116   %{!shared: \
117     %{!ibcs: \
118       %{!static: \
119         %{rdynamic:-export-dynamic} \
120         %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
121         %{static:-static}}}"
122
123 #undef SUBTARGET_ASM_SPEC
124 #define SUBTARGET_ASM_SPEC "\
125 %{mabi=64: -64} \
126 %{!fno-PIC:%{!fno-pic:-KPIC}} \
127 %{fno-PIC:-non_shared} %{fno-pic:-non_shared}"
128
129 #undef  SUBTARGET_ASM_DEBUGGING_SPEC
130 #define SUBTARGET_ASM_DEBUGGING_SPEC "-g0"
131
132 /* The MIPS assembler has different syntax for .set. We set it to
133    .dummy to trap any errors.  */
134 #undef SET_ASM_OP
135 #define SET_ASM_OP "\t.dummy\t"
136
137 #undef ASM_OUTPUT_DEF
138 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                              \
139  do {                                                                   \
140         fputc ( '\t', FILE);                                            \
141         assemble_name (FILE, LABEL1);                                   \
142         fputs ( " = ", FILE);                                           \
143         assemble_name (FILE, LABEL2);                                   \
144         fputc ( '\n', FILE);                                            \
145  } while (0)
146
147 #undef ASM_DECLARE_FUNCTION_NAME
148 #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL)                   \
149   do {                                                                  \
150     if (!flag_inhibit_size_directive)                                   \
151       {                                                                 \
152         fputs ("\t.ent\t", STREAM);                                     \
153         assemble_name (STREAM, NAME);                                   \
154         putc ('\n', STREAM);                                            \
155       }                                                                 \
156     ASM_OUTPUT_TYPE_DIRECTIVE (STREAM, NAME, "function");               \
157     assemble_name (STREAM, NAME);                                       \
158     fputs (":\n", STREAM);                                              \
159   } while (0)
160
161 #undef ASM_DECLARE_FUNCTION_SIZE
162 #define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL)                   \
163   do {                                                                  \
164     if (!flag_inhibit_size_directive)                                   \
165       {                                                                 \
166         fputs ("\t.end\t", STREAM);                                     \
167         assemble_name (STREAM, NAME);                                   \
168         putc ('\n', STREAM);                                            \
169       }                                                                 \
170   } while (0)
171
172 /* Tell function_prologue in mips.c that we have already output the .ent/.end
173    pseudo-ops.  */
174 #define FUNCTION_NAME_ALREADY_DECLARED
175
176 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL)                      \
177   (flag_pic                                                             \
178     ? ((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4\
179    : DW_EH_PE_absptr)
180
181 /* The glibc _mcount stub will save $v0 for us.  Don't mess with saving
182    it, since ASM_OUTPUT_REG_PUSH/ASM_OUTPUT_REG_POP do not work in the
183    presence of $gp-relative calls.  */
184 #undef ASM_OUTPUT_REG_PUSH
185 #undef ASM_OUTPUT_REG_POP
186
187 #undef LIB_SPEC
188 #define LIB_SPEC "\
189 %{shared: -lc} \
190 %{!static:-rpath-link %R/lib:%R/usr/lib} \
191 %{!shared: %{pthread:-lpthread} \
192   %{profile:-lc_p} %{!profile: -lc}}"