]>
Commit | Line | Data |
---|---|---|
1b4a979b ME |
1 | /* Base configuration file for all OpenBSD targets. |
2 | Copyright (C) 1999 Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of GNU CC. | |
5 | ||
6 | GNU CC is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2, or (at your option) | |
9 | any later version. | |
10 | ||
11 | GNU CC is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GNU CC; see the file COPYING. If not, write to | |
18 | the Free Software Foundation, 59 Temple Place - Suite 330, | |
19 | Boston, MA 02111-1307, USA. */ | |
20 | ||
21 | /* Common OpenBSD configuration. | |
22 | All OpenBSD architectures include this file, which is intended as | |
23 | a repository for common defines. | |
24 | ||
25 | Some defines are common to all architectures, a few of them are | |
26 | triggered by OBSD_* guards, so that we won't override architecture | |
27 | defaults by mistakes. | |
28 | ||
29 | OBSD_HAS_CORRECT_SPECS: | |
30 | another mechanism provides correct specs already. | |
31 | OBSD_NO_DYNAMIC_LIBRARIES: | |
32 | no implementation of dynamic libraries. | |
33 | OBSD_OLD_GAS: | |
34 | older flavor of gas which needs help for PIC. | |
35 | OBSD_HAS_DECLARE_FUNCTION_NAME, OBSD_HAS_DECLARE_FUNCTION_SIZE, | |
36 | OBSD_HAS_DECLARE_OBJECT: | |
37 | PIC support, FUNCTION_NAME/FUNCTION_SIZE are independent, whereas | |
38 | the corresponding logic for OBJECTS is necessarily coupled. | |
39 | ||
40 | There are also a few `default' defines such as ASM_WEAKEN_LABEL, | |
41 | intended as common ground for arch that don't provide | |
42 | anything suitable. */ | |
43 | ||
44 | /* OPENBSD_NATIVE is defined only when gcc is configured as part of | |
45 | the OpenBSD source tree, specifically through Makefile.bsd-wrapper. | |
46 | ||
47 | In such a case the include path can be trimmed as there is no | |
48 | distinction between system includes and gcc includes. */ | |
49 | ||
50 | /* This configuration method, namely Makefile.bsd-wrapper and | |
51 | OPENBSD_NATIVE is NOT recommended for building cross-compilers. */ | |
52 | ||
53 | #ifdef OPENBSD_NATIVE | |
54 | ||
55 | #undef GCC_INCLUDE_DIR | |
56 | #define GCC_INCLUDE_DIR "/usr/include" | |
57 | ||
58 | /* The compiler is configured with ONLY the gcc/g++ standard headers. */ | |
59 | #undef INCLUDE_DEFAULTS | |
60 | #define INCLUDE_DEFAULTS \ | |
61 | { \ | |
62 | { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \ | |
63 | { GCC_INCLUDE_DIR, "GCC", 0, 0 }, \ | |
64 | { 0, 0, 0, 0 } \ | |
65 | } | |
66 | ||
67 | /* Under OpenBSD, the normal location of the various *crt*.o files is the | |
68 | /usr/lib directory. */ | |
69 | #define STANDARD_STARTFILE_PREFIX "/usr/lib/" | |
70 | ||
71 | #endif | |
72 | ||
73 | \f | |
74 | /* Controlling the compilation driver. */ | |
75 | ||
76 | /* CPP_SPEC appropriate for OpenBSD. We deal with -posix and -pthread. | |
77 | XXX the way threads are handling currently is not very satisfying, | |
78 | since all code must be compiled with -pthread to work. | |
79 | This two-stage defines makes it easy to pick that for targets that | |
80 | have subspecs. */ | |
81 | #define OBSD_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}" | |
82 | ||
83 | /* LIB_SPEC appropriate for OpenBSD. Select the appropriate libc, | |
84 | depending on profiling and threads. Basically, | |
85 | -lc(_r)?(_p)?, select _r for threads, and _p for p or pg. */ | |
86 | #define OBSD_LIB_SPEC "-lc%{pthread:_r}%{p:_p}%{!p:%{pg:_p}}" | |
87 | ||
88 | #ifndef OBSD_HAS_CORRECT_SPECS | |
89 | ||
90 | #ifndef OBSD_NO_DYNAMIC_LIBRARIES | |
91 | #undef SWITCH_TAKES_ARG | |
92 | #define SWITCH_TAKES_ARG(CHAR) \ | |
93 | (DEFAULT_SWITCH_TAKES_ARG (CHAR) \ | |
94 | || (CHAR) == 'R') | |
95 | #endif | |
96 | ||
97 | #undef CPP_SPEC | |
98 | #define CPP_SPEC OBSD_CPP_SPEC | |
99 | ||
100 | #ifdef OBSD_OLD_GAS | |
101 | /* ASM_SPEC appropriate for OpenBSD. For some architectures, OpenBSD | |
102 | still uses a special flavor of gas that needs to be told when generating | |
103 | pic code. */ | |
104 | #undef ASM_SPEC | |
105 | #define ASM_SPEC "%{fpic:-k} %{fPIC:-k -K} %|" | |
106 | #else | |
107 | /* Since we use gas, stdin -> - is a good idea, but we don't want to | |
108 | override native specs just for that. */ | |
109 | #ifndef ASM_SPEC | |
110 | #define ASM_SPEC "%|" | |
111 | #endif | |
112 | #endif | |
113 | ||
114 | /* LINK_SPEC appropriate for OpenBSD. Support for GCC options | |
115 | -static, -assert, and -nostdlib. */ | |
116 | #undef LINK_SPEC | |
117 | #ifdef OBSD_NO_DYNAMIC_LIBRARIES | |
118 | #define LINK_SPEC \ | |
119 | "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{assert*}" | |
120 | #else | |
121 | #define LINK_SPEC \ | |
122 | "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{R*} %{static:-Bstatic} %{assert*}" | |
123 | #endif | |
124 | ||
125 | #undef LIB_SPEC | |
126 | #define LIB_SPEC OBSD_LIB_SPEC | |
127 | #endif | |
128 | ||
129 | \f | |
130 | /* Runtime target specification. */ | |
131 | ||
132 | /* You must redefine CPP_PREDEFINES in any arch specific file. */ | |
133 | #undef CPP_PREDEFINES | |
134 | ||
135 | /* Implicit calls to library routines. */ | |
136 | ||
137 | /* Use memcpy and memset instead of bcopy and bzero. */ | |
138 | #define TARGET_MEM_FUNCTIONS | |
139 | ||
140 | /* Miscellaneous parameters. */ | |
141 | ||
1b4a979b ME |
142 | /* Controlling debugging info: dbx options. */ |
143 | ||
144 | /* Don't use the `xsTAG;' construct in DBX output; OpenBSD systems that | |
145 | use DBX don't support it. */ | |
146 | #define DBX_NO_XREFS | |
147 | ||
148 | \f | |
149 | /* Support of shared libraries, mostly imported from svr4.h through netbsd. */ | |
150 | /* Two differences from svr4.h: | |
151 | - we use . - _func instead of a local label, | |
152 | - we put extra spaces in expressions such as | |
153 | .type _func , @function | |
154 | This is more readable for a human being and confuses c++filt less. */ | |
155 | ||
156 | /* Assembler format: output and generation of labels. */ | |
157 | ||
158 | /* Define the strings used for the .type and .size directives. | |
159 | These strings generally do not vary from one system running OpenBSD | |
160 | to another, but if a given system needs to use different pseudo-op | |
161 | names for these, they may be overridden in the arch specific file. */ | |
162 | ||
163 | /* OpenBSD assembler is hacked to have .type & .size support even in a.out | |
164 | format object files. Functions size are supported but not activated | |
203cb4ef ME |
165 | yet (look for GRACE_PERIOD_EXPIRED in gas/config/obj-aout.c). |
166 | SET_ASM_OP is needed for attribute alias to work. */ | |
1b4a979b ME |
167 | |
168 | #undef TYPE_ASM_OP | |
169 | #undef SIZE_ASM_OP | |
203cb4ef | 170 | #undef SET_ASM_OP |
1b4a979b ME |
171 | |
172 | #define TYPE_ASM_OP ".type" | |
173 | #define SIZE_ASM_OP ".size" | |
203cb4ef | 174 | #define SET_ASM_OP ".set" |
1b4a979b ME |
175 | |
176 | /* The following macro defines the format used to output the second | |
177 | operand of the .type assembler directive. */ | |
178 | #undef TYPE_OPERAND_FMT | |
179 | #define TYPE_OPERAND_FMT "@%s" | |
180 | ||
181 | /* Provision if extra assembler code is needed to declare a function's result | |
182 | (taken from svr4, not needed yet actually). */ | |
183 | #ifndef ASM_DECLARE_RESULT | |
184 | #define ASM_DECLARE_RESULT(FILE, RESULT) | |
185 | #endif | |
186 | ||
187 | /* These macros generate the special .type and .size directives which | |
188 | are used to set the corresponding fields of the linker symbol table | |
189 | entries under OpenBSD. These macros also have to output the starting | |
190 | labels for the relevant functions/objects. */ | |
191 | ||
192 | #ifndef OBSD_HAS_DECLARE_FUNCTION_NAME | |
193 | /* Extra assembler code needed to declare a function properly. | |
194 | Some assemblers may also need to also have something extra said | |
195 | about the function's return value. We allow for that here. */ | |
196 | #undef ASM_DECLARE_FUNCTION_NAME | |
197 | #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ | |
198 | do { \ | |
199 | fprintf (FILE, "\t%s\t", TYPE_ASM_OP); \ | |
200 | assemble_name (FILE, NAME); \ | |
201 | fputs (" , ", FILE); \ | |
202 | fprintf (FILE, TYPE_OPERAND_FMT, "function"); \ | |
203 | putc ('\n', FILE); \ | |
204 | ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ | |
205 | ASM_OUTPUT_LABEL(FILE, NAME); \ | |
206 | } while (0) | |
207 | #endif | |
208 | ||
209 | #ifndef OBSD_HAS_DECLARE_FUNCTION_SIZE | |
210 | /* Declare the size of a function. */ | |
211 | #undef ASM_DECLARE_FUNCTION_SIZE | |
212 | #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ | |
213 | do { \ | |
214 | if (!flag_inhibit_size_directive) \ | |
215 | { \ | |
216 | fprintf (FILE, "\t%s\t", SIZE_ASM_OP); \ | |
217 | assemble_name (FILE, (FNAME)); \ | |
218 | fputs (" , . - ", FILE); \ | |
219 | assemble_name (FILE, (FNAME)); \ | |
220 | putc ('\n', FILE); \ | |
221 | } \ | |
222 | } while (0) | |
223 | #endif | |
224 | ||
225 | #ifndef OBSD_HAS_DECLARE_OBJECT | |
226 | /* Extra assembler code needed to declare an object properly. */ | |
227 | #undef ASM_DECLARE_OBJECT_NAME | |
228 | #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ | |
229 | do { \ | |
230 | fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ | |
231 | assemble_name (FILE, NAME); \ | |
232 | fputs (" , ", FILE); \ | |
233 | fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ | |
234 | putc ('\n', FILE); \ | |
235 | size_directive_output = 0; \ | |
236 | if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ | |
237 | { \ | |
238 | size_directive_output = 1; \ | |
239 | fprintf (FILE, "\t%s\t", SIZE_ASM_OP); \ | |
240 | assemble_name (FILE, NAME); \ | |
241 | fprintf (FILE, " , %d\n", int_size_in_bytes (TREE_TYPE (DECL)));\ | |
242 | } \ | |
243 | ASM_OUTPUT_LABEL (FILE, NAME); \ | |
244 | } while (0) | |
245 | ||
246 | /* Output the size directive for a decl in rest_of_decl_compilation | |
247 | in the case where we did not do so before the initializer. | |
248 | Once we find the error_mark_node, we know that the value of | |
249 | size_directive_output was set by ASM_DECLARE_OBJECT_NAME | |
250 | when it was run for the same decl. */ | |
251 | #undef ASM_FINISH_DECLARE_OBJECT | |
252 | #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ | |
253 | do { \ | |
254 | char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ | |
255 | if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ | |
256 | && ! AT_END && TOP_LEVEL \ | |
257 | && DECL_INITIAL (DECL) == error_mark_node \ | |
258 | && !size_directive_output) \ | |
259 | { \ | |
260 | size_directive_output = 1; \ | |
261 | fprintf (FILE, "\t%s\t", SIZE_ASM_OP); \ | |
262 | assemble_name (FILE, name); \ | |
263 | fprintf (FILE, " , %d\n", int_size_in_bytes (TREE_TYPE (DECL)));\ | |
264 | } \ | |
265 | } while (0) | |
266 | #endif | |
267 | ||
268 | \f | |
269 | /* Those are `generic' ways to weaken/globalize a label. We shouldn't need | |
270 | to override a processor specific definition. Hence, #ifndef ASM_* | |
271 | In case overriding turns out to be needed, one can always #undef ASM_* | |
272 | before including this file. */ | |
273 | ||
274 | /* Tell the assembler that a symbol is weak. */ | |
275 | /* Note: netbsd arm32 assembler needs a .globl here. An override may | |
276 | be needed when/if we go for arm32 support. */ | |
277 | #ifndef ASM_WEAKEN_LABEL | |
278 | #define ASM_WEAKEN_LABEL(FILE,NAME) \ | |
279 | do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ | |
280 | fputc ('\n', FILE); } while (0) | |
281 | #endif | |
282 | ||
283 | /* Tell the assembler that a symbol is global. */ | |
284 | #ifndef ASM_GLOBALIZE_LABEL | |
285 | #define ASM_GLOBALIZE_LABEL(FILE,NAME) \ | |
286 | do { fputs ("\t.globl\t", FILE); assemble_name (FILE, NAME); \ | |
287 | fputc ('\n', FILE); } while(0) | |
288 | #endif | |
289 | ||
290 | \f | |
291 | /* Storage layout. */ | |
292 | ||
293 | /* We don't have to worry about binary compatibility with older C++ code, | |
294 | but there is a big known bug with vtable thunks which has not been | |
295 | fixed yet, so DON'T activate it by default. */ | |
296 | /* #define DEFAULT_VTABLE_THUNKS 1 */ | |
297 | ||
298 | \f | |
299 | /* Otherwise, since we support weak, gthr.h erroneously tries to use | |
300 | #pragma weak. */ | |
301 | #define GTHREAD_USE_WEAK 0 | |
302 | ||
e4cbe002 JL |
303 | /* bug work around: we don't want to support #pragma weak, but the current |
304 | code layout needs HANDLE_PRAGMA_WEAK asserted for __attribute((weak)) to | |
305 | work. On the other hand, we don't define HANDLE_PRAGMA_WEAK directly, | |
306 | as this depends on a few other details as well... */ | |
307 | #define HANDLE_SYSV_PRAGMA | |
308 |