OSDN Git Service

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