1 /* Definitions for MIPS running Linux-based GNU systems with ELF format.
2 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
3 Free Software Foundation, Inc.
5 This file is part of GNU CC.
7 GNU CC 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 GNU CC 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 GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, 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 /* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
38 separate, explicit argument. If you define this macro, it is used
39 in place of `ASM_OUTPUT_BSS', and gives you more flexibility in
40 handling the required alignment of the variable. The alignment is
41 specified as the number of bits.
43 Try to use function `asm_output_aligned_bss' defined in file
44 `varasm.c' when defining this macro. */
45 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
47 if (SIZE > 0 && (long)(SIZE) <= mips_section_threshold) \
48 named_section (0, ".sbss", 0); \
51 ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT)); \
52 last_assemble_variable_decl = DECL; \
53 ASM_DECLARE_OBJECT_NAME (FILE, NAME, DECL); \
54 ASM_OUTPUT_SKIP (FILE, SIZE ? SIZE : 1); \
57 #undef ASM_DECLARE_OBJECT_NAME
58 #define ASM_DECLARE_OBJECT_NAME mips_declare_object_name
61 #if TARGET_ENDIAN_DEFAULT == 0
62 #define TARGET_VERSION fprintf (stderr, " (MIPSel GNU/Linux with ELF)");
64 #define TARGET_VERSION fprintf (stderr, " (MIPS GNU/Linux with ELF)");
68 #undef MD_STARTFILE_PREFIX
70 /* If we don't set MASK_ABICALLS, we can't default to PIC. */
72 #define TARGET_DEFAULT (MASK_ABICALLS|MASK_GAS)
74 #define TARGET_OS_CPP_BUILTINS() \
76 builtin_define ("__gnu_linux__"); \
77 builtin_define ("__PIC__"); \
78 builtin_define ("__pic__"); \
79 builtin_define_std ("unix"); \
80 builtin_define_std ("linux"); \
81 builtin_assert ("system=linux"); \
82 /* The GNU C++ standard library requires this. */ \
83 if (c_dialect_cxx ()) \
84 builtin_define ("_GNU_SOURCE"); \
86 if (mips_abi == ABI_N32) \
88 builtin_define ("_ABIN32=2"); \
89 builtin_define ("_MIPS_SIM=_ABIN32"); \
90 builtin_define ("_MIPS_SZLONG=32"); \
91 builtin_define ("_MIPS_SZPTR=32"); \
93 else if (mips_abi == ABI_64) \
95 builtin_define ("_ABI64=3"); \
96 builtin_define ("_MIPS_SIM=_ABI64"); \
97 builtin_define ("_MIPS_SZLONG=64"); \
98 builtin_define ("_MIPS_SZPTR=64"); \
102 builtin_define ("_MIPS_SIM=_MIPS_SIM_ABI32"); \
103 builtin_define ("_MIPS_SZLONG=32"); \
104 builtin_define ("_MIPS_SZPTR=32"); \
106 if (TARGET_FLOAT64) \
107 builtin_define ("_MIPS_FPSET=32"); \
109 builtin_define ("_MIPS_FPSET=16"); \
112 builtin_define ("_MIPS_SZINT=64"); \
114 builtin_define ("_MIPS_SZINT=32"); \
117 #undef SUBTARGET_CPP_SPEC
118 #define SUBTARGET_CPP_SPEC "\
119 %{fno-PIC:-U__PIC__ -U__pic__} %{fno-pic:-U__PIC__ -U__pic__} \
120 %{fPIC|fPIE|fpic|fpie:-D__PIC__ -D__pic__} \
121 %{pthread:-D_REENTRANT}"
124 /* -G is incompatible with -KPIC which is the default, so only allow objects
125 in the small data section if the user explicitly asks for it. */
126 #undef MIPS_DEFAULT_GVALUE
127 #define MIPS_DEFAULT_GVALUE 0
129 /* Borrowed from sparc/linux.h */
137 %{rdynamic:-export-dynamic} \
138 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
141 #undef SUBTARGET_ASM_SPEC
142 #define SUBTARGET_ASM_SPEC "\
144 %{!fno-PIC:%{!fno-pic:-KPIC}} \
145 %{fno-PIC:-non_shared} %{fno-pic:-non_shared}"
147 #undef SUBTARGET_ASM_DEBUGGING_SPEC
148 #define SUBTARGET_ASM_DEBUGGING_SPEC "-g0"
150 /* The MIPS assembler has different syntax for .set. We set it to
151 .dummy to trap any errors. */
153 #define SET_ASM_OP "\t.dummy\t"
155 #undef ASM_OUTPUT_DEF
156 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
158 fputc ( '\t', FILE); \
159 assemble_name (FILE, LABEL1); \
160 fputs ( " = ", FILE); \
161 assemble_name (FILE, LABEL2); \
162 fputc ( '\n', FILE); \
165 #undef ASM_DECLARE_FUNCTION_NAME
166 #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
168 if (!flag_inhibit_size_directive) \
170 fputs ("\t.ent\t", STREAM); \
171 assemble_name (STREAM, NAME); \
172 putc ('\n', STREAM); \
174 ASM_OUTPUT_TYPE_DIRECTIVE (STREAM, NAME, "function"); \
175 assemble_name (STREAM, NAME); \
176 fputs (":\n", STREAM); \
179 #undef ASM_DECLARE_FUNCTION_SIZE
180 #define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL) \
182 if (!flag_inhibit_size_directive) \
184 fputs ("\t.end\t", STREAM); \
185 assemble_name (STREAM, NAME); \
186 putc ('\n', STREAM); \
190 /* Tell function_prologue in mips.c that we have already output the .ent/.end
192 #define FUNCTION_NAME_ALREADY_DECLARED
194 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
196 ? ((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4\
199 /* The glibc _mcount stub will save $v0 for us. Don't mess with saving
200 it, since ASM_OUTPUT_REG_PUSH/ASM_OUTPUT_REG_POP do not work in the
201 presence of $gp-relative calls. */
202 #undef ASM_OUTPUT_REG_PUSH
203 #undef ASM_OUTPUT_REG_POP
208 %{!static:-rpath-link %R/lib:%R/usr/lib} \
209 %{!shared: %{pthread:-lpthread} \
210 %{profile:-lc_p} %{!profile: -lc}}"