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)
5 This file is part of GNU CC.
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)
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.
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. */
22 #define LINUX_DEFAULT_ELF
24 /* Don't assume anything about the header files. */
25 #define NO_IMPLICIT_EXTERN_C
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. */
34 #undef MULTIBYTE_CHARS
35 #define MULTIBYTE_CHARS 1
38 /* There are conflicting reports about whether this system uses
39 a different assembler syntax. wilson@cygnus.com says # is right. */
41 #define COMMENT_BEGIN "#"
43 /* Use stabs instead of DWARF debug format. */
44 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
45 #include <sparc/sysv4.h>
48 #undef MD_STARTFILE_PREFIX
50 /* Output at beginning of assembler file. */
51 /* The .file command should always begin the output. */
53 #define ASM_FILE_START(FILE) \
55 output_file_directive (FILE, main_input_filename); \
56 fprintf (FILE, "\t.version\t\"01.01\"\n"); \
59 /* Provide a STARTFILE_SPEC appropriate for Linux. Here we add
60 the Linux magical crtbegin.o file (see crtstuff.c) which
61 provides part of the support for getting C++ file-scope static
62 object constructed before entering `main'. */
65 #define STARTFILE_SPEC \
67 %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\
68 crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
70 /* Provide a ENDFILE_SPEC appropriate for Linux. Here we tack on
71 the Linux magical crtend.o file (see crtstuff.c) which
72 provides part of the support for getting C++ file-scope static
73 object constructed before entering `main', followed by a normal
74 Linux "finalizer" file, `crtn.o'. */
77 #define ENDFILE_SPEC \
78 "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
80 /* This is for -profile to use -lc_p instead of -lc. */
82 #define CC1_SPEC "%{profile:-p} \
84 %{mcypress:-mcpu=cypress} \
85 %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
86 %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
90 #define TARGET_VERSION fprintf (stderr, " (sparc Linux/ELF)");
93 #define SIZE_TYPE "unsigned int"
96 #define PTRDIFF_TYPE "int"
99 #define WCHAR_TYPE "long int"
101 #undef WCHAR_TYPE_SIZE
102 #define WCHAR_TYPE_SIZE BITS_PER_WORD
104 #undef CPP_PREDEFINES
105 #define CPP_PREDEFINES "-D__ELF__ -Dunix -Dsparc -Dlinux -Asystem(unix) -Asystem(posix) -Acpu(sparc) -Amachine(sparc)"
109 #define CPP_SPEC "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{msparclite:-D__sparclite__} %{mv8:-D__sparc_v8__} %{msupersparc:-D__supersparc__ -D__sparc_v8__} %{posix:-D_POSIX_SOURCE}"
111 #define CPP_SPEC "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{msparclite:-D__sparclite__} %{mv8:-D__sparc_v8__} %{msupersparc:-D__supersparc__ -D__sparc_v8__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
115 /* We no longer link with libc_p.a or libg.a by default. If you
116 * want to profile or debug the Linux C library, please add
117 * -lc_p or -ggdb to LDFLAGS at the link time, respectively.
122 "%{!shared: %{p:-lgmon} %{pg:-lgmon} %{profile:-lgmon -lc_p} \
123 %{!profile:%{!ggdb:-lc} %{ggdb:-lg}}}"
126 "%{!shared: %{mieee-fp:-lieee} %{pthread:-lpthread} \
127 %{profile:-lc_p} %{!profile: -lc}}"
132 %{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \
133 %{!p:%{!pg:%{!g*:-lc} %{g*:-lg}}}}"
136 /* Provide a LINK_SPEC appropriate for Linux. Here we provide support
137 for the special GCC options -static and -shared, which allow us to
138 link things in one of these three modes by applying the appropriate
139 combinations of options at link-time. We like to support here for
140 as many of the other GNU linker options as possible. But I don't
141 have the time to search for those flags. I am sure how to add
142 support for -soname shared_object_name. H.J.
144 I took out %{v:%{!V:-V}}. It is too much :-(. They can use
147 When the -shared link option is used a final link is not being
150 /* If ELF is the default format, we should not use /lib/elf. */
154 #ifndef LINUX_DEFAULT_ELF
155 #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
159 %{rdynamic:-export-dynamic} \
160 %{!dynamic-linker:-dynamic-linker /lib/elf/ld-linux.so.1} \
161 %{!rpath:-rpath /lib/elf/}} %{static:-static}}}"
163 #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
167 %{rdynamic:-export-dynamic} \
168 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.1}} \
172 #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
176 %{rdynamic:-export-dynamic} \
177 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
181 /* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
182 It's safe to pass -s always, even if -g is not used. */
185 "%{V} %{v:%{!V:-V}} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s %{fpic:-K PIC} %{fPIC:-K PIC}"
187 /* Same as sparc.h */
188 #undef DBX_REGISTER_NUMBER
189 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
191 /* We use stabs-in-elf for debugging, because that is what the native
192 toolchain uses. XXX */
193 #undef PREFERRED_DEBUGGING_TYPE
194 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
196 #undef ASM_OUTPUT_ALIGNED_LOCAL
197 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
199 fputs ("\t.local\t", (FILE)); \
200 assemble_name ((FILE), (NAME)); \
201 putc ('\n', (FILE)); \
202 ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
206 #define COMMON_ASM_OP "\t.common"
208 /* This is how to output a definition of an internal numbered label where
209 PREFIX is the class of label and NUM is the number within the class. */
211 #undef ASM_OUTPUT_INTERNAL_LABEL
212 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
213 fprintf (FILE, ".L%s%d:\n", PREFIX, NUM)
215 /* This is how to output a reference to an internal numbered label where
216 PREFIX is the class of label and NUM is the number within the class. */
218 #undef ASM_OUTPUT_INTERNAL_LABELREF
219 #define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM) \
220 fprintf (FILE, ".L%s%d", PREFIX, NUM)
222 /* This is how to store into the string LABEL
223 the symbol_ref name of an internal numbered label where
224 PREFIX is the class of label and NUM is the number within the class.
225 This is suitable for output with `assemble_name'. */
227 #undef ASM_GENERATE_INTERNAL_LABEL
228 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
229 sprintf (LABEL, "*.L%s%d", PREFIX, NUM)
233 /* Define for support of TFmode long double and REAL_ARITHMETIC.
234 Sparc ABI says that long double is 4 words. Linux does not support
236 #define LONG_DOUBLE_TYPE_SIZE 128