OSDN Git Service

Add NIOS2 support. Code from SourceyG++.
[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, 2002, 2003, 2004, 2005, 2006,
3    2007, 2008, 2009 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 3, 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 COPYING3.  If not see
20 <http://www.gnu.org/licenses/>.  */
21
22 #define TARGET_OS_CPP_BUILTINS()                \
23   do                                            \
24     {                                           \
25       LINUX_TARGET_OS_CPP_BUILTINS();           \
26       if (TARGET_LONG_DOUBLE_128)               \
27         builtin_define ("__LONG_DOUBLE_128__"); \
28     }                                           \
29   while (0)
30
31 /* Provide a ENDFILE_SPEC appropriate for GNU/Linux.  Here we tack on
32    the GNU/Linux magical crtend.o file (see crtstuff.c) which
33    provides part of the support for getting C++ file-scope static
34    object constructed before entering `main', followed by a normal
35    GNU/Linux "finalizer" file, `crtn.o'.  */
36
37 #undef  ENDFILE_SPEC
38 #define ENDFILE_SPEC \
39   "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\
40    %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
41
42 /* This is for -profile to use -lc_p instead of -lc.  */
43 #undef  CC1_SPEC
44 #define CC1_SPEC "%{profile:-p} \
45 %{sun4:} %{target:} \
46 %{mcypress:-mcpu=cypress} \
47 %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
48 %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
49 "
50
51 #undef TARGET_VERSION
52 #define TARGET_VERSION fprintf (stderr, " (sparc GNU/Linux with ELF)");
53
54 #undef SIZE_TYPE
55 #define SIZE_TYPE "unsigned int"
56  
57 #undef PTRDIFF_TYPE
58 #define PTRDIFF_TYPE "int"
59   
60 #undef WCHAR_TYPE
61 #define WCHAR_TYPE "int"
62    
63 #undef WCHAR_TYPE_SIZE
64 #define WCHAR_TYPE_SIZE 32
65
66 #undef CPP_SUBTARGET_SPEC
67 #define CPP_SUBTARGET_SPEC \
68 "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
69
70 /* Provide a LINK_SPEC appropriate for GNU/Linux.  Here we provide support
71    for the special GCC options -static and -shared, which allow us to
72    link things in one of these three modes by applying the appropriate
73    combinations of options at link-time. We like to support here for
74    as many of the other GNU linker options as possible. But I don't
75    have the time to search for those flags. I am sure how to add
76    support for -soname shared_object_name. H.J.
77
78    I took out %{v:%{!V:-V}}. It is too much :-(. They can use
79    -Wl,-V.
80
81    When the -shared link option is used a final link is not being
82    done.  */
83
84 /* If ELF is the default format, we should not use /lib/elf.  */
85
86 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
87
88 #undef  LINK_SPEC
89 #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
90   %{!mno-relax:%{!r:-relax}} \
91   %{!shared: \
92     %{!ibcs: \
93       %{!static: \
94         %{rdynamic:-export-dynamic} \
95         %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "}} \
96         %{static:-static}}}"
97
98 /* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
99    It's safe to pass -s always, even if -g is not used.  */
100 #undef ASM_SPEC
101 #define ASM_SPEC "\
102 %{V} \
103 %{v:%{!V:-V}} \
104 %{!Qn:-Qy} \
105 %{n} \
106 %{T} \
107 %{Ym,*} \
108 %{Wa,*:%*} \
109 -s \
110 %{fpic|fPIC|fpie|fPIE|findirect-dispatch:-K PIC} \
111 %(asm_cpu) %(asm_relax)"
112
113 #undef ASM_OUTPUT_ALIGNED_LOCAL
114 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN)               \
115 do {                                                                    \
116   fputs ("\t.local\t", (FILE));         \
117   assemble_name ((FILE), (NAME));                                       \
118   putc ('\n', (FILE));                                                  \
119   ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN);                  \
120 } while (0)
121
122 #undef COMMON_ASM_OP
123 #define COMMON_ASM_OP "\t.common\t"
124
125 #undef  LOCAL_LABEL_PREFIX
126 #define LOCAL_LABEL_PREFIX  "."
127
128 /* This is how to store into the string LABEL
129    the symbol_ref name of an internal numbered label where
130    PREFIX is the class of label and NUM is the number within the class.
131    This is suitable for output with `assemble_name'.  */
132
133 #undef  ASM_GENERATE_INTERNAL_LABEL
134 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)   \
135   sprintf (LABEL, "*.L%s%ld", PREFIX, (long)(NUM))
136
137 \f
138 /* Define for support of TFmode long double.
139    SPARC ABI says that long double is 4 words.  */
140 #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
141
142 /* Define this to set long double type size to use in libgcc2.c, which can
143    not depend on target_flags.  */
144 #ifdef __LONG_DOUBLE_128__
145 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
146 #else
147 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
148 #endif
149
150 #undef DITF_CONVERSION_LIBFUNCS
151 #define DITF_CONVERSION_LIBFUNCS 1
152 \f
153 #ifdef HAVE_AS_TLS
154 #undef TARGET_SUN_TLS
155 #undef TARGET_GNU_TLS
156 #define TARGET_SUN_TLS 0
157 #define TARGET_GNU_TLS 1
158 #endif
159 \f
160 /* We use GNU ld so undefine this so that attribute((init_priority)) works.  */
161 #undef CTORS_SECTION_ASM_OP
162 #undef DTORS_SECTION_ASM_OP
163
164 #define MD_UNWIND_SUPPORT "config/sparc/linux-unwind.h"
165
166 /* Linux currently uses RMO in uniprocessor mode, which is equivalent to
167    TMO, and TMO in multiprocessor mode.  But they reserve the right to
168    change their minds.  */
169 #undef SPARC_RELAXED_ORDERING
170 #define SPARC_RELAXED_ORDERING true
171
172 #undef NEED_INDICATE_EXEC_STACK
173 #define NEED_INDICATE_EXEC_STACK 1
174
175 #ifdef TARGET_LIBC_PROVIDES_SSP
176 /* sparc glibc provides __stack_chk_guard in [%g7 + 0x14].  */
177 #define TARGET_THREAD_SSP_OFFSET        0x14
178 #endif
179
180 /* Define if long doubles should be mangled as 'g'.  */
181 #define TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
182
183 /* We use glibc _mcount for profiling.  */
184 #undef NO_PROFILE_COUNTERS
185 #define NO_PROFILE_COUNTERS     1