]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/sparc/linux.h
freebsd.h (ASM_OUTPUT_INTERNAL_LABELREF): Delete.
[thirdparty/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, 2002, 2003, 2004, 2005
3 Free Software Foundation, Inc.
4 Contributed by Eddie C. Dost (ecd@skynet.be)
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
22
23 #define TARGET_OS_CPP_BUILTINS() \
24 do \
25 { \
26 builtin_define_std ("unix"); \
27 builtin_define_std ("linux"); \
28 builtin_define ("__gnu_linux__"); \
29 builtin_assert ("system=linux"); \
30 builtin_assert ("system=unix"); \
31 builtin_assert ("system=posix"); \
32 if (flag_pic) \
33 { \
34 builtin_define ("__PIC__"); \
35 builtin_define ("__pic__"); \
36 } \
37 } \
38 while (0)
39
40 /* Don't assume anything about the header files. */
41 #define NO_IMPLICIT_EXTERN_C
42
43 #undef MD_EXEC_PREFIX
44 #undef MD_STARTFILE_PREFIX
45
46 /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add
47 the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
48 provides part of the support for getting C++ file-scope static
49 object constructed before entering `main'. */
50
51 #undef STARTFILE_SPEC
52 #if defined HAVE_LD_PIE
53 #define STARTFILE_SPEC \
54 "%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
55 crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
56 #else
57 #define STARTFILE_SPEC \
58 "%{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}}\
59 crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
60 #endif
61
62 /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
63 the GNU/Linux magical crtend.o file (see crtstuff.c) which
64 provides part of the support for getting C++ file-scope static
65 object constructed before entering `main', followed by a normal
66 GNU/Linux "finalizer" file, `crtn.o'. */
67
68 #undef ENDFILE_SPEC
69 #define ENDFILE_SPEC \
70 "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
71 %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
72
73 /* This is for -profile to use -lc_p instead of -lc. */
74 #undef CC1_SPEC
75 #define CC1_SPEC "%{profile:-p} \
76 %{sun4:} %{target:} \
77 %{mcypress:-mcpu=cypress} \
78 %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
79 %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
80 "
81
82 /* The GNU C++ standard library requires that these macros be defined. */
83 #undef CPLUSPLUS_CPP_SPEC
84 #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
85
86 #undef TARGET_VERSION
87 #define TARGET_VERSION fprintf (stderr, " (sparc GNU/Linux with ELF)");
88
89 #undef SUBTARGET_SWITCHES
90 #define SUBTARGET_SWITCHES \
91 {"long-double-64", -MASK_LONG_DOUBLE_128, N_("Use 64 bit long doubles") }, \
92 {"long-double-128", MASK_LONG_DOUBLE_128, N_("Use 128 bit long doubles") },
93
94 #undef SIZE_TYPE
95 #define SIZE_TYPE "unsigned int"
96
97 #undef PTRDIFF_TYPE
98 #define PTRDIFF_TYPE "int"
99
100 #undef WCHAR_TYPE
101 #define WCHAR_TYPE "int"
102
103 #undef WCHAR_TYPE_SIZE
104 #define WCHAR_TYPE_SIZE 32
105
106 #undef CPP_SUBTARGET_SPEC
107 #define CPP_SUBTARGET_SPEC \
108 "%{posix:-D_POSIX_SOURCE} \
109 %{pthread:-D_REENTRANT} %{mlong-double-128:-D__LONG_DOUBLE_128__}"
110
111 #undef LIB_SPEC
112 #define LIB_SPEC \
113 "%{pthread:-lpthread} \
114 %{shared:-lc} \
115 %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}"
116
117 /* Provide a LINK_SPEC appropriate for GNU/Linux. Here we provide support
118 for the special GCC options -static and -shared, which allow us to
119 link things in one of these three modes by applying the appropriate
120 combinations of options at link-time. We like to support here for
121 as many of the other GNU linker options as possible. But I don't
122 have the time to search for those flags. I am sure how to add
123 support for -soname shared_object_name. H.J.
124
125 I took out %{v:%{!V:-V}}. It is too much :-(. They can use
126 -Wl,-V.
127
128 When the -shared link option is used a final link is not being
129 done. */
130
131 /* If ELF is the default format, we should not use /lib/elf. */
132
133 #undef LINK_SPEC
134 #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
135 %{!mno-relax:%{!r:-relax}} \
136 %{!shared: \
137 %{!ibcs: \
138 %{!static: \
139 %{rdynamic:-export-dynamic} \
140 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
141 %{static:-static}}}"
142
143 /* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
144 It's safe to pass -s always, even if -g is not used. */
145 #undef ASM_SPEC
146 #define ASM_SPEC \
147 "%{V} %{v:%{!V:-V}} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \
148 %{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_cpu) %(asm_relax)"
149
150 /* Same as sparc.h */
151 #undef DBX_REGISTER_NUMBER
152 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
153
154 #undef ASM_OUTPUT_ALIGNED_LOCAL
155 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
156 do { \
157 fputs ("\t.local\t", (FILE)); \
158 assemble_name ((FILE), (NAME)); \
159 putc ('\n', (FILE)); \
160 ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
161 } while (0)
162
163 #undef COMMON_ASM_OP
164 #define COMMON_ASM_OP "\t.common\t"
165
166 #undef LOCAL_LABEL_PREFIX
167 #define LOCAL_LABEL_PREFIX "."
168
169 /* This is how to store into the string LABEL
170 the symbol_ref name of an internal numbered label where
171 PREFIX is the class of label and NUM is the number within the class.
172 This is suitable for output with `assemble_name'. */
173
174 #undef ASM_GENERATE_INTERNAL_LABEL
175 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
176 sprintf (LABEL, "*.L%s%ld", PREFIX, (long)(NUM))
177
178 \f
179 /* Define for support of TFmode long double.
180 SPARC ABI says that long double is 4 words. */
181 #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
182
183 /* Define this to set long double type size to use in libgcc2.c, which can
184 not depend on target_flags. */
185 #ifdef __LONG_DOUBLE_128__
186 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
187 #else
188 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
189 #endif
190
191 #undef DITF_CONVERSION_LIBFUNCS
192 #define DITF_CONVERSION_LIBFUNCS 1
193
194 #if defined(HAVE_LD_EH_FRAME_HDR)
195 #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
196 #endif
197 \f
198 #ifdef HAVE_AS_TLS
199 #undef TARGET_SUN_TLS
200 #undef TARGET_GNU_TLS
201 #define TARGET_SUN_TLS 0
202 #define TARGET_GNU_TLS 1
203 #endif
204 \f
205 /* Don't be different from other Linux platforms in this regard. */
206 #define HANDLE_PRAGMA_PACK_PUSH_POP
207
208 /* We use GNU ld so undefine this so that attribute((init_priority)) works. */
209 #undef CTORS_SECTION_ASM_OP
210 #undef DTORS_SECTION_ASM_OP
211
212 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
213
214 /* Determine whether the the entire c99 runtime is present in the
215 runtime library. */
216 #define TARGET_C99_FUNCTIONS 1
217
218 #define TARGET_HAS_F_SETLKW
219
220 #undef LINK_GCC_C_SEQUENCE_SPEC
221 #define LINK_GCC_C_SEQUENCE_SPEC \
222 "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
223
224 /* Use --as-needed -lgcc_s for eh support. */
225 #ifdef HAVE_LD_AS_NEEDED
226 #define USE_LD_AS_NEEDED 1
227 #endif
228
229 #define MD_UNWIND_SUPPORT "config/sparc/linux-unwind.h"
230
231 /* Linux currently uses RMO in uniprocessor mode, which is equivalent to
232 TMO, and TMO in multiprocessor mode. But they reserve the right to
233 change their minds. */
234 #undef SPARC_RELAXED_ORDERING
235 #define SPARC_RELAXED_ORDERING true