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.
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 2, 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 COPYING. If not, write to
19 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */
23 #define WCHAR_TYPE "int"
25 #undef WCHAR_TYPE_SIZE
26 #define WCHAR_TYPE_SIZE 32
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
35 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
37 #define ASM_OUTPUT_ALIGNED_BSS mips_output_aligned_bss
39 #undef ASM_DECLARE_OBJECT_NAME
40 #define ASM_DECLARE_OBJECT_NAME mips_declare_object_name
43 #if TARGET_ENDIAN_DEFAULT == 0
44 #define TARGET_VERSION fprintf (stderr, " (MIPSel GNU/Linux with ELF)");
46 #define TARGET_VERSION fprintf (stderr, " (MIPS GNU/Linux with ELF)");
50 #undef MD_STARTFILE_PREFIX
52 /* If we don't set MASK_ABICALLS, we can't default to PIC. */
54 #define TARGET_DEFAULT MASK_ABICALLS
56 #define TARGET_OS_CPP_BUILTINS() \
58 LINUX_TARGET_OS_CPP_BUILTINS(); \
59 /* The GNU C++ standard library requires this. */ \
60 if (c_dialect_cxx ()) \
61 builtin_define ("_GNU_SOURCE"); \
63 if (mips_abi == ABI_N32) \
65 builtin_define ("_ABIN32=2"); \
66 builtin_define ("_MIPS_SIM=_ABIN32"); \
67 builtin_define ("_MIPS_SZLONG=32"); \
68 builtin_define ("_MIPS_SZPTR=32"); \
70 else if (mips_abi == ABI_64) \
72 builtin_define ("_ABI64=3"); \
73 builtin_define ("_MIPS_SIM=_ABI64"); \
74 builtin_define ("_MIPS_SZLONG=64"); \
75 builtin_define ("_MIPS_SZPTR=64"); \
79 builtin_define ("_ABIO32=1"); \
80 builtin_define ("_MIPS_SIM=_ABIO32"); \
81 builtin_define ("_MIPS_SZLONG=32"); \
82 builtin_define ("_MIPS_SZPTR=32"); \
85 builtin_define ("_MIPS_FPSET=32"); \
87 builtin_define ("_MIPS_FPSET=16"); \
89 builtin_define ("_MIPS_SZINT=32"); \
92 #undef SUBTARGET_CPP_SPEC
93 #define SUBTARGET_CPP_SPEC "%{pthread:-D_REENTRANT}"
95 /* A standard GNU/Linux mapping. On most targets, it is included in
96 CC1_SPEC itself by config/linux.h, but mips.h overrides CC1_SPEC
97 and provides this hook instead. */
98 #undef SUBTARGET_CC1_SPEC
99 #define SUBTARGET_CC1_SPEC "%{profile:-p}"
102 /* -G is incompatible with -KPIC which is the default, so only allow objects
103 in the small data section if the user explicitly asks for it. */
104 #undef MIPS_DEFAULT_GVALUE
105 #define MIPS_DEFAULT_GVALUE 0
107 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
109 /* Borrowed from sparc/linux.h */
117 %{rdynamic:-export-dynamic} \
118 %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "}} \
121 #undef SUBTARGET_ASM_SPEC
122 #define SUBTARGET_ASM_SPEC "%{mabi=64: -64} %{!mno-abicalls:-KPIC}"
124 /* The MIPS assembler has different syntax for .set. We set it to
125 .dummy to trap any errors. */
127 #define SET_ASM_OP "\t.dummy\t"
129 #undef ASM_OUTPUT_DEF
130 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
132 fputc ( '\t', FILE); \
133 assemble_name (FILE, LABEL1); \
134 fputs ( " = ", FILE); \
135 assemble_name (FILE, LABEL2); \
136 fputc ( '\n', FILE); \
139 #undef ASM_DECLARE_FUNCTION_NAME
140 #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
142 if (!flag_inhibit_size_directive) \
144 fputs ("\t.ent\t", STREAM); \
145 assemble_name (STREAM, NAME); \
146 putc ('\n', STREAM); \
148 ASM_OUTPUT_TYPE_DIRECTIVE (STREAM, NAME, "function"); \
149 assemble_name (STREAM, NAME); \
150 fputs (":\n", STREAM); \
153 #undef ASM_DECLARE_FUNCTION_SIZE
154 #define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL) \
156 if (!flag_inhibit_size_directive) \
158 fputs ("\t.end\t", STREAM); \
159 assemble_name (STREAM, NAME); \
160 putc ('\n', STREAM); \
164 /* Tell function_prologue in mips.c that we have already output the .ent/.end
166 #undef FUNCTION_NAME_ALREADY_DECLARED
167 #define FUNCTION_NAME_ALREADY_DECLARED 1
169 /* The glibc _mcount stub will save $v0 for us. Don't mess with saving
170 it, since ASM_OUTPUT_REG_PUSH/ASM_OUTPUT_REG_POP do not work in the
171 presence of $gp-relative calls. */
172 #undef ASM_OUTPUT_REG_PUSH
173 #undef ASM_OUTPUT_REG_POP
178 %{!shared: %{pthread:-lpthread} \
179 %{profile:-lc_p} %{!profile: -lc}}"
181 #define MD_UNWIND_SUPPORT "config/mips/linux-unwind.h"