]>
git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/mips/linux.h
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, 2008 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 \
83 "%{!mno-abicalls:%{mplt:-call_nonpic;:-KPIC}}"
85 /* The MIPS assembler has different syntax for .set. We set it to
86 .dummy to trap any errors. */
88 #define SET_ASM_OP "\t.dummy\t"
91 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
93 fputc ( '\t', FILE); \
94 assemble_name (FILE, LABEL1); \
95 fputs ( " = ", FILE); \
96 assemble_name (FILE, LABEL2); \
97 fputc ( '\n', FILE); \
100 /* The glibc _mcount stub will save $v0 for us. Don't mess with saving
101 it, since ASM_OUTPUT_REG_PUSH/ASM_OUTPUT_REG_POP do not work in the
102 presence of $gp-relative calls. */
103 #undef ASM_OUTPUT_REG_PUSH
104 #undef ASM_OUTPUT_REG_POP
108 %{pthread:-lpthread} \
111 %{profile:-lc_p} %{!profile:-lc}}"
113 #define MD_UNWIND_SUPPORT "config/mips/linux-unwind.h"
115 #ifdef HAVE_AS_NO_SHARED
116 /* Default to -mno-shared for non-PIC. */
117 # define NO_SHARED_SPECS \
118 "%{mshared|mno-shared|fpic|fPIC|fpie|fPIE:;:-mno-shared}"
120 # define NO_SHARED_SPECS ""
123 /* -march=native handling only makes sense with compiler running on
125 #if defined(__mips__)
126 extern const char *host_detect_local_cpu (int argc
, const char **argv
);
127 # define EXTRA_SPEC_FUNCTIONS \
128 { "local_cpu_detect", host_detect_local_cpu },
130 # define MARCH_MTUNE_NATIVE_SPECS \
131 " %{march=native:%<march=native %:local_cpu_detect(arch)}" \
132 " %{mtune=native:%<mtune=native %:local_cpu_detect(tune)}"
134 # define MARCH_MTUNE_NATIVE_SPECS ""
137 #define LINUX_DRIVER_SELF_SPECS \
139 MARCH_MTUNE_NATIVE_SPECS, \
140 /* -mplt has no effect without -mno-shared. Simplify later \
141 specs handling by removing a redundant option. */ \
142 "%{!mno-shared:%<mplt}", \
143 /* -mplt likewise has no effect for -mabi=64 without -msym32. */ \
144 "%{mabi=64:%{!msym32:%<mplt}}"
146 #undef DRIVER_SELF_SPECS
147 #define DRIVER_SELF_SPECS \
148 BASE_DRIVER_SELF_SPECS, \
149 LINUX_DRIVER_SELF_SPECS
151 /* Similar to standard Linux, but adding -ffast-math support. */
153 #define ENDFILE_SPEC \
154 "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
155 %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"