1193323Sed/* Configuration for an OpenBSD i386 target.
2193323Sed
3193323Sed   Copyright (C) 2005-2020 Free Software Foundation, Inc.
4193323Sed
5193323SedThis file is part of GCC.
6193323Sed
7193323SedGCC is free software; you can redistribute it and/or modify
8193323Sedit under the terms of the GNU General Public License as published by
9193323Sedthe Free Software Foundation; either version 3, or (at your option)
10193323Sedany later version.
11193323Sed
12193323SedGCC is distributed in the hope that it will be useful,
13193323Sedbut WITHOUT ANY WARRANTY; without even the implied warranty of
14193323SedMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15193323SedGNU General Public License for more details.
16239462Sdim
17249423SdimYou should have received a copy of the GNU General Public License
18249423Sdimalong with GCC; see the file COPYING3.  If not see
19249423Sdim<http://www.gnu.org/licenses/>.  */
20193323Sed
21193323Sed#define TARGET_OS_CPP_BUILTINS()		\
22239462Sdim  do						\
23239462Sdim    {						\
24193323Sed    	OPENBSD_OS_CPP_BUILTINS();		\
25249423Sdim    }						\
26249423Sdim  while (0)
27249423Sdim
28249423Sdim#undef DBX_REGISTER_NUMBER
29249423Sdim#define DBX_REGISTER_NUMBER(n) \
30249423Sdim  (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
31249423Sdim
32193323Sed/* This must agree with <machine/_types.h>.  */
33193323Sed#undef SIZE_TYPE
34198090Srdivacky#define SIZE_TYPE "long unsigned int"
35198090Srdivacky
36249423Sdim#undef PTRDIFF_TYPE
37193323Sed#define PTRDIFF_TYPE "long int"
38193323Sed
39193323Sed#undef WCHAR_TYPE
40193323Sed#define WCHAR_TYPE "int"
41193323Sed
42193323Sed#undef WCHAR_TYPE_SIZE
43193323Sed#define WCHAR_TYPE_SIZE 32
44193323Sed
45193323Sed#undef WINT_TYPE
46193323Sed#define WINT_TYPE "int"
47193323Sed
48193323Sed/* Don't default to pcc-struct-return, because gcc is the only compiler, and
49239462Sdim   we want to retain compatibility with older gcc versions.  */
50239462Sdim
51239462Sdim#undef DEFAULT_PCC_STRUCT_RETURN
52239462Sdim#define DEFAULT_PCC_STRUCT_RETURN 0
53239462Sdim
54193323Sed/* Override the default comment-starter of "/".  */
55239462Sdim#undef ASM_COMMENT_START
56239462Sdim#define ASM_COMMENT_START "#"
57239462Sdim
58239462Sdim#undef ASM_APP_ON
59239462Sdim#define ASM_APP_ON "#APP\n"
60239462Sdim
61239462Sdim#undef ASM_APP_OFF
62239462Sdim#define ASM_APP_OFF "#NO_APP\n"
63239462Sdim
64193323Sed/* A C statement to output to the stdio stream FILE an assembler
65239462Sdim   command to advance the location counter to a multiple of 1<<LOG
66239462Sdim   bytes if it is within MAX_SKIP bytes.  */
67193323Sed
68239462Sdim#define SUBALIGN_LOG 3
69239462Sdim
70239462Sdim#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
71239462Sdim#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP)			\
72239462Sdim  do {									\
73193323Sed    if ((LOG) != 0) {							\
74239462Sdim      if ((MAX_SKIP) == 0 || (MAX_SKIP) >= (1 << (LOG)) - 1)		\
75239462Sdim	fprintf ((FILE), "\t.p2align %d\n", (LOG));			\
76239462Sdim      else								\
77239462Sdim	fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP));	\
78239462Sdim    }									\
79239462Sdim  } while (0)
80239462Sdim#endif
81239462Sdim
82239462Sdim/* OpenBSD's profiler recovers all information from the stack pointer.
83239462Sdim   The icky part is not here, but in <machine/profile.h>.  */
84239462Sdim#undef FUNCTION_PROFILER
85193323Sed#define FUNCTION_PROFILER(FILE, LABELNO)  \
86239462Sdim  fputs (flag_pic ? "\tcall __mcount@PLT\n": "\tcall __mcount\n", FILE);
87193323Sed
88239462Sdim#undef LINK_SPEC
89239462Sdim#define LINK_SPEC \
90239462Sdim  "%{!shared:%{!nostdlib:%{!r:%{!e*:-e __start}}}} \
91239462Sdim   %{shared:-shared} %{R*} \
92239462Sdim   %{static:-Bstatic} \
93239462Sdim   %{!static:-Bdynamic} \
94239462Sdim   %{assert*} \
95239462Sdim   -dynamic-linker /usr/libexec/ld.so"
96239462Sdim
97239462Sdim#undef STARTFILE_SPEC
98193323Sed#define STARTFILE_SPEC "\
99239462Sdim	%{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \
100239462Sdim	crtbegin%O%s} %{shared:crtbeginS%O%s}"
101193323Sed
102239462Sdim#undef ENDFILE_SPEC
103239462Sdim#define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
104239462Sdim
105239462Sdim#define OBSD_HAS_CORRECT_SPECS
106239462Sdim
107193323Sed#define HAVE_ENABLE_EXECUTE_STACK
108239462Sdim