1/* Configuration for an OpenBSD i386 target.
2
3   Copyright (C) 2005 Free Software Foundation, Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GCC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING.  If not, write to
19the Free Software Foundation, 51 Franklin Street, Fifth Floor,
20Boston, MA 02110-1301, USA.  */
21
22/* This gets defined in tm.h->linux.h->svr4.h, and keeps us from using
23   libraries compiled with the native cc, so undef it. */
24#undef NO_DOLLAR_IN_LABEL
25
26/* Override the default comment-starter of "/".  */
27#undef ASM_COMMENT_START
28#define ASM_COMMENT_START "#"
29
30#undef DBX_REGISTER_NUMBER
31#define DBX_REGISTER_NUMBER(n)  svr4_dbx_register_map[n]
32
33/* This goes away when the math-emulator is fixed */
34#undef TARGET_DEFAULT
35#define TARGET_DEFAULT \
36  (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387)
37
38/* Run-time target specifications */
39
40#define TARGET_OS_CPP_BUILTINS()		\
41  do						\
42    {						\
43    	OPENBSD_OS_CPP_BUILTINS();		\
44    }						\
45  while (0)
46
47/* As an elf system, we need crtbegin/crtend stuff.  */
48#undef STARTFILE_SPEC
49#define STARTFILE_SPEC "\
50	%{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} \
51	%{!p:%{!static:crt0%O%s} %{static:%{nopie:crt0%O%s} \
52	%{!nopie:rcrt0%O%s}}}} crtbegin%O%s} %{shared:crtbeginS%O%s}"
53#undef ENDFILE_SPEC
54#define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
55
56/* Layout of source language data types.  */
57
58/* This must agree with <machine/ansi.h> */
59#undef SIZE_TYPE
60#define SIZE_TYPE "long unsigned int"
61
62#undef PTRDIFF_TYPE
63#define PTRDIFF_TYPE "long int"
64
65#undef WCHAR_TYPE
66#define WCHAR_TYPE "int"
67
68#undef WCHAR_TYPE_SIZE
69#define WCHAR_TYPE_SIZE BITS_PER_WORD
70
71/* Assembler format: overall framework.  */
72
73#undef ASM_APP_ON
74#define ASM_APP_ON "#APP\n"
75
76#undef ASM_APP_OFF
77#define ASM_APP_OFF "#NO_APP\n"
78
79#undef SET_ASM_OP
80#define SET_ASM_OP	"\t.set\t"
81
82/* The following macros were originally stolen from i386v4.h.
83   These have to be defined to get PIC code correct.  */
84
85/* Assembler format: dispatch tables.  */
86
87/* Assembler format: sections.  */
88
89/* Stack & calling: aggregate returns.  */
90
91/* Don't default to pcc-struct-return, because gcc is the only compiler, and
92   we want to retain compatibility with older gcc versions.  */
93#define DEFAULT_PCC_STRUCT_RETURN 0
94
95/* Assembler format: alignment output.  */
96
97#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
98#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
99  if ((LOG) != 0) {\
100    if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
101    else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
102  }
103#endif
104
105/* Stack & calling: profiling.  */
106
107/* OpenBSD's profiler recovers all information from the stack pointer.
108   The icky part is not here, but in machine/profile.h.  */
109#undef FUNCTION_PROFILER
110#define FUNCTION_PROFILER(FILE, LABELNO)  \
111  fputs (flag_pic ? "\tcall __mcount@PLT\n": "\tcall __mcount\n", FILE);
112
113/* Assembler format: exception region output.  */
114
115/* Assembler format: alignment output.  */
116
117/* Note that we pick up ASM_OUTPUT_MAX_SKIP_ALIGN from i386/gas.h */
118
119/* Note that we pick up ASM_OUTPUT_MI_THUNK from unix.h.  */
120
121#undef LINK_SPEC
122#define LINK_SPEC \
123  "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e __start}}}} \
124   %{shared:-shared} %{R*} \
125   %{static:-Bstatic} \
126   %{!static:-Bdynamic} \
127   %{rdynamic:-export-dynamic} \
128   %{assert*} \
129   %{!static:%{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}} \
130   %{!nostdlib:-L/usr/lib}"
131
132#define OBSD_HAS_CORRECT_SPECS
133