OSDN Git Service

af03c3d19f02b92a6d1b2e45d81d811a96c3e399
[pf3gnuchains/gcc-fork.git] / gcc / config / mips / gnu-user.h
1 /* Definitions for MIPS systems using GNU userspace.
2    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
3    2007, 2008, 2010, 2011, 2012 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 /* If we don't set MASK_ABICALLS, we can't default to PIC.  */
31 #undef TARGET_DEFAULT
32 #define TARGET_DEFAULT MASK_ABICALLS
33
34 #define TARGET_OS_CPP_BUILTINS()                                \
35   do {                                                          \
36     GNU_USER_TARGET_OS_CPP_BUILTINS();                          \
37     /* The GNU C++ standard library requires this.  */          \
38     if (c_dialect_cxx ())                                       \
39       builtin_define ("_GNU_SOURCE");                           \
40   } while (0)
41
42 #undef SUBTARGET_CPP_SPEC
43 #define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
44
45 /* A standard GNU/Linux mapping.  On most targets, it is included in
46    CC1_SPEC itself by config/linux.h, but mips.h overrides CC1_SPEC
47    and provides this hook instead.  */
48 #undef SUBTARGET_CC1_SPEC
49 #define SUBTARGET_CC1_SPEC "%{profile:-p}"
50
51 /* -G is incompatible with -KPIC which is the default, so only allow objects
52    in the small data section if the user explicitly asks for it.  */
53 #undef MIPS_DEFAULT_GVALUE
54 #define MIPS_DEFAULT_GVALUE 0
55
56 /* Borrowed from sparc/linux.h */
57 #undef LINK_SPEC
58 #define LINK_SPEC \
59  "%(endian_spec) \
60   %{shared:-shared} \
61   %{!shared: \
62     %{!static: \
63       %{rdynamic:-export-dynamic} \
64       -dynamic-linker " GNU_USER_DYNAMIC_LINKER "} \
65       %{static:-static}}"
66
67 #undef SUBTARGET_ASM_SPEC
68 #define SUBTARGET_ASM_SPEC \
69   "%{!mno-abicalls:%{mplt:-call_nonpic;:-KPIC}}"
70
71 /* The MIPS assembler has different syntax for .set. We set it to
72    .dummy to trap any errors.  */
73 #undef SET_ASM_OP
74 #define SET_ASM_OP "\t.dummy\t"
75
76 #undef ASM_OUTPUT_DEF
77 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                              \
78  do {                                                                   \
79         fputc ( '\t', FILE);                                            \
80         assemble_name (FILE, LABEL1);                                   \
81         fputs ( " = ", FILE);                                           \
82         assemble_name (FILE, LABEL2);                                   \
83         fputc ( '\n', FILE);                                            \
84  } while (0)
85
86 /* The glibc _mcount stub will save $v0 for us.  Don't mess with saving
87    it, since ASM_OUTPUT_REG_PUSH/ASM_OUTPUT_REG_POP do not work in the
88    presence of $gp-relative calls.  */
89 #undef ASM_OUTPUT_REG_PUSH
90 #undef ASM_OUTPUT_REG_POP
91
92 #undef LIB_SPEC
93 #define LIB_SPEC "\
94 %{pthread:-lpthread} \
95 %{shared:-lc} \
96 %{!shared: \
97   %{profile:-lc_p} %{!profile:-lc}}"
98
99 #ifdef HAVE_AS_NO_SHARED
100 /* Default to -mno-shared for non-PIC.  */
101 # define NO_SHARED_SPECS \
102   "%{mshared|mno-shared|fpic|fPIC|fpie|fPIE:;:-mno-shared}"
103 #else
104 # define NO_SHARED_SPECS ""
105 #endif
106
107 /* -march=native handling only makes sense with compiler running on
108    a MIPS chip.  */
109 #if defined(__mips__)
110 extern const char *host_detect_local_cpu (int argc, const char **argv);
111 # define EXTRA_SPEC_FUNCTIONS \
112   { "local_cpu_detect", host_detect_local_cpu },
113
114 # define MARCH_MTUNE_NATIVE_SPECS                               \
115   " %{march=native:%<march=native %:local_cpu_detect(arch)}"    \
116   " %{mtune=native:%<mtune=native %:local_cpu_detect(tune)}"
117 #else
118 # define MARCH_MTUNE_NATIVE_SPECS ""
119 #endif
120
121 #define LINUX_DRIVER_SELF_SPECS \
122   NO_SHARED_SPECS                                                       \
123   MARCH_MTUNE_NATIVE_SPECS,                                             \
124   /* -mplt has no effect without -mno-shared.  Simplify later           \
125      specs handling by removing a redundant option.  */                 \
126   "%{!mno-shared:%<mplt}",                                              \
127   /* -mplt likewise has no effect for -mabi=64 without -msym32.  */     \
128   "%{mabi=64:%{!msym32:%<mplt}}"
129
130 #undef DRIVER_SELF_SPECS
131 #define DRIVER_SELF_SPECS \
132   BASE_DRIVER_SELF_SPECS, \
133   LINUX_DRIVER_SELF_SPECS
134
135 /* Similar to standard Linux, but adding -ffast-math support.  */
136 #undef  ENDFILE_SPEC
137 #define ENDFILE_SPEC \
138   "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
139    %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"