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.
5 This file is part of GCC.
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)
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.
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/>. */
22 #define WCHAR_TYPE "int"
24 #undef WCHAR_TYPE_SIZE
25 #define WCHAR_TYPE_SIZE 32
27 #undef ASM_DECLARE_OBJECT_NAME
28 #define ASM_DECLARE_OBJECT_NAME mips_declare_object_name
31 #if TARGET_ENDIAN_DEFAULT == 0
32 #define TARGET_VERSION fprintf (stderr, " (MIPSel GNU/Linux with ELF)");
34 #define TARGET_VERSION fprintf (stderr, " (MIPS GNU/Linux with ELF)");
38 #undef MD_STARTFILE_PREFIX
40 /* If we don't set MASK_ABICALLS, we can't default to PIC. */
42 #define TARGET_DEFAULT MASK_ABICALLS
44 #define TARGET_OS_CPP_BUILTINS() \
46 LINUX_TARGET_OS_CPP_BUILTINS(); \
47 /* The GNU C++ standard library requires this. */ \
48 if (c_dialect_cxx ()) \
49 builtin_define ("_GNU_SOURCE"); \
52 #undef SUBTARGET_CPP_SPEC
53 #define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
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}"
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
67 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
69 /* Borrowed from sparc/linux.h */
77 %{rdynamic:-export-dynamic} \
78 %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "}} \
81 #undef SUBTARGET_ASM_SPEC
82 #define SUBTARGET_ASM_SPEC "%{mabi=64: -64} %{!mno-abicalls:-KPIC}"
84 /* The MIPS assembler has different syntax for .set. We set it to
85 .dummy to trap any errors. */
87 #define SET_ASM_OP "\t.dummy\t"
90 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
92 fputc ( '\t', FILE); \
93 assemble_name (FILE, LABEL1); \
94 fputs ( " = ", FILE); \
95 assemble_name (FILE, LABEL2); \
96 fputc ( '\n', FILE); \
99 #undef ASM_DECLARE_FUNCTION_NAME
100 #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
102 if (!flag_inhibit_size_directive) \
104 fputs ("\t.ent\t", STREAM); \
105 assemble_name (STREAM, NAME); \
106 putc ('\n', STREAM); \
108 ASM_OUTPUT_TYPE_DIRECTIVE (STREAM, NAME, "function"); \
109 assemble_name (STREAM, NAME); \
110 fputs (":\n", STREAM); \
113 #undef ASM_DECLARE_FUNCTION_SIZE
114 #define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL) \
116 if (!flag_inhibit_size_directive) \
118 fputs ("\t.end\t", STREAM); \
119 assemble_name (STREAM, NAME); \
120 putc ('\n', STREAM); \
124 /* Tell function_prologue in mips.c that we have already output the .ent/.end
126 #undef FUNCTION_NAME_ALREADY_DECLARED
127 #define FUNCTION_NAME_ALREADY_DECLARED 1
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
137 %{pthread:-lpthread} \
140 %{profile:-lc_p} %{!profile:-lc}}"
142 #define MD_UNWIND_SUPPORT "config/mips/linux-unwind.h"
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}"
149 # define NO_SHARED_SPECS ""
152 /* -march=native handling only makes sense with compiler running on
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 },
159 # define MARCH_MTUNE_NATIVE_SPECS \
160 " %{march=native:%<march=native %:local_cpu_detect(arch)}" \
161 " %{mtune=native:%<mtune=native %:local_cpu_detect(tune)}"
163 # define MARCH_MTUNE_NATIVE_SPECS ""
166 #define BASE_DRIVER_SELF_SPECS \
168 MARCH_MTUNE_NATIVE_SPECS
169 #define DRIVER_SELF_SPECS BASE_DRIVER_SELF_SPECS