* c-cppbuiltin.c (c_cpp_builtins): Define __pic__ and __PIC__ when
[official-gcc.git] / gcc / config / mips / linux.h
bloba135bba75a8a22ed6b5bd0407795f823acf89ceb
1 /* Definitions for MIPS running Linux-based GNU systems with ELF format.
2 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
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)
10 any later version.
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. */
22 #undef WCHAR_TYPE
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
34 used. */
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
42 #undef TARGET_VERSION
43 #if TARGET_ENDIAN_DEFAULT == 0
44 #define TARGET_VERSION fprintf (stderr, " (MIPSel GNU/Linux with ELF)");
45 #else
46 #define TARGET_VERSION fprintf (stderr, " (MIPS GNU/Linux with ELF)");
47 #endif
49 #undef MD_EXEC_PREFIX
50 #undef MD_STARTFILE_PREFIX
52 /* If we don't set MASK_ABICALLS, we can't default to PIC. */
53 #undef TARGET_DEFAULT
54 #define TARGET_DEFAULT MASK_ABICALLS
56 #define TARGET_OS_CPP_BUILTINS() \
57 do { \
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) \
64 { \
65 builtin_define ("_ABIN32=2"); \
66 builtin_define ("_MIPS_SIM=_ABIN32"); \
67 builtin_define ("_MIPS_SZLONG=32"); \
68 builtin_define ("_MIPS_SZPTR=32"); \
69 } \
70 else if (mips_abi == ABI_64) \
71 { \
72 builtin_define ("_ABI64=3"); \
73 builtin_define ("_MIPS_SIM=_ABI64"); \
74 builtin_define ("_MIPS_SZLONG=64"); \
75 builtin_define ("_MIPS_SZPTR=64"); \
76 } \
77 else \
78 { \
79 builtin_define ("_ABIO32=1"); \
80 builtin_define ("_MIPS_SIM=_ABIO32"); \
81 builtin_define ("_MIPS_SZLONG=32"); \
82 builtin_define ("_MIPS_SZPTR=32"); \
83 } \
84 if (TARGET_FLOAT64) \
85 builtin_define ("_MIPS_FPSET=32"); \
86 else \
87 builtin_define ("_MIPS_FPSET=16"); \
89 builtin_define ("_MIPS_SZINT=32"); \
90 } while (0)
92 #undef SUBTARGET_CPP_SPEC
93 #define SUBTARGET_CPP_SPEC "%{pthread:-D_REENTRANT}"
95 /* From iris5.h */
96 /* -G is incompatible with -KPIC which is the default, so only allow objects
97 in the small data section if the user explicitly asks for it. */
98 #undef MIPS_DEFAULT_GVALUE
99 #define MIPS_DEFAULT_GVALUE 0
101 /* Borrowed from sparc/linux.h */
102 #undef LINK_SPEC
103 #define LINK_SPEC \
104 "%(endian_spec) \
105 %{shared:-shared} \
106 %{!shared: \
107 %{!ibcs: \
108 %{!static: \
109 %{rdynamic:-export-dynamic} \
110 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
111 %{static:-static}}}"
113 #undef SUBTARGET_ASM_SPEC
114 #define SUBTARGET_ASM_SPEC "%{mabi=64: -64} %{!mno-abicalls:-KPIC}"
116 /* The MIPS assembler has different syntax for .set. We set it to
117 .dummy to trap any errors. */
118 #undef SET_ASM_OP
119 #define SET_ASM_OP "\t.dummy\t"
121 #undef ASM_OUTPUT_DEF
122 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
123 do { \
124 fputc ( '\t', FILE); \
125 assemble_name (FILE, LABEL1); \
126 fputs ( " = ", FILE); \
127 assemble_name (FILE, LABEL2); \
128 fputc ( '\n', FILE); \
129 } while (0)
131 #undef ASM_DECLARE_FUNCTION_NAME
132 #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
133 do { \
134 if (!flag_inhibit_size_directive) \
136 fputs ("\t.ent\t", STREAM); \
137 assemble_name (STREAM, NAME); \
138 putc ('\n', STREAM); \
140 ASM_OUTPUT_TYPE_DIRECTIVE (STREAM, NAME, "function"); \
141 assemble_name (STREAM, NAME); \
142 fputs (":\n", STREAM); \
143 } while (0)
145 #undef ASM_DECLARE_FUNCTION_SIZE
146 #define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL) \
147 do { \
148 if (!flag_inhibit_size_directive) \
150 fputs ("\t.end\t", STREAM); \
151 assemble_name (STREAM, NAME); \
152 putc ('\n', STREAM); \
154 } while (0)
156 /* Tell function_prologue in mips.c that we have already output the .ent/.end
157 pseudo-ops. */
158 #undef FUNCTION_NAME_ALREADY_DECLARED
159 #define FUNCTION_NAME_ALREADY_DECLARED 1
161 /* The glibc _mcount stub will save $v0 for us. Don't mess with saving
162 it, since ASM_OUTPUT_REG_PUSH/ASM_OUTPUT_REG_POP do not work in the
163 presence of $gp-relative calls. */
164 #undef ASM_OUTPUT_REG_PUSH
165 #undef ASM_OUTPUT_REG_POP
167 #undef LIB_SPEC
168 #define LIB_SPEC "\
169 %{shared: -lc} \
170 %{!shared: %{pthread:-lpthread} \
171 %{profile:-lc_p} %{!profile: -lc}}"
173 #define MD_UNWIND_SUPPORT "config/mips/linux-unwind.h"