OSDN Git Service

2001-07-30 H.J. Lu (hjl@gnu.org)
[pf3gnuchains/gcc-fork.git] / gcc / config / mips / openbsd.h
1 /* Configuration for  a Mips ABI32 OpenBSD target.
2    Copyright (C) 1999 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
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)
9 any later version.
10
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.
15
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.  */
20
21 /* Definitions needed for OpenBSD, to avoid picking mips 'defaults'.  */
22
23 /* GAS must know this.  */
24 #define SUBTARGET_ASM_SPEC "%{fPIC:-KPIC} %|"
25
26 /* CPP specific OpenBSD specs.  */
27 #define SUBTARGET_CPP_SPEC OBSD_CPP_SPEC
28
29 /* Needed for ELF (inspired by netbsd-elf).  */
30 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
31 #define LOCAL_LABEL_PREFIX      "."
32
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
36
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
41 #endif
42
43 #include <mips/mips.h>
44
45 /* Get generic OpenBSD definitions.  */
46 #define OBSD_HAS_DECLARE_FUNCTION_NAME
47 #define OBSD_HAS_DECLARE_OBJECT
48 #define OBSD_HAS_CORRECT_SPECS
49 #include <openbsd.h>
50
51 /* mips assembler uses .set for arcane purposes.  __attribute__((alias))
52    and friends won't work until we get recent binutils with .weakext
53         support.  */
54 #undef SET_ASM_OP
55
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"
61 #else
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"
65 #endif
66
67 /* Layout of source language data types.  */
68
69 /* This must agree with <machine/ansi.h>.  */
70 #undef SIZE_TYPE
71 #define SIZE_TYPE "unsigned int"
72
73 #undef PTRDIFF_TYPE
74 #define PTRDIFF_TYPE "int"
75
76 #undef WCHAR_TYPE
77 #define WCHAR_TYPE "int"
78
79 #undef WCHAR_TYPE_SIZE
80 #define WCHAR_TYPE_SIZE 32
81
82 /* Controlling the compilation driver.  */
83
84 /* LINK_SPEC appropriate for OpenBSD:  support for GCC options 
85    -static, -assert, and -nostdlib. Dynamic loader control.  */
86 #undef LINK_SPEC
87 #define LINK_SPEC \
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*}"
95
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
100
101
102 /* Since gas and gld are standard on OpenBSD, we don't need these.  */
103 #undef ASM_FINAL_SPEC
104 #undef STARTFILE_SPEC
105
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, 
110    do it here.  */
111 #define ASM_OUTPUT_SECTION_NAME(F, DECL, NAME, RELOC)                        \
112 do {                                                                         \
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));                  \
118   else if (! strcmp (NAME, ".bss"))                                          \
119     fprintf (F, "\t.section %s,\"aw\",@nobits\n", (NAME));                   \
120   else                                                                       \
121     fprintf (F, "\t.section %s,\"aw\",@progbits\n", (NAME));                 \
122 } while (0)
123
124 /* collect2 support (Macros for initialization).  */
125
126 /* Mips default configuration is COFF-only, and confuses collect2.  */
127 #undef OBJECT_FORMAT_COFF
128 #undef EXTENDED_COFF