1 /* Configuration for a Mips ABI32 OpenBSD target.
2 Copyright (C) 1999 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* Definitions needed for OpenBSD, to avoid picking mips 'defaults'. */
23 /* GAS must know this. */
24 #define SUBTARGET_ASM_SPEC "%{fPIC:-KPIC} %|"
26 /* CPP specific OpenBSD specs. */
27 #define SUBTARGET_CPP_SPEC OBSD_CPP_SPEC
29 /* Needed for ELF (inspired by netbsd-elf). */
30 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
31 #define LOCAL_LABEL_PREFIX "."
33 /* The profiling lib spec here is not really correct but we leave
34 it as it is until we have some kind of profiling working. */
35 #define LIB_SPEC OBSD_LIB_SPEC
37 /* By default, OpenBSD mips is little endian. This is important to set
38 here as mips/mips.h defaults to big endian unless DECSTATION. */
39 #ifndef TARGET_ENDIAN_DEFAULT
40 #define TARGET_ENDIAN_DEFAULT 0
43 #include <mips/mips.h>
45 /* Get generic OpenBSD definitions. */
46 #define OBSD_HAS_DECLARE_FUNCTION_NAME
47 #define OBSD_HAS_DECLARE_OBJECT
48 #define OBSD_HAS_CORRECT_SPECS
51 /* mips assembler uses .set for arcane purposes. __attribute__((alias))
52 and friends won't work until we get recent binutils with .weakext
56 /* Run-time target specifications. */
57 #if TARGET_ENDIAN_DEFAULT != 0
58 #define CPP_PREDEFINES "-D__SYSTYPE_BSD__ -D__NO_LEADING_UNDERSCORES__ \
59 -D__GP_SUPPORT__ -D__MIPSEB__ -D__unix__ -D__OpenBSD__ -D__mips__ \
60 -Asystem=unix -Asystem=OpenBSD -Acpu=mips -Amachine=mips -Aendian=big"
62 #define CPP_PREDEFINES "-D__SYSTYPE_BSD__ -D__NO_LEADING_UNDERSCORES__ \
63 -D__GP_SUPPORT__ -D__MIPSEL__ -D__unix__ -D__OpenBSD__ -D__mips__ \
64 -Asystem=unix -Asystem=OpenBSD -Acpu=mips -Amachine=mips -Aendian=little"
67 /* Layout of source language data types. */
69 /* This must agree with <machine/ansi.h>. */
71 #define SIZE_TYPE "unsigned int"
74 #define PTRDIFF_TYPE "int"
77 #define WCHAR_TYPE "int"
79 #undef WCHAR_TYPE_SIZE
80 #define WCHAR_TYPE_SIZE 32
82 /* Controlling the compilation driver. */
84 /* LINK_SPEC appropriate for OpenBSD: support for GCC options
85 -static, -assert, and -nostdlib. Dynamic loader control. */
88 "%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
89 %{bestGnum} %{shared} %{non_shared} \
90 %{call_shared} %{no_archive} %{exact_version} \
91 %{!shared: %{!non_shared: %{!call_shared: -non_shared}}} \
92 %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so} \
93 %{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp \
94 %{static:-Bstatic} %{!static:-Bdynamic} %{assert*}"
96 /* -G is incompatible with -KPIC which is the default, so only allow objects
97 in the small data section if the user explicitly asks for it. */
98 #undef MIPS_DEFAULT_GVALUE
99 #define MIPS_DEFAULT_GVALUE 0
102 /* Since gas and gld are standard on OpenBSD, we don't need these. */
103 #undef ASM_FINAL_SPEC
104 #undef STARTFILE_SPEC
106 /* A C statement to output something to the assembler file to switch to
107 section NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL
108 or NULL_TREE. Some target formats do not support arbitrary sections.
109 Do not define this macro in such cases. mips.h doesn't define this,
111 #define ASM_OUTPUT_SECTION_NAME(F, DECL, NAME, RELOC) \
113 extern FILE *asm_out_text_file; \
114 if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
115 fprintf (asm_out_text_file, "\t.section %s,\"ax\",@progbits\n", (NAME)); \
116 else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \
117 fprintf (F, "\t.section %s,\"a\",@progbits\n", (NAME)); \
119 fprintf (F, "\t.section %s,\"aw\",@progbits\n", (NAME)); \
122 /* collect2 support (Macros for initialization). */
124 /* Mips default configuration is COFF-only, and confuses collect2. */
125 #undef OBJECT_FORMAT_COFF