Merge aosp-toolchain/gcc/gcc-4_9 changes.
[official-gcc.git] / gcc-4_9 / gcc / config / mips / gnu-user.h
blobb0033e231b584d6f7ecc4c6c659db44970543862
1 /* Definitions for MIPS systems using GNU userspace.
2 Copyright (C) 1998-2014 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
9 any later version.
11 GCC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #undef WCHAR_TYPE
21 #define WCHAR_TYPE "int"
23 #undef WCHAR_TYPE_SIZE
24 #define WCHAR_TYPE_SIZE 32
26 #undef ASM_DECLARE_OBJECT_NAME
27 #define ASM_DECLARE_OBJECT_NAME mips_declare_object_name
29 /* If we don't set MASK_ABICALLS, we can't default to PIC. */
30 #undef TARGET_DEFAULT
31 #define TARGET_DEFAULT MASK_ABICALLS
33 #define TARGET_OS_CPP_BUILTINS() \
34 do { \
35 GNU_USER_TARGET_OS_CPP_BUILTINS(); \
36 /* The GNU C++ standard library requires this. */ \
37 if (c_dialect_cxx ()) \
38 builtin_define ("_GNU_SOURCE"); \
39 ANDROID_TARGET_OS_CPP_BUILTINS(); \
40 } while (0)
42 #undef SUBTARGET_CPP_SPEC
43 #define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
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 GNU_USER_TARGET_CC1_SPEC
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
56 #undef GNU_USER_TARGET_LINK_SPEC
57 #define GNU_USER_TARGET_LINK_SPEC "\
58 %{G*} %{EB} %{EL} %{mips*} %{shared} \
59 %{!shared: \
60 %{!static: \
61 %{rdynamic:-export-dynamic} \
62 %{mabi=n32: -dynamic-linker " GNU_USER_DYNAMIC_LINKERN32 "} \
63 %{mabi=64: -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "} \
64 %{mabi=32: -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}} \
65 %{static}} \
66 %{mabi=n32:-m" GNU_USER_LINK_EMULATIONN32 "} \
67 %{mabi=64:-m" GNU_USER_LINK_EMULATION64 "} \
68 %{mabi=32:-m" GNU_USER_LINK_EMULATION32 "}"
70 #undef LINK_SPEC
71 #define LINK_SPEC GNU_USER_TARGET_LINK_SPEC
73 #undef SUBTARGET_ASM_SPEC
74 #define SUBTARGET_ASM_SPEC \
75 "%{!mno-abicalls:%{mplt:-call_nonpic;:-KPIC}} " \
76 LINUX_OR_ANDROID_CC ("", ANDROID_ASM_SPEC)
78 /* The MIPS assembler has different syntax for .set. We set it to
79 .dummy to trap any errors. */
80 #undef SET_ASM_OP
81 #define SET_ASM_OP "\t.dummy\t"
83 #undef ASM_OUTPUT_DEF
84 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
85 do { \
86 fputc ( '\t', FILE); \
87 assemble_name (FILE, LABEL1); \
88 fputs ( " = ", FILE); \
89 assemble_name (FILE, LABEL2); \
90 fputc ( '\n', FILE); \
91 } while (0)
93 /* The glibc _mcount stub will save $v0 for us. Don't mess with saving
94 it, since ASM_OUTPUT_REG_PUSH/ASM_OUTPUT_REG_POP do not work in the
95 presence of $gp-relative calls. */
96 #undef ASM_OUTPUT_REG_PUSH
97 #undef ASM_OUTPUT_REG_POP
99 #undef LIB_SPEC
100 #define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
102 #ifdef HAVE_AS_NO_SHARED
103 /* Default to -mno-shared for non-PIC. */
104 # define NO_SHARED_SPECS \
105 " %{mshared|mno-shared|fpic|fPIC|fpie|fPIE:;:-mno-shared}"
106 #else
107 # define NO_SHARED_SPECS ""
108 #endif
110 /* -march=native handling only makes sense with compiler running on
111 a MIPS chip. */
112 #if defined(__mips__)
113 extern const char *host_detect_local_cpu (int argc, const char **argv);
114 # define EXTRA_SPEC_FUNCTIONS \
115 { "local_cpu_detect", host_detect_local_cpu },
117 # define MARCH_MTUNE_NATIVE_SPECS \
118 " %{march=native:%<march=native %:local_cpu_detect(arch)}" \
119 " %{mtune=native:%<mtune=native %:local_cpu_detect(tune)}"
120 #else
121 # define MARCH_MTUNE_NATIVE_SPECS ""
122 #endif
124 #define LINUX_DRIVER_SELF_SPECS \
125 LINUX_OR_ANDROID_CC(NO_SHARED_SPECS, "") \
126 MARCH_MTUNE_NATIVE_SPECS, \
127 /* -mplt has no effect without -mno-shared. Simplify later \
128 specs handling by removing a redundant option. */ \
129 "%{!mno-shared:%<mplt}", \
130 /* -mplt likewise has no effect for -mabi=64 without -msym32. */ \
131 "%{mabi=64:%{!msym32:%<mplt}}", \
132 "%{!EB:%{!EL:%(endian_spec)}}", \
133 "%{!mabi=*: -" MULTILIB_ABI_DEFAULT "}"
135 #undef DRIVER_SELF_SPECS
136 #define DRIVER_SELF_SPECS \
137 MIPS_ISA_LEVEL_SPEC, \
138 BASE_DRIVER_SELF_SPECS, \
139 LINUX_DRIVER_SELF_SPECS
141 /* Similar to standard Linux, but adding -ffast-math support. */
142 #undef GNU_USER_TARGET_MATHFILE_SPEC
143 #define GNU_USER_TARGET_MATHFILE_SPEC \
144 "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
145 #undef ENDFILE_SPEC
146 #define ENDFILE_SPEC \
147 GNU_USER_TARGET_MATHFILE_SPEC " " \
148 GNU_USER_TARGET_ENDFILE_SPEC
150 #undef LOCAL_LABEL_PREFIX
151 #define LOCAL_LABEL_PREFIX (TARGET_OLDABI ? "$" : ".")