OSDN Git Service

2e7b1028c6eb4cd6d4a9120cba0cec676fdaffe8
[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    2007 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 #undef WCHAR_TYPE
22 #define WCHAR_TYPE "int"
23
24 #undef WCHAR_TYPE_SIZE
25 #define WCHAR_TYPE_SIZE 32
26
27 #undef ASM_DECLARE_OBJECT_NAME
28 #define ASM_DECLARE_OBJECT_NAME mips_declare_object_name
29
30 #undef TARGET_VERSION
31 #if TARGET_ENDIAN_DEFAULT == 0
32 #define TARGET_VERSION fprintf (stderr, " (MIPSel GNU/Linux with ELF)");
33 #else
34 #define TARGET_VERSION fprintf (stderr, " (MIPS GNU/Linux with ELF)");
35 #endif
36
37 #undef MD_EXEC_PREFIX
38 #undef MD_STARTFILE_PREFIX
39
40 /* If we don't set MASK_ABICALLS, we can't default to PIC.  */
41 #undef TARGET_DEFAULT
42 #define TARGET_DEFAULT MASK_ABICALLS
43
44 #define TARGET_OS_CPP_BUILTINS()                                \
45   do {                                                          \
46     LINUX_TARGET_OS_CPP_BUILTINS();                             \
47     /* The GNU C++ standard library requires this.  */          \
48     if (c_dialect_cxx ())                                       \
49       builtin_define ("_GNU_SOURCE");                           \
50   } while (0)
51
52 #undef SUBTARGET_CPP_SPEC
53 #define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
54
55 /* A standard GNU/Linux mapping.  On most targets, it is included in
56    CC1_SPEC itself by config/linux.h, but mips.h overrides CC1_SPEC
57    and provides this hook instead.  */
58 #undef SUBTARGET_CC1_SPEC
59 #define SUBTARGET_CC1_SPEC "%{profile:-p}"
60
61 /* From iris5.h */
62 /* -G is incompatible with -KPIC which is the default, so only allow objects
63    in the small data section if the user explicitly asks for it.  */
64 #undef MIPS_DEFAULT_GVALUE
65 #define MIPS_DEFAULT_GVALUE 0
66
67 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
68
69 /* Borrowed from sparc/linux.h */
70 #undef LINK_SPEC
71 #define LINK_SPEC \
72  "%(endian_spec) \
73   %{shared:-shared} \
74   %{!shared: \
75     %{!ibcs: \
76       %{!static: \
77         %{rdynamic:-export-dynamic} \
78         %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "}} \
79         %{static:-static}}}"
80
81 #undef SUBTARGET_ASM_SPEC
82 #define SUBTARGET_ASM_SPEC "%{mabi=64: -64} %{!mno-abicalls:-KPIC}"
83
84 /* The MIPS assembler has different syntax for .set. We set it to
85    .dummy to trap any errors.  */
86 #undef SET_ASM_OP
87 #define SET_ASM_OP "\t.dummy\t"
88
89 #undef ASM_OUTPUT_DEF
90 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                              \
91  do {                                                                   \
92         fputc ( '\t', FILE);                                            \
93         assemble_name (FILE, LABEL1);                                   \
94         fputs ( " = ", FILE);                                           \
95         assemble_name (FILE, LABEL2);                                   \
96         fputc ( '\n', FILE);                                            \
97  } while (0)
98
99 #undef ASM_DECLARE_FUNCTION_NAME
100 #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL)                   \
101   do {                                                                  \
102     if (!flag_inhibit_size_directive)                                   \
103       {                                                                 \
104         fputs ("\t.ent\t", STREAM);                                     \
105         assemble_name (STREAM, NAME);                                   \
106         putc ('\n', STREAM);                                            \
107       }                                                                 \
108     ASM_OUTPUT_TYPE_DIRECTIVE (STREAM, NAME, "function");               \
109     assemble_name (STREAM, NAME);                                       \
110     fputs (":\n", STREAM);                                              \
111   } while (0)
112
113 #undef ASM_DECLARE_FUNCTION_SIZE
114 #define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL)                   \
115   do {                                                                  \
116     if (!flag_inhibit_size_directive)                                   \
117       {                                                                 \
118         fputs ("\t.end\t", STREAM);                                     \
119         assemble_name (STREAM, NAME);                                   \
120         putc ('\n', STREAM);                                            \
121       }                                                                 \
122   } while (0)
123
124 /* Tell function_prologue in mips.c that we have already output the .ent/.end
125    pseudo-ops.  */
126 #undef FUNCTION_NAME_ALREADY_DECLARED
127 #define FUNCTION_NAME_ALREADY_DECLARED 1
128
129 /* The glibc _mcount stub will save $v0 for us.  Don't mess with saving
130    it, since ASM_OUTPUT_REG_PUSH/ASM_OUTPUT_REG_POP do not work in the
131    presence of $gp-relative calls.  */
132 #undef ASM_OUTPUT_REG_PUSH
133 #undef ASM_OUTPUT_REG_POP
134
135 #undef LIB_SPEC
136 #define LIB_SPEC "\
137 %{pthread:-lpthread} \
138 %{shared:-lc} \
139 %{!shared: \
140   %{profile:-lc_p} %{!profile:-lc}}"
141
142 #define MD_UNWIND_SUPPORT "config/mips/linux-unwind.h"
143
144 #ifdef HAVE_AS_NO_SHARED
145 /* Default to -mno-shared for non-PIC.  */
146 # define NO_SHARED_SPECS \
147   "%{mshared|mno-shared|fpic|fPIC|fpie|fPIE:;:-mno-shared}"
148 #else
149 # define NO_SHARED_SPECS ""
150 #endif
151
152 /* -march=native handling only makes sense with compiler running on
153    a MIPS chip.  */
154 #if defined(__mips__)
155 extern const char *host_detect_local_cpu (int argc, const char **argv);
156 # define EXTRA_SPEC_FUNCTIONS \
157   { "local_cpu_detect", host_detect_local_cpu },
158
159 # define MARCH_MTUNE_NATIVE_SPECS                               \
160   " %{march=native:%<march=native %:local_cpu_detect(arch)}"    \
161   " %{mtune=native:%<mtune=native %:local_cpu_detect(tune)}"
162 #else
163 # define MARCH_MTUNE_NATIVE_SPECS ""
164 #endif
165
166 #define BASE_DRIVER_SELF_SPECS \
167   NO_SHARED_SPECS \
168   MARCH_MTUNE_NATIVE_SPECS
169 #define DRIVER_SELF_SPECS BASE_DRIVER_SELF_SPECS