linux.h (PREFERRED_DEBUGGING_TYPE): Remove.
[gcc.git] / gcc / config / sparc / linux.h
1 /* Definitions for SPARC running Linux-based GNU systems with ELF.
2 Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 Contributed by Eddie C. Dost (ecd@skynet.be)
4
5 This file is part of GNU CC.
6
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)
10 any later version.
11
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.
16
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. */
21
22 #define LINUX_DEFAULT_ELF
23
24 /* Don't assume anything about the header files. */
25 #define NO_IMPLICIT_EXTERN_C
26
27 /* GNU/Linux uses ctype from glibc.a. I am not sure how complete it is.
28 For now, we play safe. It may change later. */
29
30 #if 0
31 #undef MULTIBYTE_CHARS
32 #define MULTIBYTE_CHARS 1
33 #endif
34
35 #undef MD_EXEC_PREFIX
36 #undef MD_STARTFILE_PREFIX
37
38 /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add
39 the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
40 provides part of the support for getting C++ file-scope static
41 object constructed before entering `main'. */
42
43 #undef STARTFILE_SPEC
44 #ifdef USE_GNULIBC_1
45 #define STARTFILE_SPEC \
46 "%{!shared: \
47 %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\
48 crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
49 #else
50 #define STARTFILE_SPEC \
51 "%{!shared: \
52 %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\
53 crti.o%s %{static:crtbeginT.o%s}\
54 %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}"
55 #endif
56
57 /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
58 the GNU/Linux magical crtend.o file (see crtstuff.c) which
59 provides part of the support for getting C++ file-scope static
60 object constructed before entering `main', followed by a normal
61 GNU/Linux "finalizer" file, `crtn.o'. */
62
63 #undef ENDFILE_SPEC
64 #define ENDFILE_SPEC \
65 "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
66
67 /* This is for -profile to use -lc_p instead of -lc. */
68 #undef CC1_SPEC
69 #define CC1_SPEC "%{profile:-p} \
70 %{sun4:} %{target:} \
71 %{mcypress:-mcpu=cypress} \
72 %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
73 %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
74 "
75
76 /* The GNU C++ standard library requires that these macros be defined. */
77 #undef CPLUSPLUS_CPP_SPEC
78 #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
79
80 #undef TARGET_VERSION
81 #define TARGET_VERSION fprintf (stderr, " (sparc GNU/Linux with ELF)");
82
83 #undef SUBTARGET_SWITCHES
84 #define SUBTARGET_SWITCHES \
85 {"long-double-64", -MASK_LONG_DOUBLE_128, N_("Use 64 bit long doubles") }, \
86 {"long-double-128", MASK_LONG_DOUBLE_128, N_("Use 128 bit long doubles") },
87
88 #undef SIZE_TYPE
89 #define SIZE_TYPE "unsigned int"
90
91 #undef PTRDIFF_TYPE
92 #define PTRDIFF_TYPE "int"
93
94 #undef WCHAR_TYPE
95 #define WCHAR_TYPE "int"
96
97 #undef WCHAR_TYPE_SIZE
98 #define WCHAR_TYPE_SIZE 32
99
100 #undef MAX_WCHAR_TYPE_SIZE
101
102 #undef CPP_PREDEFINES
103 #define CPP_PREDEFINES "-D__ELF__ -Dunix -D__sparc__ -Dlinux -Asystem=unix -Asystem=posix"
104
105 #undef CPP_SUBTARGET_SPEC
106 #ifdef USE_GNULIBC_1
107 #define CPP_SUBTARGET_SPEC \
108 "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE} \
109 %{mlong-double-128:-D__LONG_DOUBLE_128__}"
110 #else
111 #define CPP_SUBTARGET_SPEC \
112 "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE} \
113 %{pthread:-D_REENTRANT} %{mlong-double-128:-D__LONG_DOUBLE_128__}"
114 #endif
115
116 #undef LIB_SPEC
117 /* We no longer link with libc_p.a or libg.a by default. If you
118 want to profile or debug the GNU/Linux C library, please add
119 -lc_p or -ggdb to LDFLAGS at the link time, respectively. */
120 #if 1
121 #ifdef USE_GNULIBC_1
122 #define LIB_SPEC \
123 "%{!shared: %{p:-lgmon} %{pg:-lgmon} %{profile:-lgmon -lc_p} \
124 %{!profile:%{!ggdb:-lc} %{ggdb:-lg}}}"
125 #else
126 #define LIB_SPEC \
127 "%{shared: -lc} \
128 %{!shared: %{mieee-fp:-lieee} %{pthread:-lpthread} \
129 %{profile:-lc_p} %{!profile: -lc}}"
130 #endif
131 #else
132 #define LIB_SPEC \
133 "%{!shared: \
134 %{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \
135 %{!p:%{!pg:%{!g*:-lc} %{g*:-lg}}}}"
136 #endif
137
138 /* Provide a LINK_SPEC appropriate for GNU/Linux. Here we provide support
139 for the special GCC options -static and -shared, which allow us to
140 link things in one of these three modes by applying the appropriate
141 combinations of options at link-time. We like to support here for
142 as many of the other GNU linker options as possible. But I don't
143 have the time to search for those flags. I am sure how to add
144 support for -soname shared_object_name. H.J.
145
146 I took out %{v:%{!V:-V}}. It is too much :-(. They can use
147 -Wl,-V.
148
149 When the -shared link option is used a final link is not being
150 done. */
151
152 /* If ELF is the default format, we should not use /lib/elf. */
153
154 #undef LINK_SPEC
155 #ifdef USE_GNULIBC_1
156 #ifndef LINUX_DEFAULT_ELF
157 #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
158 %{!shared: \
159 %{!ibcs: \
160 %{!static: \
161 %{rdynamic:-export-dynamic} \
162 %{!dynamic-linker:-dynamic-linker /lib/elf/ld-linux.so.1} \
163 %{!rpath:-rpath /lib/elf/}} %{static:-static}}}"
164 #else
165 #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
166 %{!shared: \
167 %{!ibcs: \
168 %{!static: \
169 %{rdynamic:-export-dynamic} \
170 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.1}} \
171 %{static:-static}}}"
172 #endif
173 #else
174 #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
175 %{!mno-relax:%{!r:-relax}} \
176 %{!shared: \
177 %{!ibcs: \
178 %{!static: \
179 %{rdynamic:-export-dynamic} \
180 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
181 %{static:-static}}}"
182 #endif
183
184 /* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
185 It's safe to pass -s always, even if -g is not used. */
186 #undef ASM_SPEC
187 #define ASM_SPEC \
188 "%{V} %{v:%{!V:-V}} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s %{fpic:-K PIC} \
189 %{fPIC:-K PIC} %(asm_relax)"
190
191 /* Same as sparc.h */
192 #undef DBX_REGISTER_NUMBER
193 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
194
195 #undef ASM_OUTPUT_ALIGNED_LOCAL
196 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
197 do { \
198 fputs ("\t.local\t", (FILE)); \
199 assemble_name ((FILE), (NAME)); \
200 putc ('\n', (FILE)); \
201 ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
202 } while (0)
203
204 #undef COMMON_ASM_OP
205 #define COMMON_ASM_OP "\t.common\t"
206
207 /* This is how to output a definition of an internal numbered label where
208 PREFIX is the class of label and NUM is the number within the class. */
209
210 #undef ASM_OUTPUT_INTERNAL_LABEL
211 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
212 fprintf (FILE, ".L%s%d:\n", PREFIX, NUM)
213
214 /* This is how to output a reference to an internal numbered label where
215 PREFIX is the class of label and NUM is the number within the class. */
216
217 #undef ASM_OUTPUT_INTERNAL_LABELREF
218 #define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM) \
219 fprintf (FILE, ".L%s%d", PREFIX, NUM)
220
221 /* This is how to store into the string LABEL
222 the symbol_ref name of an internal numbered label where
223 PREFIX is the class of label and NUM is the number within the class.
224 This is suitable for output with `assemble_name'. */
225
226 #undef ASM_GENERATE_INTERNAL_LABEL
227 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
228 sprintf (LABEL, "*.L%s%ld", PREFIX, (long)(NUM))
229
230 \f
231 /* Define for support of TFmode long double and REAL_ARITHMETIC.
232 Sparc ABI says that long double is 4 words. */
233 #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
234
235 /* Constant which presents upper bound of the above value. */
236 #define MAX_LONG_DOUBLE_TYPE_SIZE 128
237
238 /* Define this to set long double type size to use in libgcc2.c, which can
239 not depend on target_flags. */
240 #ifdef __LONG_DOUBLE_128__
241 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
242 #else
243 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
244 #endif
245
246 #if !defined(USE_GNULIBC_1) && defined(HAVE_LD_EH_FRAME_HDR)
247 #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
248 #endif
249 \f