OSDN Git Service

* config.gcc (sparc-*-sysv4*): Add sparc/sysv4-only.h.
[pf3gnuchains/gcc-fork.git] / gcc / config / sparc / sol2-bi.h
1 /* Definitions of target machine for GNU compiler, for bi-arch SPARC
2    running Solaris 2 using the system assembler and linker.  */
3
4 /* The default code model.  */
5 #undef SPARC_DEFAULT_CMODEL
6 #define SPARC_DEFAULT_CMODEL CM_MEDANY
7
8 #define AS_SPARC64_FLAG "-xarch=v9"
9
10 #undef ASM_CPU32_DEFAULT_SPEC
11 #define ASM_CPU32_DEFAULT_SPEC  ""
12 #undef ASM_CPU64_DEFAULT_SPEC
13 #define ASM_CPU64_DEFAULT_SPEC  AS_SPARC64_FLAG
14
15 #if TARGET_CPU_DEFAULT == TARGET_CPU_v9
16 #undef CPP_CPU64_DEFAULT_SPEC
17 #define CPP_CPU64_DEFAULT_SPEC ""
18 #undef ASM_CPU32_DEFAULT_SPEC
19 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plus"
20 #endif
21 #if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
22 #undef CPP_CPU64_DEFAULT_SPEC
23 #define CPP_CPU64_DEFAULT_SPEC ""
24 #undef ASM_CPU32_DEFAULT_SPEC
25 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusa"
26 #undef ASM_CPU64_DEFAULT_SPEC
27 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "a"
28 #endif
29
30 #if DEFAULT_ARCH32_P
31 #define DEF_ARCH32_SPEC(__str) "%{!m64:" __str "}"
32 #define DEF_ARCH64_SPEC(__str) "%{m64:" __str "}"
33 #else
34 #define DEF_ARCH32_SPEC(__str) "%{m32:" __str "}"
35 #define DEF_ARCH64_SPEC(__str) "%{!m32:" __str "}"
36 #endif
37
38 #undef CPP_CPU_SPEC
39 #define CPP_CPU_SPEC "\
40 %{mcypress:} \
41 %{msparclite|mf930|mf934:-D__sparclite__} \
42 %{mv8:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
43 %{msupersparc:-D__supersparc__ " DEF_ARCH32_SPEC("-D__sparcv8") "} \
44 %{mcpu=sparclet|mcpu=tsc701:-D__sparclet__} \
45 %{mcpu=sparclite|mcpu-f930|mcpu=f934:-D__sparclite__} \
46 %{mcpu=v8:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
47 %{mcpu=supersparc:-D__supersparc__ " DEF_ARCH32_SPEC("-D__sparcv8") "} \
48 %{mcpu=v9|mcpu=ultrasparc:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
49 %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(cpp_cpu_default)}}}}}}} \
50 "
51
52 #undef ASM_CPU_SPEC
53 #define ASM_CPU_SPEC "\
54 %{mcpu=ultrasparc:" DEF_ARCH32_SPEC("-xarch=v8plusa") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "a") "} \
55 %{mcpu=v9:" DEF_ARCH32_SPEC("-xarch=v8plus") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "} \
56 %{!mcpu=ultrasparc:%{!mcpu=v9:%{mcpu*:" DEF_ARCH32_SPEC("-xarch=v8") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "}}} \
57 %{!mcpu*:%(asm_cpu_default)} \
58 "
59
60 #undef CPP_CPU_DEFAULT_SPEC
61 #define CPP_CPU_DEFAULT_SPEC \
62 (DEFAULT_ARCH32_P ? "\
63 %{m64:" CPP_CPU64_DEFAULT_SPEC "} \
64 %{!m64:" CPP_CPU32_DEFAULT_SPEC "} \
65 " : "\
66 %{m32:" CPP_CPU32_DEFAULT_SPEC "} \
67 %{!m32:" CPP_CPU64_DEFAULT_SPEC "} \
68 ")
69
70 #undef ASM_CPU_DEFAULT_SPEC
71 #define ASM_CPU_DEFAULT_SPEC \
72 (DEFAULT_ARCH32_P ? "\
73 %{m64:" ASM_CPU64_DEFAULT_SPEC "} \
74 %{!m64:" ASM_CPU32_DEFAULT_SPEC "} \
75 " : "\
76 %{m32:" ASM_CPU32_DEFAULT_SPEC "} \
77 %{!m32:" ASM_CPU64_DEFAULT_SPEC "} \
78 ")
79
80 /* wchar_t is called differently in <wchar.h> for 32 and 64-bit
81    compilations.  This is called for by SCD 2.4.1, p. 6-83, Figure 6-65
82    (32-bit) and p. 6P-10, Figure 6.38 (64-bit).  */
83
84 #undef WCHAR_TYPE
85 #define WCHAR_TYPE (TARGET_ARCH64 ? "int" : "long int")
86
87 #undef WCHAR_TYPE_SIZE
88 #define WCHAR_TYPE_SIZE 32
89
90 /* Same for wint_t.  See SCD 2.4.1, p. 6-83, Figure 6-66 (32-bit).  There's
91    no corresponding 64-bit definition, but this is what Solaris 8
92    <iso/wchar_iso.h> uses.  */
93
94 #undef WINT_TYPE
95 #define WINT_TYPE (TARGET_ARCH64 ? "int" : "long int")
96
97 #undef WINT_TYPE_SIZE
98 #define WINT_TYPE_SIZE 32
99
100 #undef CPP_ARCH32_SPEC
101 #define CPP_ARCH32_SPEC ""
102 #undef CPP_ARCH64_SPEC
103 #define CPP_ARCH64_SPEC "-D__arch64__ -D__sparcv9"
104
105 #undef CPP_ARCH_SPEC
106 #define CPP_ARCH_SPEC "\
107 %{m32:%(cpp_arch32)} \
108 %{m64:%(cpp_arch64)} \
109 %{!m32:%{!m64:%(cpp_arch_default)}} \
110 "
111
112 #undef ASM_ARCH_SPEC
113 #define ASM_ARCH_SPEC ""
114
115 #undef ASM_ARCH32_SPEC
116 #define ASM_ARCH32_SPEC ""
117
118 #undef ASM_ARCH64_SPEC
119 #define ASM_ARCH64_SPEC ""
120
121 #undef ASM_ARCH_DEFAULT_SPEC
122 #define ASM_ARCH_DEFAULT_SPEC ""
123
124 #undef SUBTARGET_EXTRA_SPECS
125 #define SUBTARGET_EXTRA_SPECS \
126   { "startfile_arch",    STARTFILE_ARCH_SPEC },           \
127   { "link_arch32",       LINK_ARCH32_SPEC },              \
128   { "link_arch64",       LINK_ARCH64_SPEC },              \
129   { "link_arch_default", LINK_ARCH_DEFAULT_SPEC },        \
130   { "link_arch",         LINK_ARCH_SPEC },
131     
132 /*
133  * This should be the same as in sol2.h, except with "/sparcv9"
134  * appended to the paths and /usr/ccs/lib is no longer necessary
135  */
136 #define LINK_ARCH64_SPEC \
137   "%{mcmodel=medlow:-M /usr/lib/ld/sparcv9/map.below4G} \
138    %{G:-G} \
139    %{YP,*} \
140    %{R*} \
141    %{compat-bsd: \
142      %{!YP,*:%{p|pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
143        %{!p:%{!pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/sparcv9}}} \
144      -R /usr/ucblib} \
145    %{!compat-bsd: \
146      %{!YP,*:%{p|pg:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
147        %{!p:%{!pg:-Y P,/usr/lib/sparcv9}}}}"
148
149 #undef LINK_ARCH_SPEC
150 #define LINK_ARCH_SPEC "\
151 %{m32:%(link_arch32)} \
152 %{m64:%(link_arch64)} \
153 %{!m32:%{!m64:%(link_arch_default)}} \
154 "
155
156 #define LINK_ARCH_DEFAULT_SPEC \
157 (DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC)
158
159 #undef  CC1_SPEC
160 #if DEFAULT_ARCH32_P
161 #define CC1_SPEC "\
162 %{sun4:} %{target:} \
163 %{mcypress:-mcpu=cypress} \
164 %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
165 %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
166 %{m32:%{m64:%emay not use both -m32 and -m64}} \
167 %{m64:-mptr64 -mstack-bias -mno-v8plus \
168   %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8*:%{!msupersparc:-mcpu=v9}}}}}}}} \
169 "
170 #else
171 #define CC1_SPEC "\
172 %{sun4:} %{target:} \
173 %{mcypress:-mcpu=cypress} \
174 %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
175 %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
176 %{m32:%{m64:%emay not use both -m32 and -m64}} \
177 %{m32:-mptr32 -mno-stack-bias \
178   %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8*:%{!msupersparc:-mcpu=cypress}}}}}}}} \
179 %{mv8plus:-m32 -mptr32 -mno-stack-bias \
180   %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:-mcpu=v9}}}}}}}} \
181 "
182 #endif
183
184 #if DEFAULT_ARCH32_P
185 #define MULTILIB_DEFAULTS { "m32" }
186 #else
187 #define MULTILIB_DEFAULTS { "m64" }
188 #endif
189
190 /* We use stabs-in-elf in 32-bit mode, because that is what the native
191    toolchain uses.  But gdb can't handle truncated 32-bit stabs so we
192    use dwarf2 in 64-bit mode.  */
193 #undef PREFERRED_DEBUGGING_TYPE
194 #define PREFERRED_DEBUGGING_TYPE (TARGET_ARCH32 ? DBX_DEBUG : DWARF2_DEBUG)
195
196 /* We can't use the above definition for the purposes of specs.  */
197 #if defined(HAVE_AS_GDWARF2_DEBUG_FLAG) && defined(HAVE_AS_GSTABS_DEBUG_FLAG)
198 # if DEFAULT_ARCH32_P
199 #  define ASM_DEBUG_SPEC "%{gdwarf-2*:--gdwarf2}%{!gdwarf-2*:%{g*:--gstabs}}"
200 # else
201 #  define ASM_DEBUG_SPEC "%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}"
202 # endif
203 #endif