netbsd-aout.h (SWITCH_TAKES_ARG): Remove bogus white space after backslash.
[gcc.git] / gcc / config / netbsd-aout.h
1 /* Common configuration file for NetBSD a.out targets.
2 Copyright (C) 2002 Free Software Foundation, Inc.
3 Contributed by Wasabi Systems, Inc.
4
5 This file is part of GNU CC.
6
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22 /* This defines which switch letters take arguments. */
23
24 #undef SWITCH_TAKES_ARG
25 #define SWITCH_TAKES_ARG(CHAR) \
26 (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
27 || (CHAR) == 'R')
28
29
30 /* Provide an ASM_SPEC appropriate for NetBSD. Currently we only deal
31 with the options for generating PIC code. */
32
33 #undef ASM_SPEC
34 #define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k -K}"
35
36
37 /* Provide a STARTFILE_SPEC appropriate for NetBSD a.out. Here we
38 provide support for the special GCC option -static. */
39
40 #undef STARTFILE_SPEC
41 #define STARTFILE_SPEC \
42 "%{!shared: \
43 %{pg:gcrt0%O%s} \
44 %{!pg: \
45 %{p:mcrt0%O%s} \
46 %{!p: \
47 %{!static:crt0%O%s} \
48 %{static:scrt0%O%s}}}} \
49 %{shared:c++rt0%O%s}"
50
51 /* Provide a LINK_SPEC appropriate for NetBSD a.out. Here we provide
52 support for the special GCC options -static, -assert, and -nostdlib. */
53
54 #undef LINK_SPEC
55 #define LINK_SPEC \
56 "%{nostdlib:-nostdlib} \
57 %{!shared: \
58 %{!nostdlib: \
59 %{!r*: \
60 %{!e*:-e start}}} \
61 -dc -dp \
62 %{static:-Bstatic}} \
63 %{shared:-Bshareable} \
64 %{R*} \
65 %{assert*}"
66
67
68 /* Some imports from svr4.h in support of shared libraries. */
69
70 /* Define the strings used for the .type, .size, and .set directives.
71 These strings generally do not vary from one system running NetBSD
72 to another, but if a given system needs to use different pseudo-op
73 names for these, they may be overridden in the file included after
74 this one. */
75
76 #undef TYPE_ASM_OP
77 #undef SIZE_ASM_OP
78 #undef SET_ASM_OP
79 #define TYPE_ASM_OP "\t.type\t"
80 #define SIZE_ASM_OP "\t.size\t"
81 #define SET_ASM_OP "\t.set\t"
82
83
84 /* This is how we tell the assembler that a symbol is weak. */
85
86 #undef ASM_WEAKEN_LABEL
87 #define ASM_WEAKEN_LABEL(FILE,NAME) \
88 do \
89 { \
90 fputs ("\t.globl\t", FILE); assemble_name (FILE, NAME); \
91 fputc ('\n', FILE); \
92 fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
93 fputc ('\n', FILE); \
94 } \
95 while (0)
96
97
98 /* The following macro defines the format used to output the second
99 operand of the .type assembler directive. Different svr4 assemblers
100 expect various different forms of this operand. The one given here
101 is just a default. You may need to override it in your machine-
102 specific tm.h file (depending on the particulars of your assembler). */
103
104 #undef TYPE_OPERAND_FMT
105 #define TYPE_OPERAND_FMT "@%s"
106
107
108 /* Write the extra assembler code needed to declare a function's result.
109 Most svr4 assemblers don't require any special declaration of the
110 result value, but there are exceptions. */
111
112 #ifndef ASM_DECLARE_RESULT
113 #define ASM_DECLARE_RESULT(FILE, RESULT)
114 #endif
115
116
117 /* These macros generate the special .type and .size directives which
118 are used to set the corresponding fields of the linker symbol table
119 entries in an ELF object file under SVR4 (and a.out on NetBSD).
120 These macros also output the starting labels for the relevant
121 functions/objects. */
122
123 /* Write the extra assembler code needed to declare a function properly.
124 Some svr4 assemblers need to also have something extra said about the
125 function's return value. We allow for that here. */
126
127 #undef ASM_DECLARE_FUNCTION_NAME
128 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
129 do \
130 { \
131 fprintf (FILE, "%s", TYPE_ASM_OP); \
132 assemble_name (FILE, NAME); \
133 putc (',', FILE); \
134 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
135 putc ('\n', FILE); \
136 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
137 ASM_OUTPUT_LABEL(FILE, NAME); \
138 } \
139 while (0)
140
141
142 /* Write the extra assembler code needed to declare an object properly. */
143
144 #undef ASM_DECLARE_OBJECT_NAME
145 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
146 do \
147 { \
148 fprintf (FILE, "%s", 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)) \
155 { \
156 size_directive_output = 1; \
157 fprintf (FILE, "%s", SIZE_ASM_OP); \
158 assemble_name (FILE, NAME); \
159 fprintf (FILE, ",%d\n", \
160 int_size_in_bytes (TREE_TYPE (DECL))); \
161 } \
162 ASM_OUTPUT_LABEL(FILE, NAME); \
163 } \
164 while (0)
165
166
167 /* Output the size directive for a decl in rest_of_decl_compilation
168 in the case where we did not do so before the initializer.
169 Once we find the error_mark_node, we know that the value of
170 size_directive_output was set
171 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
172
173 #undef ASM_FINISH_DECLARE_OBJECT
174 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
175 do \
176 { \
177 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
178 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
179 && ! AT_END && TOP_LEVEL \
180 && DECL_INITIAL (DECL) == error_mark_node \
181 && !size_directive_output) \
182 { \
183 size_directive_output = 1; \
184 fprintf (FILE, "%s", SIZE_ASM_OP); \
185 assemble_name (FILE, name); \
186 fprintf (FILE, ",%d\n", \
187 int_size_in_bytes (TREE_TYPE (DECL))); \
188 } \
189 } \
190 while (0)
191
192
193 /* This is how to declare the size of a function. */
194
195 #undef ASM_DECLARE_FUNCTION_SIZE
196 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
197 do \
198 { \
199 if (!flag_inhibit_size_directive) \
200 { \
201 char label[256]; \
202 static int labelno; \
203 labelno++; \
204 ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
205 ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
206 fprintf (FILE, "%s", SIZE_ASM_OP); \
207 assemble_name (FILE, (FNAME)); \
208 fprintf (FILE, ","); \
209 assemble_name (FILE, label); \
210 fprintf (FILE, "-"); \
211 assemble_name (FILE, (FNAME)); \
212 putc ('\n', FILE); \
213 } \
214 } \
215 while (0)