1/* Configuration for  a MIPS ABI32 OpenBSD target.
2   Copyright (C) 1999, 2003, 2004 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify
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
11GCC is distributed in the hope that it will be useful,
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
17along with GCC; see the file COPYING.  If not, write to
18the Free Software Foundation, 51 Franklin Street, Fifth Floor,
19Boston, MA 02110-1301, USA.  */
20
21/* Definitions needed for OpenBSD, to avoid picking mips 'defaults'.  */
22
23/* GAS must know this.  */
24#undef SUBTARGET_ASM_SPEC
25#define SUBTARGET_ASM_SPEC "%{fPIC|fPIE:-KPIC}"
26
27#define AS_NEEDS_DASH_FOR_PIPED_INPUT
28
29/* CPP specific OpenBSD specs.  */
30#undef SUBTARGET_CPP_SPEC
31#define SUBTARGET_CPP_SPEC OBSD_CPP_SPEC
32
33/* Needed for ELF (inspired by netbsd-elf).  */
34#undef LOCAL_LABEL_PREFIX
35#define LOCAL_LABEL_PREFIX	"."
36
37/* The profiling lib spec here is not really correct but we leave
38   it as it is until we have some kind of profiling working.  */
39#define LIB_SPEC OBSD_LIB_SPEC
40
41/* mips assembler uses .set for arcane purposes.  __attribute__((alias))
42   and friends won't work until we get recent binutils with .weakext
43	support.  */
44#undef SET_ASM_OP
45
46#define TARGET_OS_CPP_BUILTINS()			\
47    do {						\
48	builtin_define ("__unix__");			\
49	builtin_define ("__SYSTYPE_BSD__");		\
50	builtin_define ("__NO_LEADING_UNDERSCORES__");	\
51	builtin_define ("__GP_SUPPORT__");		\
52	builtin_define ("__OpenBSD__");			\
53	builtin_assert ("system=unix");			\
54	builtin_assert ("system=OpenBSD");		\
55} while (0)
56
57/* Layout of source language data types.  */
58
59/* This must agree with <machine/ansi.h>.  */
60#undef SIZE_TYPE
61#define SIZE_TYPE "unsigned int"
62
63#undef PTRDIFF_TYPE
64#define PTRDIFF_TYPE "int"
65
66#undef WCHAR_TYPE
67#define WCHAR_TYPE "int"
68
69#undef WCHAR_TYPE_SIZE
70#define WCHAR_TYPE_SIZE 32
71
72/* Controlling the compilation driver.  */
73
74/* LINK_SPEC appropriate for OpenBSD:  support for GCC options
75   -static, -assert, and -nostdlib. Dynamic loader control.  */
76#undef LINK_SPEC
77#define LINK_SPEC \
78  "%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
79   %{bestGnum} %{shared} %{non_shared} \
80   %{call_shared} %{no_archive} %{exact_version} \
81   %{!shared: %{!non_shared: %{!call_shared: -non_shared}}} \
82   %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so} \
83   %{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp \
84   %{static:-Bstatic} %{!static:-Bdynamic} %{assert*}"
85
86/* -G is incompatible with -KPIC which is the default, so only allow objects
87   in the small data section if the user explicitly asks for it.  */
88#undef MIPS_DEFAULT_GVALUE
89#define MIPS_DEFAULT_GVALUE 0
90
91
92/* Since gas and gld are standard on OpenBSD, we don't need these.  */
93#undef ASM_FINAL_SPEC
94#undef STARTFILE_SPEC
95
96/* Switch into a generic section.  */
97#undef TARGET_ASM_NAMED_SECTION
98#define TARGET_ASM_NAMED_SECTION  default_elf_asm_named_section
99