OSDN Git Service

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, 2004, 2005, 2006
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, 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, 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
55
56 #define TARGET_OS_CPP_BUILTINS()                                \
57   do {                                                          \
58     LINUX_TARGET_OS_CPP_BUILTINS();                             \
59     /* The GNU C++ standard library requires this.  */          \
60     if (c_dialect_cxx ())                                       \
61       builtin_define ("_GNU_SOURCE");                           \
62                                                                 \
63     if (mips_abi == ABI_N32)                                    \
64       {                                                         \
65         builtin_define ("_ABIN32=2");                           \
66         builtin_define ("_MIPS_SIM=_ABIN32");                   \
67         builtin_define ("_MIPS_SZLONG=32");                     \
68         builtin_define ("_MIPS_SZPTR=32");                      \
69       }                                                         \
70     else if (mips_abi == ABI_64)                                \
71       {                                                         \
72         builtin_define ("_ABI64=3");                            \
73         builtin_define ("_MIPS_SIM=_ABI64");                    \
74         builtin_define ("_MIPS_SZLONG=64");                     \
75         builtin_define ("_MIPS_SZPTR=64");                      \
76       }                                                         \
77     else                                                        \
78       {                                                         \
79         builtin_define ("_ABIO32=1");                           \
80         builtin_define ("_MIPS_SIM=_ABIO32");                   \
81         builtin_define ("_MIPS_SZLONG=32");                     \
82         builtin_define ("_MIPS_SZPTR=32");                      \
83       }                                                         \
84     if (TARGET_FLOAT64)                                         \
85       builtin_define ("_MIPS_FPSET=32");                        \
86     else                                                        \
87       builtin_define ("_MIPS_FPSET=16");                        \
88                                                                 \
89     builtin_define ("_MIPS_SZINT=32");                          \
90   } while (0)
91
92 #undef  SUBTARGET_CPP_SPEC
93 #define SUBTARGET_CPP_SPEC "%{pthread:-D_REENTRANT}"
94
95 /* From iris5.h */
96 /* -G is incompatible with -KPIC which is the default, so only allow objects
97    in the small data section if the user explicitly asks for it.  */
98 #undef MIPS_DEFAULT_GVALUE
99 #define MIPS_DEFAULT_GVALUE 0
100
101 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
102
103 /* Borrowed from sparc/linux.h */
104 #undef LINK_SPEC
105 #define LINK_SPEC \
106  "%(endian_spec) \
107   %{shared:-shared} \
108   %{!shared: \
109     %{!ibcs: \
110       %{!static: \
111         %{rdynamic:-export-dynamic} \
112         %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "}} \
113         %{static:-static}}}"
114
115 #undef SUBTARGET_ASM_SPEC
116 #define SUBTARGET_ASM_SPEC "%{mabi=64: -64} %{!mno-abicalls:-KPIC}"
117
118 /* The MIPS assembler has different syntax for .set. We set it to
119    .dummy to trap any errors.  */
120 #undef SET_ASM_OP
121 #define SET_ASM_OP "\t.dummy\t"
122
123 #undef ASM_OUTPUT_DEF
124 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                              \
125  do {                                                                   \
126         fputc ( '\t', FILE);                                            \
127         assemble_name (FILE, LABEL1);                                   \
128         fputs ( " = ", FILE);                                           \
129         assemble_name (FILE, LABEL2);                                   \
130         fputc ( '\n', FILE);                                            \
131  } while (0)
132
133 #undef ASM_DECLARE_FUNCTION_NAME
134 #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL)                   \
135   do {                                                                  \
136     if (!flag_inhibit_size_directive)                                   \
137       {                                                                 \
138         fputs ("\t.ent\t", STREAM);                                     \
139         assemble_name (STREAM, NAME);                                   \
140         putc ('\n', STREAM);                                            \
141       }                                                                 \
142     ASM_OUTPUT_TYPE_DIRECTIVE (STREAM, NAME, "function");               \
143     assemble_name (STREAM, NAME);                                       \
144     fputs (":\n", STREAM);                                              \
145   } while (0)
146
147 #undef ASM_DECLARE_FUNCTION_SIZE
148 #define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL)                   \
149   do {                                                                  \
150     if (!flag_inhibit_size_directive)                                   \
151       {                                                                 \
152         fputs ("\t.end\t", STREAM);                                     \
153         assemble_name (STREAM, NAME);                                   \
154         putc ('\n', STREAM);                                            \
155       }                                                                 \
156   } while (0)
157
158 /* Tell function_prologue in mips.c that we have already output the .ent/.end
159    pseudo-ops.  */
160 #undef FUNCTION_NAME_ALREADY_DECLARED
161 #define FUNCTION_NAME_ALREADY_DECLARED 1
162
163 /* The glibc _mcount stub will save $v0 for us.  Don't mess with saving
164    it, since ASM_OUTPUT_REG_PUSH/ASM_OUTPUT_REG_POP do not work in the
165    presence of $gp-relative calls.  */
166 #undef ASM_OUTPUT_REG_PUSH
167 #undef ASM_OUTPUT_REG_POP
168
169 #undef LIB_SPEC
170 #define LIB_SPEC "\
171 %{shared: -lc} \
172 %{!shared: %{pthread:-lpthread} \
173   %{profile:-lc_p} %{!profile: -lc}}"
174
175 #define MD_UNWIND_SUPPORT "config/mips/linux-unwind.h"