1 |
282 |
jeremybenn |
/* 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.
|
4 |
|
|
|
5 |
|
|
This file is part of GCC.
|
6 |
|
|
|
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)
|
10 |
|
|
any later version.
|
11 |
|
|
|
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.
|
16 |
|
|
|
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/>. */
|
20 |
|
|
|
21 |
|
|
#undef WCHAR_TYPE
|
22 |
|
|
#define WCHAR_TYPE "int"
|
23 |
|
|
|
24 |
|
|
#undef WCHAR_TYPE_SIZE
|
25 |
|
|
#define WCHAR_TYPE_SIZE 32
|
26 |
|
|
|
27 |
|
|
#undef ASM_DECLARE_OBJECT_NAME
|
28 |
|
|
#define ASM_DECLARE_OBJECT_NAME mips_declare_object_name
|
29 |
|
|
|
30 |
|
|
#undef TARGET_VERSION
|
31 |
|
|
#if TARGET_ENDIAN_DEFAULT == 0
|
32 |
|
|
#define TARGET_VERSION fprintf (stderr, " (MIPSel GNU/Linux with ELF)");
|
33 |
|
|
#else
|
34 |
|
|
#define TARGET_VERSION fprintf (stderr, " (MIPS GNU/Linux with ELF)");
|
35 |
|
|
#endif
|
36 |
|
|
|
37 |
|
|
#undef MD_EXEC_PREFIX
|
38 |
|
|
#undef MD_STARTFILE_PREFIX
|
39 |
|
|
|
40 |
|
|
/* If we don't set MASK_ABICALLS, we can't default to PIC. */
|
41 |
|
|
#undef TARGET_DEFAULT
|
42 |
|
|
#define TARGET_DEFAULT MASK_ABICALLS
|
43 |
|
|
|
44 |
|
|
#define TARGET_OS_CPP_BUILTINS() \
|
45 |
|
|
do { \
|
46 |
|
|
LINUX_TARGET_OS_CPP_BUILTINS(); \
|
47 |
|
|
/* The GNU C++ standard library requires this. */ \
|
48 |
|
|
if (c_dialect_cxx ()) \
|
49 |
|
|
builtin_define ("_GNU_SOURCE"); \
|
50 |
|
|
} while (0)
|
51 |
|
|
|
52 |
|
|
#undef SUBTARGET_CPP_SPEC
|
53 |
|
|
#define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
|
54 |
|
|
|
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}"
|
60 |
|
|
|
61 |
|
|
/* From iris5.h */
|
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
|
66 |
|
|
|
67 |
|
|
#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
|
68 |
|
|
|
69 |
|
|
/* Borrowed from sparc/linux.h */
|
70 |
|
|
#undef LINK_SPEC
|
71 |
|
|
#define LINK_SPEC \
|
72 |
|
|
"%(endian_spec) \
|
73 |
|
|
%{shared:-shared} \
|
74 |
|
|
%{!shared: \
|
75 |
|
|
%{!ibcs: \
|
76 |
|
|
%{!static: \
|
77 |
|
|
%{rdynamic:-export-dynamic} \
|
78 |
|
|
%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "}} \
|
79 |
|
|
%{static:-static}}}"
|
80 |
|
|
|
81 |
|
|
#undef SUBTARGET_ASM_SPEC
|
82 |
|
|
#define SUBTARGET_ASM_SPEC \
|
83 |
|
|
"%{!mno-abicalls:%{mplt:-call_nonpic;:-KPIC}}"
|
84 |
|
|
|
85 |
|
|
/* The MIPS assembler has different syntax for .set. We set it to
|
86 |
|
|
.dummy to trap any errors. */
|
87 |
|
|
#undef SET_ASM_OP
|
88 |
|
|
#define SET_ASM_OP "\t.dummy\t"
|
89 |
|
|
|
90 |
|
|
#undef ASM_OUTPUT_DEF
|
91 |
|
|
#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
|
92 |
|
|
do { \
|
93 |
|
|
fputc ( '\t', FILE); \
|
94 |
|
|
assemble_name (FILE, LABEL1); \
|
95 |
|
|
fputs ( " = ", FILE); \
|
96 |
|
|
assemble_name (FILE, LABEL2); \
|
97 |
|
|
fputc ( '\n', FILE); \
|
98 |
|
|
} while (0)
|
99 |
|
|
|
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
|
105 |
|
|
|
106 |
|
|
#undef LIB_SPEC
|
107 |
|
|
#define LIB_SPEC "\
|
108 |
|
|
%{pthread:-lpthread} \
|
109 |
|
|
%{shared:-lc} \
|
110 |
|
|
%{!shared: \
|
111 |
|
|
%{profile:-lc_p} %{!profile:-lc}}"
|
112 |
|
|
|
113 |
|
|
#define MD_UNWIND_SUPPORT "config/mips/linux-unwind.h"
|
114 |
|
|
|
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}"
|
119 |
|
|
#else
|
120 |
|
|
# define NO_SHARED_SPECS ""
|
121 |
|
|
#endif
|
122 |
|
|
|
123 |
|
|
/* -march=native handling only makes sense with compiler running on
|
124 |
|
|
a MIPS chip. */
|
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 },
|
129 |
|
|
|
130 |
|
|
# define MARCH_MTUNE_NATIVE_SPECS \
|
131 |
|
|
" %{march=native:%<march=native %:local_cpu_detect(arch)}" \
|
132 |
|
|
" %{mtune=native:%<mtune=native %:local_cpu_detect(tune)}"
|
133 |
|
|
#else
|
134 |
|
|
# define MARCH_MTUNE_NATIVE_SPECS ""
|
135 |
|
|
#endif
|
136 |
|
|
|
137 |
|
|
#define LINUX_DRIVER_SELF_SPECS \
|
138 |
|
|
NO_SHARED_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}}"
|
145 |
|
|
|
146 |
|
|
#undef DRIVER_SELF_SPECS
|
147 |
|
|
#define DRIVER_SELF_SPECS \
|
148 |
|
|
BASE_DRIVER_SELF_SPECS, \
|
149 |
|
|
LINUX_DRIVER_SELF_SPECS
|