OSDN Git Service

* builtins.def: Fix comment formatting.
[pf3gnuchains/gcc-fork.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 /* TARGET_OS_CPP_BUILTINS() common to all NetBSD a.out targets.  */
23 #define NETBSD_OS_CPP_BUILTINS_AOUT()           \
24   do                                            \
25     {                                           \
26       NETBSD_OS_CPP_BUILTINS_COMMON();          \
27     }                                           \
28   while (0)
29
30 /* This defines which switch letters take arguments.  */
31
32 #undef SWITCH_TAKES_ARG
33 #define SWITCH_TAKES_ARG(CHAR)          \
34   (DEFAULT_SWITCH_TAKES_ARG(CHAR)       \
35    || (CHAR) == 'R')
36
37
38 /* Provide an ASM_SPEC appropriate for NetBSD.  Currently we only deal
39    with the options for generating PIC code.  */
40
41 #undef ASM_SPEC
42 #define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k -K}"
43
44
45 /* Provide a STARTFILE_SPEC appropriate for NetBSD a.out.  Here we
46    provide support for the special GCC option -static.  */
47
48 #undef STARTFILE_SPEC
49 #define STARTFILE_SPEC                  \
50   "%{!shared:                           \
51      %{pg:gcrt0%O%s}                    \
52      %{!pg:                             \
53        %{p:mcrt0%O%s}                   \
54        %{!p:                            \
55          %{!static:crt0%O%s}            \
56          %{static:scrt0%O%s}}}}"
57
58 /* Provide a LINK_SPEC appropriate for NetBSD a.out.  Here we provide
59    support for the special GCC options -static, -assert, and -nostdlib.  */
60
61 #undef NETBSD_LINK_SPEC_AOUT
62 #define NETBSD_LINK_SPEC_AOUT           \
63   "%{nostdlib:-nostdlib}                \
64    %{!shared:                           \
65      %{!nostdlib:                       \
66        %{!r*:                           \
67          %{!e*:-e start}}}              \
68      -dc -dp                            \
69      %{static:-Bstatic}}                \
70    %{shared:-Bshareable}                \
71    %{R*}                                \
72    %{assert*}"
73
74 /* Default LINK_SPEC.  */
75 #undef LINK_SPEC
76 #define LINK_SPEC NETBSD_LINK_SPEC_AOUT
77
78 /* Some imports from svr4.h in support of shared libraries.  */
79
80 /* Define the strings used for the .type, .size, and .set directives.
81    These strings generally do not vary from one system running NetBSD
82    to another, but if a given system needs to use different pseudo-op
83    names for these, they may be overridden in the file included after
84    this one.  */
85
86 #undef TYPE_ASM_OP
87 #undef SIZE_ASM_OP
88 #undef SET_ASM_OP                
89 #define TYPE_ASM_OP     "\t.type\t"
90 #define SIZE_ASM_OP     "\t.size\t"
91 #define SET_ASM_OP      "\t.set\t"
92
93
94 /* This is how we tell the assembler that a symbol is weak.  */
95
96 #undef ASM_WEAKEN_LABEL
97 #define ASM_WEAKEN_LABEL(FILE,NAME)                                     \
98   do                                                                    \
99     {                                                                   \
100       fputs ("\t.globl\t", FILE); assemble_name (FILE, NAME);           \
101       fputc ('\n', FILE);                                               \
102       fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME);            \
103       fputc ('\n', FILE);                                               \
104     }                                                                   \
105   while (0)
106
107
108 /* The following macro defines the format used to output the second
109    operand of the .type assembler directive.  Different svr4 assemblers
110    expect various different forms of this operand.  The one given here
111    is just a default.  You may need to override it in your machine-
112    specific tm.h file (depending on the particulars of your assembler).  */
113
114 #undef TYPE_OPERAND_FMT
115 #define TYPE_OPERAND_FMT        "@%s"
116
117
118 /* Write the extra assembler code needed to declare a function's result.
119    Most svr4 assemblers don't require any special declaration of the
120    result value, but there are exceptions.  */
121
122 #ifndef ASM_DECLARE_RESULT
123 #define ASM_DECLARE_RESULT(FILE, RESULT)
124 #endif
125
126
127 /* These macros generate the special .type and .size directives which
128    are used to set the corresponding fields of the linker symbol table
129    entries in an ELF object file under SVR4 (and a.out on NetBSD).
130    These macros also output the starting labels for the relevant
131    functions/objects.  */
132
133 /* Write the extra assembler code needed to declare a function properly.
134    Some svr4 assemblers need to also have something extra said about the
135    function's return value.  We allow for that here.  */
136
137 #undef ASM_DECLARE_FUNCTION_NAME
138 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)                     \
139   do                                                                    \
140     {                                                                   \
141       ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");               \
142       ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));                    \
143       ASM_OUTPUT_LABEL(FILE, NAME);                                     \
144     }                                                                   \
145   while (0)
146
147
148 /* Write the extra assembler code needed to declare an object properly.  */
149
150 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)               \
151   do                                                            \
152     {                                                           \
153       HOST_WIDE_INT size;                                       \
154                                                                 \
155       ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object");         \
156                                                                 \
157       size_directive_output = 0;                                \
158       if (!flag_inhibit_size_directive                          \
159           && (DECL) && DECL_SIZE (DECL))                        \
160         {                                                       \
161           size_directive_output = 1;                            \
162           size = int_size_in_bytes (TREE_TYPE (DECL));          \
163           ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size);         \
164         }                                                       \
165                                                                 \
166       ASM_OUTPUT_LABEL (FILE, NAME);                            \
167     }                                                           \
168   while (0)
169
170 /* Output the size directive for a decl in rest_of_decl_compilation
171    in the case where we did not do so before the initializer.
172    Once we find the error_mark_node, we know that the value of
173    size_directive_output was set
174    by ASM_DECLARE_OBJECT_NAME when it was run for the same decl.  */
175
176 #undef ASM_FINISH_DECLARE_OBJECT
177 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)        \
178   do                                                                    \
179     {                                                                   \
180       const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);           \
181       HOST_WIDE_INT size;                                               \
182       if (!flag_inhibit_size_directive && DECL_SIZE (DECL)              \
183           && ! AT_END && TOP_LEVEL                                      \
184           && DECL_INITIAL (DECL) == error_mark_node                     \
185           && !size_directive_output)                                    \
186         {                                                               \
187           size_directive_output = 1;                                    \
188           size = int_size_in_bytes (TREE_TYPE (DECL));                  \
189           ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size);                 \
190         }                                                               \
191     }                                                                   \
192   while (0)
193
194
195 /* This is how to declare the size of a function.  */
196
197 #undef ASM_DECLARE_FUNCTION_SIZE
198 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)                    \
199   do                                                                    \
200     {                                                                   \
201       if (!flag_inhibit_size_directive)                                 \
202         ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME);                         \
203     }                                                                   \
204   while (0)