Mercurial > hg > CbC > CbC_gcc
annotate gcc/config/sol2.h @ 55:77e2b8dfacca gcc-4.4.5
update it from 4.4.3 to 4.5.0
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Feb 2010 23:39:51 +0900 |
parents | a06113de4d67 |
children | b7f97abdc517 |
rev | line source |
---|---|
0 | 1 /* Operating system specific defines to be used when targeting GCC for any |
2 Solaris 2 system. | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3 Copyright 2002, 2003, 2004, 2007, 2008, 2009 Free Software Foundation, Inc. |
0 | 4 |
5 This file is part of GCC. | |
6 | |
7 GCC 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 3, or (at your option) | |
10 any later version. | |
11 | |
12 GCC 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 GCC; see the file COPYING3. If not see | |
19 <http://www.gnu.org/licenses/>. */ | |
20 | |
21 /* We use stabs-in-elf for debugging, because that is what the native | |
22 toolchain uses. */ | |
23 #undef PREFERRED_DEBUGGING_TYPE | |
24 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG | |
25 | |
26 /* Solaris 2 (at least as of 2.5.1) uses a 32-bit wchar_t. */ | |
27 #undef WCHAR_TYPE | |
28 #define WCHAR_TYPE "long int" | |
29 | |
30 #undef WCHAR_TYPE_SIZE | |
31 #define WCHAR_TYPE_SIZE BITS_PER_WORD | |
32 | |
33 /* Solaris 2 uses a wint_t different from the default. This is required | |
34 by the SCD 2.4.1, p. 6-83, Figure 6-66. */ | |
35 #undef WINT_TYPE | |
36 #define WINT_TYPE "long int" | |
37 | |
38 #undef WINT_TYPE_SIZE | |
39 #define WINT_TYPE_SIZE BITS_PER_WORD | |
40 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
41 #define SIG_ATOMIC_TYPE "int" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
42 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
43 /* ??? This definition of int8_t follows the system header but does |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
44 not conform to C99. Likewise int_fast8_t, int_least8_t. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
45 #define INT8_TYPE "char" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
46 #define INT16_TYPE "short int" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
47 #define INT32_TYPE "int" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
48 #define INT64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
49 #define UINT8_TYPE "unsigned char" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
50 #define UINT16_TYPE "short unsigned int" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
51 #define UINT32_TYPE "unsigned int" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
52 #define UINT64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
53 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
54 #define INT_LEAST8_TYPE "char" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
55 #define INT_LEAST16_TYPE "short int" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
56 #define INT_LEAST32_TYPE "int" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
57 #define INT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
58 #define UINT_LEAST8_TYPE "unsigned char" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
59 #define UINT_LEAST16_TYPE "short unsigned int" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
60 #define UINT_LEAST32_TYPE "unsigned int" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
61 #define UINT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
62 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
63 #define INT_FAST8_TYPE "char" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
64 #define INT_FAST16_TYPE "int" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
65 #define INT_FAST32_TYPE "int" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
66 #define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
67 #define UINT_FAST8_TYPE "unsigned char" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
68 #define UINT_FAST16_TYPE "unsigned int" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
69 #define UINT_FAST32_TYPE "unsigned int" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
70 #define UINT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
71 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
72 #define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int") |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
73 #define UINTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int") |
0 | 74 |
75 /* ??? Note: in order for -compat-bsd to work fully, | |
76 we must somehow arrange to fixincludes /usr/ucbinclude | |
77 and put the result in $(libsubdir)/ucbinclude. */ | |
78 | |
79 #undef CPP_SUBTARGET_SPEC | |
80 #define CPP_SUBTARGET_SPEC "\ | |
81 %{pthreads|pthread:-D_REENTRANT -D_PTHREADS} \ | |
82 %{!pthreads:%{!pthread:%{threads:-D_REENTRANT -D_SOLARIS_THREADS}}} \ | |
83 %{compat-bsd:-iwithprefixbefore ucbinclude -I/usr/ucbinclude} \ | |
84 " | |
85 | |
86 /* Names to predefine in the preprocessor for this target machine. */ | |
87 #define TARGET_SUB_OS_CPP_BUILTINS() | |
88 #define TARGET_OS_CPP_BUILTINS() \ | |
89 do { \ | |
90 builtin_define_std ("unix"); \ | |
91 builtin_define_std ("sun"); \ | |
92 builtin_define ("__svr4__"); \ | |
93 builtin_define ("__SVR4"); \ | |
94 builtin_assert ("system=unix"); \ | |
95 builtin_assert ("system=svr4"); \ | |
96 /* For C++ we need to add some additional macro \ | |
97 definitions required by the C++ standard \ | |
98 library. */ \ | |
99 if (c_dialect_cxx ()) \ | |
100 { \ | |
101 builtin_define ("_XOPEN_SOURCE=500"); \ | |
102 builtin_define ("_LARGEFILE_SOURCE=1"); \ | |
103 builtin_define ("_LARGEFILE64_SOURCE=1"); \ | |
104 builtin_define ("__EXTENSIONS__"); \ | |
105 } \ | |
106 TARGET_SUB_OS_CPP_BUILTINS(); \ | |
107 } while (0) | |
108 | |
109 /* The system headers under Solaris 2 are C++-aware since 2.0. */ | |
110 #define NO_IMPLICIT_EXTERN_C | |
111 | |
112 /* The sun bundled assembler doesn't accept -Yd, (and neither does gas). | |
113 It's safe to pass -s always, even if -g is not used. */ | |
114 #undef ASM_SPEC | |
115 #define ASM_SPEC "\ | |
116 %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \ | |
117 %{fpic|fpie|fPIC|fPIE:-K PIC} \ | |
118 %(asm_cpu) \ | |
119 " | |
120 | |
121 /* We don't use the standard LIB_SPEC only because we don't yet support c++. */ | |
122 #undef LIB_SPEC | |
123 #define LIB_SPEC \ | |
124 "%{compat-bsd:-lucb -lsocket -lnsl -lelf -laio} \ | |
125 %{!shared:\ | |
126 %{!symbolic:\ | |
127 %{pthreads|pthread:-lpthread} \ | |
128 %{!pthreads:%{!pthread:%{threads:-lthread}}} \ | |
129 %{p|pg:-ldl} -lc}}" | |
130 | |
131 #undef ENDFILE_SPEC | |
132 #define ENDFILE_SPEC "crtend.o%s crtn.o%s" | |
133 | |
134 /* We don't use the standard svr4 STARTFILE_SPEC because it's wrong for us. */ | |
135 #undef STARTFILE_SPEC | |
136 #define STARTFILE_SPEC "%{!shared: \ | |
137 %{!symbolic: \ | |
138 %{p:mcrt1.o%s} \ | |
139 %{!p: \ | |
140 %{pg:gcrt1.o%s gmon.o%s} \ | |
141 %{!pg:crt1.o%s}}}} \ | |
142 crti.o%s %(startfile_arch) \ | |
143 crtbegin.o%s" | |
144 | |
145 #undef STARTFILE_ARCH32_SPEC | |
146 #define STARTFILE_ARCH32_SPEC "%{ansi:values-Xc.o%s} \ | |
147 %{!ansi:values-Xa.o%s}" | |
148 | |
149 #undef STARTFILE_ARCH_SPEC | |
150 #define STARTFILE_ARCH_SPEC STARTFILE_ARCH32_SPEC | |
151 | |
152 #undef LINK_ARCH32_SPEC_BASE | |
153 #define LINK_ARCH32_SPEC_BASE \ | |
154 "%{G:-G} \ | |
155 %{YP,*} \ | |
156 %{R*} \ | |
157 %{compat-bsd: \ | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
158 %{!YP,*:%{p|pg:-Y P,%R/usr/ucblib:%R/usr/ccs/lib/libp:%R/usr/lib/libp:%R/usr/ccs/lib:%R/usr/lib} \ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
159 %{!p:%{!pg:-Y P,%R/usr/ucblib:%R/usr/ccs/lib:%R/usr/lib}}} \ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
160 -R %R/usr/ucblib} \ |
0 | 161 %{!compat-bsd: \ |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
162 %{!YP,*:%{p|pg:-Y P,%R/usr/ccs/lib/libp:%R/usr/lib/libp:%R/usr/ccs/lib:%R/usr/lib} \ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
163 %{!p:%{!pg:-Y P,%R/usr/ccs/lib:%R/usr/lib}}}}" |
0 | 164 |
165 #undef LINK_ARCH32_SPEC | |
166 #define LINK_ARCH32_SPEC LINK_ARCH32_SPEC_BASE | |
167 | |
168 #undef LINK_ARCH_SPEC | |
169 #define LINK_ARCH_SPEC LINK_ARCH32_SPEC | |
170 | |
171 /* This should be the same as in svr4.h, except with -R added. */ | |
172 #undef LINK_SPEC | |
173 #define LINK_SPEC \ | |
174 "%{h*} %{v:-V} \ | |
175 %{b} \ | |
176 %{static:-dn -Bstatic} \ | |
177 %{shared:-G -dy %{!mimpure-text:-z text}} \ | |
178 %{symbolic:-Bsymbolic -G -dy -z text} \ | |
179 %(link_arch) \ | |
180 %{Qy:} %{!Qn:-Qy}" | |
181 | |
182 /* The Solaris linker doesn't understand constructor priorities. (The | |
183 GNU linker does support constructor priorities, so GNU ld | |
184 configuration files for Solaris override this setting.) */ | |
185 #undef SUPPORTS_INIT_PRIORITY | |
186 #define SUPPORTS_INIT_PRIORITY 0 | |
187 | |
188 /* This defines which switch letters take arguments. | |
189 It is as in svr4.h but with -R added. */ | |
190 #undef SWITCH_TAKES_ARG | |
191 #define SWITCH_TAKES_ARG(CHAR) \ | |
192 (DEFAULT_SWITCH_TAKES_ARG(CHAR) \ | |
193 || (CHAR) == 'R' \ | |
194 || (CHAR) == 'h' \ | |
195 || (CHAR) == 'z') | |
196 | |
197 #define STDC_0_IN_SYSTEM_HEADERS 1 | |
198 | |
199 /* | |
200 * Attempt to turn on access permissions for the stack. | |
201 * | |
202 * _SC_STACK_PROT is only defined for post 2.6, but we want this code | |
203 * to run always. 2.6 can change the stack protection but has no way to | |
204 * query it. | |
205 * | |
206 */ | |
207 | |
208 /* sys/mman.h is not present on some non-Solaris configurations | |
209 that use sol2.h, so ENABLE_EXECUTE_STACK must use a magic | |
210 number instead of the appropriate PROT_* flags. */ | |
211 | |
212 #define ENABLE_EXECUTE_STACK \ | |
213 \ | |
214 /* #define STACK_PROT_RWX (PROT_READ | PROT_WRITE | PROT_EXEC) */ \ | |
215 \ | |
216 static int need_enable_exec_stack; \ | |
217 \ | |
218 static void check_enabling(void) __attribute__ ((constructor)); \ | |
219 static void check_enabling(void) \ | |
220 { \ | |
221 extern long sysconf(int); \ | |
222 \ | |
223 int prot = (int) sysconf(515 /* _SC_STACK_PROT */); \ | |
224 if (prot != 7 /* STACK_PROT_RWX */) \ | |
225 need_enable_exec_stack = 1; \ | |
226 } \ | |
227 \ | |
228 extern void __enable_execute_stack (void *); \ | |
229 void \ | |
230 __enable_execute_stack (void *addr) \ | |
231 { \ | |
232 extern int mprotect(void *, size_t, int); \ | |
233 if (!need_enable_exec_stack) \ | |
234 return; \ | |
235 else { \ | |
236 long size = getpagesize (); \ | |
237 long mask = ~(size-1); \ | |
238 char *page = (char *) (((long) addr) & mask); \ | |
239 char *end = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \ | |
240 \ | |
241 if (mprotect (page, end - page, 7 /* STACK_PROT_RWX */) < 0) \ | |
242 perror ("mprotect of trampoline code"); \ | |
243 } \ | |
244 } | |
245 | |
246 /* Support Solaris-specific format checking for cmn_err. */ | |
247 #define TARGET_N_FORMAT_TYPES 1 | |
248 #define TARGET_FORMAT_TYPES solaris_format_types | |
249 | |
250 /* #pragma init and #pragma fini are implemented on top of init and | |
251 fini attributes. */ | |
252 #define SOLARIS_ATTRIBUTE_TABLE \ | |
253 { "init", 0, 0, true, false, false, NULL }, \ | |
254 { "fini", 0, 0, true, false, false, NULL } | |
255 | |
256 /* This is how to declare the size of a function. For Solaris, we output | |
257 any .init or .fini entries here. */ | |
258 #undef ASM_DECLARE_FUNCTION_SIZE | |
259 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ | |
260 do \ | |
261 { \ | |
262 if (!flag_inhibit_size_directive) \ | |
263 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \ | |
264 solaris_output_init_fini (FILE, DECL); \ | |
265 } \ | |
266 while (0) | |
267 | |
268 extern GTY(()) tree solaris_pending_aligns; | |
269 extern GTY(()) tree solaris_pending_inits; | |
270 extern GTY(()) tree solaris_pending_finis; | |
271 | |
272 /* Allow macro expansion in #pragma pack. */ | |
273 #define HANDLE_PRAGMA_PACK_WITH_EXPANSION |