]> gcc.gnu.org Git - gcc.git/blame - gcc/config/openbsd.h
c-decl.c, [...]: Don't check TARGET_MEM_FUNCTIONS.
[gcc.git] / gcc / config / openbsd.h
CommitLineData
1b4a979b 1/* Base configuration file for all OpenBSD targets.
e662a129 2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
1b4a979b 3
7ec022b2 4This file is part of GCC.
1b4a979b 5
7ec022b2 6GCC is free software; you can redistribute it and/or modify
1b4a979b
ME
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
7ec022b2 11GCC is distributed in the hope that it will be useful,
1b4a979b
ME
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
7ec022b2 17along with GCC; see the file COPYING. If not, write to
1b4a979b
ME
18the Free Software Foundation, 59 Temple Place - Suite 330,
19Boston, 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. */
f1cf4606
ME
81#ifdef CPP_CPU_SPEC
82#define OBSD_CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
83#else
1b4a979b 84#define OBSD_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
f1cf4606 85#endif
1b4a979b
ME
86
87/* LIB_SPEC appropriate for OpenBSD. Select the appropriate libc,
88 depending on profiling and threads. Basically,
89 -lc(_r)?(_p)?, select _r for threads, and _p for p or pg. */
f1cf4606 90#define OBSD_LIB_SPEC "%{!shared:-lc%{pthread:_r}%{p:_p}%{!p:%{pg:_p}}}"
1b4a979b
ME
91
92#ifndef OBSD_HAS_CORRECT_SPECS
93
94#ifndef OBSD_NO_DYNAMIC_LIBRARIES
95#undef SWITCH_TAKES_ARG
96#define SWITCH_TAKES_ARG(CHAR) \
97 (DEFAULT_SWITCH_TAKES_ARG (CHAR) \
98 || (CHAR) == 'R')
99#endif
100
101#undef CPP_SPEC
102#define CPP_SPEC OBSD_CPP_SPEC
103
104#ifdef OBSD_OLD_GAS
105/* ASM_SPEC appropriate for OpenBSD. For some architectures, OpenBSD
106 still uses a special flavor of gas that needs to be told when generating
107 pic code. */
108#undef ASM_SPEC
24a4dd31 109#define ASM_SPEC "%{fpic|fpie:-k} %{fPIC|fPIE:-k -K}"
1b4a979b
ME
110#endif
111
4977bab6
ZW
112/* Since we use gas, stdin -> - is a good idea. */
113#define AS_NEEDS_DASH_FOR_PIPED_INPUT
114
1b4a979b
ME
115/* LINK_SPEC appropriate for OpenBSD. Support for GCC options
116 -static, -assert, and -nostdlib. */
117#undef LINK_SPEC
118#ifdef OBSD_NO_DYNAMIC_LIBRARIES
119#define LINK_SPEC \
f1cf4606 120 "%{g:%{!nostdlib:-L/usr/lib/debug}} %{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{assert*}"
1b4a979b
ME
121#else
122#define LINK_SPEC \
f1cf4606 123 "%{g:%{!nostdlib:-L/usr/lib/debug}} %{!shared:%{!nostdlib:%{!r*:%{!e*:-e start}}}} %{shared:-Bshareable -x} -dc -dp %{R*} %{static:-Bstatic} %{assert*}"
1b4a979b
ME
124#endif
125
126#undef LIB_SPEC
127#define LIB_SPEC OBSD_LIB_SPEC
128#endif
129
130\f
131/* Runtime target specification. */
132
1b4a979b
ME
133/* Miscellaneous parameters. */
134
1b4a979b
ME
135/* Controlling debugging info: dbx options. */
136
137/* Don't use the `xsTAG;' construct in DBX output; OpenBSD systems that
138 use DBX don't support it. */
139#define DBX_NO_XREFS
140
141\f
142/* Support of shared libraries, mostly imported from svr4.h through netbsd. */
143/* Two differences from svr4.h:
144 - we use . - _func instead of a local label,
145 - we put extra spaces in expressions such as
146 .type _func , @function
147 This is more readable for a human being and confuses c++filt less. */
148
149/* Assembler format: output and generation of labels. */
150
151/* Define the strings used for the .type and .size directives.
152 These strings generally do not vary from one system running OpenBSD
153 to another, but if a given system needs to use different pseudo-op
154 names for these, they may be overridden in the arch specific file. */
155
156/* OpenBSD assembler is hacked to have .type & .size support even in a.out
157 format object files. Functions size are supported but not activated
203cb4ef
ME
158 yet (look for GRACE_PERIOD_EXPIRED in gas/config/obj-aout.c).
159 SET_ASM_OP is needed for attribute alias to work. */
1b4a979b
ME
160
161#undef TYPE_ASM_OP
162#undef SIZE_ASM_OP
203cb4ef 163#undef SET_ASM_OP
506a61b1 164#undef GLOBAL_ASM_OP
1b4a979b 165
e662a129
HPN
166#define TYPE_ASM_OP "\t.type\t"
167#define SIZE_ASM_OP "\t.size\t"
168#define SET_ASM_OP "\t.set\t"
506a61b1 169#define GLOBAL_ASM_OP "\t.globl\t"
1b4a979b
ME
170
171/* The following macro defines the format used to output the second
172 operand of the .type assembler directive. */
173#undef TYPE_OPERAND_FMT
174#define TYPE_OPERAND_FMT "@%s"
175
176/* Provision if extra assembler code is needed to declare a function's result
177 (taken from svr4, not needed yet actually). */
178#ifndef ASM_DECLARE_RESULT
179#define ASM_DECLARE_RESULT(FILE, RESULT)
180#endif
181
182/* These macros generate the special .type and .size directives which
183 are used to set the corresponding fields of the linker symbol table
184 entries under OpenBSD. These macros also have to output the starting
185 labels for the relevant functions/objects. */
186
187#ifndef OBSD_HAS_DECLARE_FUNCTION_NAME
188/* Extra assembler code needed to declare a function properly.
189 Some assemblers may also need to also have something extra said
190 about the function's return value. We allow for that here. */
191#undef ASM_DECLARE_FUNCTION_NAME
192#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
193 do { \
2be2ac70 194 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
1b4a979b
ME
195 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
196 ASM_OUTPUT_LABEL(FILE, NAME); \
197 } while (0)
198#endif
199
200#ifndef OBSD_HAS_DECLARE_FUNCTION_SIZE
201/* Declare the size of a function. */
202#undef ASM_DECLARE_FUNCTION_SIZE
99086d59
ZW
203#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
204 do { \
205 if (!flag_inhibit_size_directive) \
206 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
1b4a979b
ME
207 } while (0)
208#endif
209
210#ifndef OBSD_HAS_DECLARE_OBJECT
211/* Extra assembler code needed to declare an object properly. */
212#undef ASM_DECLARE_OBJECT_NAME
2be2ac70
ZW
213#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
214 do { \
215 HOST_WIDE_INT size; \
216 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
217 size_directive_output = 0; \
218 if (!flag_inhibit_size_directive \
219 && (DECL) && DECL_SIZE (DECL)) \
220 { \
221 size_directive_output = 1; \
222 size = int_size_in_bytes (TREE_TYPE (DECL)); \
223 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
224 } \
225 ASM_OUTPUT_LABEL (FILE, NAME); \
1b4a979b
ME
226 } while (0)
227
228/* Output the size directive for a decl in rest_of_decl_compilation
229 in the case where we did not do so before the initializer.
230 Once we find the error_mark_node, we know that the value of
231 size_directive_output was set by ASM_DECLARE_OBJECT_NAME
232 when it was run for the same decl. */
233#undef ASM_FINISH_DECLARE_OBJECT
234#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
235do { \
3cce094d 236 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
2be2ac70 237 HOST_WIDE_INT size; \
1b4a979b
ME
238 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
239 && ! AT_END && TOP_LEVEL \
240 && DECL_INITIAL (DECL) == error_mark_node \
241 && !size_directive_output) \
242 { \
243 size_directive_output = 1; \
2be2ac70
ZW
244 size = int_size_in_bytes (TREE_TYPE (DECL)); \
245 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
1b4a979b
ME
246 } \
247 } while (0)
248#endif
249
250\f
251/* Those are `generic' ways to weaken/globalize a label. We shouldn't need
252 to override a processor specific definition. Hence, #ifndef ASM_*
253 In case overriding turns out to be needed, one can always #undef ASM_*
254 before including this file. */
255
256/* Tell the assembler that a symbol is weak. */
257/* Note: netbsd arm32 assembler needs a .globl here. An override may
258 be needed when/if we go for arm32 support. */
259#ifndef ASM_WEAKEN_LABEL
260#define ASM_WEAKEN_LABEL(FILE,NAME) \
261 do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
262 fputc ('\n', FILE); } while (0)
263#endif
1b4a979b
ME
264\f
265/* Storage layout. */
266
1b4a979b
ME
267\f
268/* Otherwise, since we support weak, gthr.h erroneously tries to use
269 #pragma weak. */
270#define GTHREAD_USE_WEAK 0
271
e4cbe002
JL
272/* bug work around: we don't want to support #pragma weak, but the current
273 code layout needs HANDLE_PRAGMA_WEAK asserted for __attribute((weak)) to
274 work. On the other hand, we don't define HANDLE_PRAGMA_WEAK directly,
275 as this depends on a few other details as well... */
32f0ffb3 276#define HANDLE_SYSV_PRAGMA 1
e4cbe002 277
This page took 1.15773 seconds and 5 git commands to generate.