1/* Configuration for  a MIPS ABI32 OpenBSD target.
2   Copyright (C) 1999, 2003, 2004, 2007, 2008 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 3, 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 COPYING3.  If not see
18<http://www.gnu.org/licenses/>.  */
19
20/* Definitions needed for OpenBSD, to avoid picking mips 'defaults'.  */
21
22/* GAS must know this.  */
23#undef SUBTARGET_ASM_SPEC
24#define SUBTARGET_ASM_SPEC "%{fPIC|fPIE:-KPIC}"
25
26#define AS_NEEDS_DASH_FOR_PIPED_INPUT
27
28/* CPP specific OpenBSD specs.  */
29#undef SUBTARGET_CPP_SPEC
30#define SUBTARGET_CPP_SPEC OBSD_CPP_SPEC
31
32/* Needed for ELF (inspired by netbsd-elf).  */
33#undef LOCAL_LABEL_PREFIX
34#define LOCAL_LABEL_PREFIX	"."
35
36/* The profiling lib spec here is not really correct but we leave
37   it as it is until we have some kind of profiling working.  */
38#define LIB_SPEC OBSD_LIB_SPEC
39
40/* mips assembler uses .set for arcane purposes.  __attribute__((alias))
41   and friends won't work until we get recent binutils with .weakext
42	support.  */
43#undef SET_ASM_OP
44
45#define TARGET_OS_CPP_BUILTINS()			\
46    do {						\
47	builtin_define ("__unix__");			\
48	builtin_define ("__SYSTYPE_BSD__");		\
49	builtin_define ("__NO_LEADING_UNDERSCORES__");	\
50	builtin_define ("__GP_SUPPORT__");		\
51	builtin_define ("__OpenBSD__");			\
52	builtin_assert ("system=unix");			\
53	builtin_assert ("system=OpenBSD");		\
54} while (0)
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 32
70
71#undef WINT_TYPE
72#define WINT_TYPE "int"
73
74/* Controlling the compilation driver.  */
75
76/* LINK_SPEC appropriate for OpenBSD:  support for GCC options
77   -static, -assert, and -nostdlib. Dynamic loader control.  */
78#undef LINK_SPEC
79#define LINK_SPEC \
80  "%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
81   %{bestGnum} %{shared} %{non_shared} \
82   %{call_shared} %{no_archive} %{exact_version} \
83   %{!shared: %{!non_shared: %{!call_shared: -non_shared}}} \
84   %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so} \
85   %{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp \
86   %{static:-Bstatic} %{!static:-Bdynamic} %{assert*}"
87
88/* -G is incompatible with -KPIC which is the default, so only allow objects
89   in the small data section if the user explicitly asks for it.  */
90#undef MIPS_DEFAULT_GVALUE
91#define MIPS_DEFAULT_GVALUE 0
92
93
94/* Since gas and gld are standard on OpenBSD, we don't need these.  */
95#undef ASM_FINAL_SPEC
96#undef STARTFILE_SPEC
97
98/* Switch into a generic section.  */
99#undef TARGET_ASM_NAMED_SECTION
100#define TARGET_ASM_NAMED_SECTION  default_elf_asm_named_section
101
102/* MIPS specific debugging info */
103#define MIPS_DEBUGGING_INFO 1
104