Import final gcc2 snapshot (990109)
[official-gcc.git] / gcc / config / mips / netbsd.h
blob3fce9fb1de3f3766592a22bf7a0a6209e329413b
1 /* Definitions for DECstation running BSD as target machine for GNU compiler.
2 Copyright (C) 1993, 1995, 1996, 1997 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)
9 any later version.
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 #define DECSTATION
23 /* Look for the include files in the system-defined places. */
25 #ifndef CROSS_COMPILE
26 #undef GPLUSPLUS_INCLUDE_DIR
27 #define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++"
29 #undef GCC_INCLUDE_DIR
30 #define GCC_INCLUDE_DIR "/usr/include"
32 #undef INCLUDE_DEFAULTS
33 #define INCLUDE_DEFAULTS \
34 { \
35 { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \
36 { GCC_INCLUDE_DIR, "GCC", 0, 0 }, \
37 { 0, 0, 0, 0 } \
40 /* Under NetBSD, the normal location of the various *crt*.o files is the
41 /usr/lib directory. */
43 #undef STANDARD_STARTFILE_PREFIX
44 #define STANDARD_STARTFILE_PREFIX "/usr/lib/"
45 #endif
47 /* Provide a LINK_SPEC appropriate for NetBSD. Here we provide support
48 for the special GCC options -static, -assert, and -nostdlib. */
50 #undef LINK_SPEC
51 #define LINK_SPEC \
52 "%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
53 %{!nostartfiles:%{!r*:%{!e*:-e __start}}} -dc -dp %{static:-Bstatic} %{assert*}"
55 /* We have atexit(3). */
57 #define HAVE_ATEXIT
59 /* Implicit library calls should use memcpy, not bcopy, etc. */
61 #define TARGET_MEM_FUNCTIONS
63 /* Define mips-specific netbsd predefines... */
64 #ifndef CPP_PREDEFINES
65 #define CPP_PREDEFINES "-D__ANSI_COMPAT \
66 -DMIPSEL -DR3000 -DSYSTYPE_BSD -D_SYSTYPE_BSD -D__NetBSD__ -Dmips \
67 -D__NO_LEADING_UNDERSCORES__ -D__GP_SUPPORT__ \
68 -Dunix -D_R3000 \
69 -Asystem(unix) -Asystem(NetBSD) -Amachine(mips)"
70 #endif
72 #ifndef SUBTARGET_CPP_SPEC
73 #define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
74 #endif
76 #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
77 #define STARTFILE_SPEC ""
79 #ifndef MACHINE_TYPE
80 #define MACHINE_TYPE "NetBSD/pmax"
81 #endif
83 #define TARGET_DEFAULT MASK_GAS
84 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
86 #include "mips/mips.h"
89 * Some imports from svr4.h in support of shared libraries.
90 * Currently, we need the DECLARE_OBJECT_SIZE stuff.
93 /* Define the strings used for the special svr4 .type and .size directives.
94 These strings generally do not vary from one system running svr4 to
95 another, but if a given system (e.g. m88k running svr) needs to use
96 different pseudo-op names for these, they may be overridden in the
97 file which includes this one. */
99 #undef TYPE_ASM_OP
100 #undef SIZE_ASM_OP
101 #undef WEAK_ASM_OP
102 #define TYPE_ASM_OP ".type"
103 #define SIZE_ASM_OP ".size"
104 #define WEAK_ASM_OP ".weak"
106 /* The following macro defines the format used to output the second
107 operand of the .type assembler directive. Different svr4 assemblers
108 expect various different forms for this operand. The one given here
109 is just a default. You may need to override it in your machine-
110 specific tm.h file (depending upon the particulars of your assembler). */
112 #undef TYPE_OPERAND_FMT
113 #define TYPE_OPERAND_FMT "@%s"
115 /* Write the extra assembler code needed to declare a function's result.
116 Most svr4 assemblers don't require any special declaration of the
117 result value, but there are exceptions. */
119 #ifndef ASM_DECLARE_RESULT
120 #define ASM_DECLARE_RESULT(FILE, RESULT)
121 #endif
123 /* These macros generate the special .type and .size directives which
124 are used to set the corresponding fields of the linker symbol table
125 entries in an ELF object file under SVR4. These macros also output
126 the starting labels for the relevant functions/objects. */
128 /* Write the extra assembler code needed to declare a function properly.
129 Some svr4 assemblers need to also have something extra said about the
130 function's return value. We allow for that here. */
132 #undef ASM_DECLARE_FUNCTION_NAME
133 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
134 do { \
135 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
136 assemble_name (FILE, NAME); \
137 putc (',', FILE); \
138 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
139 putc ('\n', FILE); \
140 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
141 } while (0)
143 /* Write the extra assembler code needed to declare an object properly. */
145 #undef ASM_DECLARE_OBJECT_NAME
146 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
147 do { \
148 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
149 assemble_name (FILE, NAME); \
150 putc (',', FILE); \
151 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
152 putc ('\n', FILE); \
153 size_directive_output = 0; \
154 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
156 size_directive_output = 1; \
157 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
158 assemble_name (FILE, NAME); \
159 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
161 ASM_OUTPUT_LABEL(FILE, NAME); \
162 } while (0)
164 /* Output the size directive for a decl in rest_of_decl_compilation
165 in the case where we did not do so before the initializer.
166 Once we find the error_mark_node, we know that the value of
167 size_directive_output was set
168 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
170 #undef ASM_FINISH_DECLARE_OBJECT
171 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
172 do { \
173 char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
174 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
175 && ! AT_END && TOP_LEVEL \
176 && DECL_INITIAL (DECL) == error_mark_node \
177 && !size_directive_output) \
179 size_directive_output = 1; \
180 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
181 assemble_name (FILE, name); \
182 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
184 } while (0)
186 /* This is how to declare the size of a function. */
188 #undef ASM_DECLARE_FUNCTION_SIZE
189 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
190 do { \
191 if (!flag_inhibit_size_directive) \
193 char label[256]; \
194 static int labelno; \
195 labelno++; \
196 ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
197 ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
198 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
199 assemble_name (FILE, (FNAME)); \
200 fprintf (FILE, ","); \
201 assemble_name (FILE, label); \
202 fprintf (FILE, "-"); \
203 assemble_name (FILE, (FNAME)); \
204 putc ('\n', FILE); \
206 } while (0)
209 A C statement to output something to the assembler file to switch to section
210 NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
211 NULL_TREE. Some target formats do not support arbitrary sections. Do not
212 define this macro in such cases.
214 #define ASM_OUTPUT_SECTION_NAME(F, DECL, NAME, RELOC) \
215 do { \
216 extern FILE *asm_out_text_file; \
217 if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
218 fprintf (asm_out_text_file, "\t.section %s,\"ax\",@progbits\n", (NAME)); \
219 else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \
220 fprintf (F, "\t.section %s,\"a\",@progbits\n", (NAME)); \
221 else \
222 fprintf (F, "\t.section %s,\"aw\",@progbits\n", (NAME)); \
223 } while (0)
225 /* Since gas and gld are standard on NetBSD, we don't need these */
226 #undef ASM_FINAL_SPEC
227 #undef STARTFILE_SPEC