]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/sparc/linux.h
6f7a6ca9469e92208b7ac4128c25d1e2a6be8500
[thirdparty/gcc.git] / gcc / config / sparc / linux.h
1 /* Definitions for SPARC running Linux with ELF
2 Copyright (C) 1996, 1997 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 #undef HAVE_ATEXIT
28 #define HAVE_ATEXIT
29
30 /* Linux uses ctype from glibc.a. I am not sure how complete it is.
31 For now, we play safe. It may change later. */
32
33 #if 0
34 #undef MULTIBYTE_CHARS
35 #define MULTIBYTE_CHARS 1
36 #endif
37
38 #ifndef USE_GNULIBC_1
39 #undef DEFAULT_VTABLE_THUNKS
40 #define DEFAULT_VTABLE_THUNKS 1
41 #endif
42
43 /* Use stabs instead of DWARF debug format. */
44 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
45
46 #include <sparc/sysv4.h>
47
48 #undef MD_EXEC_PREFIX
49 #undef MD_STARTFILE_PREFIX
50
51 /* Output at beginning of assembler file. */
52 /* The .file command should always begin the output. */
53 #undef ASM_FILE_START
54 #define ASM_FILE_START(FILE) \
55 do { \
56 output_file_directive (FILE, main_input_filename); \
57 fprintf (FILE, "\t.version\t\"01.01\"\n"); \
58 } while (0)
59
60 /* Provide a STARTFILE_SPEC appropriate for Linux. Here we add
61 the Linux magical crtbegin.o file (see crtstuff.c) which
62 provides part of the support for getting C++ file-scope static
63 object constructed before entering `main'. */
64
65 #undef STARTFILE_SPEC
66 #define STARTFILE_SPEC \
67 "%{!shared: \
68 %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\
69 crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
70
71 /* Provide a ENDFILE_SPEC appropriate for Linux. Here we tack on
72 the Linux magical crtend.o file (see crtstuff.c) which
73 provides part of the support for getting C++ file-scope static
74 object constructed before entering `main', followed by a normal
75 Linux "finalizer" file, `crtn.o'. */
76
77 #undef ENDFILE_SPEC
78 #define ENDFILE_SPEC \
79 "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
80
81 /* This is for -profile to use -lc_p instead of -lc. */
82 #undef CC1_SPEC
83 #define CC1_SPEC "%{profile:-p} \
84 %{sun4:} %{target:} \
85 %{mcypress:-mcpu=cypress} \
86 %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
87 %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
88 "
89
90 #undef TARGET_VERSION
91 #define TARGET_VERSION fprintf (stderr, " (sparc Linux/ELF)");
92
93 #undef SIZE_TYPE
94 #define SIZE_TYPE "unsigned int"
95
96 #undef PTRDIFF_TYPE
97 #define PTRDIFF_TYPE "int"
98
99 #undef WCHAR_TYPE
100 #define WCHAR_TYPE "long int"
101
102 #undef WCHAR_TYPE_SIZE
103 #define WCHAR_TYPE_SIZE BITS_PER_WORD
104
105 #undef CPP_PREDEFINES
106 #define CPP_PREDEFINES "-D__ELF__ -Dunix -Dsparc -Dlinux -Asystem(unix) -Asystem(posix)"
107
108 #undef CPP_SUBTARGET_SPEC
109 #ifdef USE_GNULIBC_1
110 #define CPP_SUBTARGET_SPEC \
111 "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}"
112 #else
113 #define CPP_SUBTARGET_SPEC \
114 "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
115 #endif
116
117 #undef LIB_SPEC
118 /* We no longer link with libc_p.a or libg.a by default. If you
119 * want to profile or debug the Linux C library, please add
120 * -lc_p or -ggdb to LDFLAGS at the link time, respectively.
121 */
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: %{mieee-fp:-lieee} %{pthread:-lpthread} \
130 %{profile:-lc_p} %{!profile: -lc}}"
131 #endif
132 #else
133 #define LIB_SPEC \
134 "%{!shared: \
135 %{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \
136 %{!p:%{!pg:%{!g*:-lc} %{g*:-lg}}}}"
137 #endif
138
139 /* Provide a LINK_SPEC appropriate for Linux. Here we provide support
140 for the special GCC options -static and -shared, which allow us to
141 link things in one of these three modes by applying the appropriate
142 combinations of options at link-time. We like to support here for
143 as many of the other GNU linker options as possible. But I don't
144 have the time to search for those flags. I am sure how to add
145 support for -soname shared_object_name. H.J.
146
147 I took out %{v:%{!V:-V}}. It is too much :-(. They can use
148 -Wl,-V.
149
150 When the -shared link option is used a final link is not being
151 done. */
152
153 /* If ELF is the default format, we should not use /lib/elf. */
154
155 #undef LINK_SPEC
156 #ifdef USE_GNULIBC_1
157 #ifndef LINUX_DEFAULT_ELF
158 #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
159 %{!shared: \
160 %{!ibcs: \
161 %{!static: \
162 %{rdynamic:-export-dynamic} \
163 %{!dynamic-linker:-dynamic-linker /lib/elf/ld-linux.so.1} \
164 %{!rpath:-rpath /lib/elf/}} %{static:-static}}}"
165 #else
166 #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
167 %{!shared: \
168 %{!ibcs: \
169 %{!static: \
170 %{rdynamic:-export-dynamic} \
171 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.1}} \
172 %{static:-static}}}"
173 #endif
174 #else
175 #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
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} %{fPIC:-K PIC}"
189
190 /* Same as sparc.h */
191 #undef DBX_REGISTER_NUMBER
192 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
193
194 /* We use stabs-in-elf for debugging, because that is what the native
195 toolchain uses. XXX */
196 #undef PREFERRED_DEBUGGING_TYPE
197 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
198
199 #undef ASM_OUTPUT_ALIGNED_LOCAL
200 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
201 do { \
202 fputs ("\t.local\t", (FILE)); \
203 assemble_name ((FILE), (NAME)); \
204 putc ('\n', (FILE)); \
205 ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
206 } while (0)
207
208 #undef COMMON_ASM_OP
209 #define COMMON_ASM_OP "\t.common"
210
211 /* This is how to output a definition of an internal numbered label where
212 PREFIX is the class of label and NUM is the number within the class. */
213
214 #undef ASM_OUTPUT_INTERNAL_LABEL
215 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
216 fprintf (FILE, ".L%s%d:\n", PREFIX, NUM)
217
218 /* This is how to output a reference to an internal numbered label where
219 PREFIX is the class of label and NUM is the number within the class. */
220
221 #undef ASM_OUTPUT_INTERNAL_LABELREF
222 #define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM) \
223 fprintf (FILE, ".L%s%d", PREFIX, NUM)
224
225 /* This is how to store into the string LABEL
226 the symbol_ref name of an internal numbered label where
227 PREFIX is the class of label and NUM is the number within the class.
228 This is suitable for output with `assemble_name'. */
229
230 #undef ASM_GENERATE_INTERNAL_LABEL
231 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
232 sprintf (LABEL, "*.L%s%d", PREFIX, NUM)
233
234 \f
235 #if 0
236 /* Define for support of TFmode long double and REAL_ARITHMETIC.
237 Sparc ABI says that long double is 4 words. Linux does not support
238 long double yet. */
239 #define LONG_DOUBLE_TYPE_SIZE 128
240 #endif