]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/gcc/config/netbsd-aout.h
This commit was generated by cvs2svn to compensate for changes in r98008,
[FreeBSD/FreeBSD.git] / contrib / 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
50 /* Provide a LINK_SPEC appropriate for NetBSD a.out.  Here we provide
51    support for the special GCC options -static, -assert, and -nostdlib.  */
52
53 #undef LINK_SPEC
54 #define LINK_SPEC                       \
55   "%{nostdlib:-nostdlib}                \
56    %{!shared:                           \
57      %{!nostdlib:                       \
58        %{!r*:                           \
59          %{!e*:-e start}}}              \
60      -dc -dp                            \
61      %{static:-Bstatic}}                \
62    %{shared:-Bshareable}                \
63    %{R*}                                \
64    %{assert*}"
65
66
67 /* Some imports from svr4.h in support of shared libraries.  */
68
69 /* Define the strings used for the .type, .size, and .set directives.
70    These strings generally do not vary from one system running NetBSD
71    to another, but if a given system needs to use different pseudo-op
72    names for these, they may be overridden in the file included after
73    this one.  */
74
75 #undef TYPE_ASM_OP
76 #undef SIZE_ASM_OP
77 #undef SET_ASM_OP                
78 #define TYPE_ASM_OP     "\t.type\t"
79 #define SIZE_ASM_OP     "\t.size\t"
80 #define SET_ASM_OP      "\t.set\t"
81
82
83 /* This is how we tell the assembler that a symbol is weak.  */
84
85 #undef ASM_WEAKEN_LABEL
86 #define ASM_WEAKEN_LABEL(FILE,NAME)                                     \
87   do                                                                    \
88     {                                                                   \
89       fputs ("\t.globl\t", FILE); assemble_name (FILE, NAME);           \
90       fputc ('\n', FILE);                                               \
91       fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME);            \
92       fputc ('\n', FILE);                                               \
93     }                                                                   \
94   while (0)
95
96
97 /* The following macro defines the format used to output the second
98    operand of the .type assembler directive.  Different svr4 assemblers
99    expect various different forms of this operand.  The one given here
100    is just a default.  You may need to override it in your machine-
101    specific tm.h file (depending on the particulars of your assembler).  */
102
103 #undef TYPE_OPERAND_FMT
104 #define TYPE_OPERAND_FMT        "@%s"
105
106
107 /* Write the extra assembler code needed to declare a function's result.
108    Most svr4 assemblers don't require any special declaration of the
109    result value, but there are exceptions.  */
110
111 #ifndef ASM_DECLARE_RESULT
112 #define ASM_DECLARE_RESULT(FILE, RESULT)
113 #endif
114
115
116 /* These macros generate the special .type and .size directives which
117    are used to set the corresponding fields of the linker symbol table
118    entries in an ELF object file under SVR4 (and a.out on NetBSD).
119    These macros also output the starting labels for the relevant
120    functions/objects.  */
121
122 /* Write the extra assembler code needed to declare a function properly.
123    Some svr4 assemblers need to also have something extra said about the
124    function's return value.  We allow for that here.  */
125
126 #undef ASM_DECLARE_FUNCTION_NAME
127 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)                     \
128   do                                                                    \
129     {                                                                   \
130       fprintf (FILE, "%s", TYPE_ASM_OP);                                \
131       assemble_name (FILE, NAME);                                       \
132       putc (',', FILE);                                                 \
133       fprintf (FILE, TYPE_OPERAND_FMT, "function");                     \
134       putc ('\n', FILE);                                                \
135       ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));                    \
136       ASM_OUTPUT_LABEL(FILE, NAME);                                     \
137     }                                                                   \
138   while (0)
139
140
141 /* Write the extra assembler code needed to declare an object properly.  */
142
143 #undef ASM_DECLARE_OBJECT_NAME
144 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)                       \
145   do                                                                    \
146     {                                                                   \
147       fprintf (FILE, "%s", TYPE_ASM_OP);                                \
148       assemble_name (FILE, NAME);                                       \
149       putc (',', FILE);                                                 \
150       fprintf (FILE, TYPE_OPERAND_FMT, "object");                       \
151       putc ('\n', FILE);                                                \
152       size_directive_output = 0;                                        \
153       if (!flag_inhibit_size_directive && DECL_SIZE (DECL))             \
154         {                                                               \
155           size_directive_output = 1;                                    \
156           fprintf (FILE, "%s", SIZE_ASM_OP);                            \
157           assemble_name (FILE, NAME);                                   \
158           fprintf (FILE, ",%d\n",                                       \
159                    int_size_in_bytes (TREE_TYPE (DECL)));               \
160         }                                                               \
161       ASM_OUTPUT_LABEL(FILE, NAME);                                     \
162     }                                                                   \
163   while (0)
164
165
166 /* Output the size directive for a decl in rest_of_decl_compilation
167    in the case where we did not do so before the initializer.
168    Once we find the error_mark_node, we know that the value of
169    size_directive_output was set
170    by ASM_DECLARE_OBJECT_NAME when it was run for the same decl.  */
171
172 #undef ASM_FINISH_DECLARE_OBJECT
173 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)        \
174   do                                                                    \
175     {                                                                   \
176       const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);           \
177       if (!flag_inhibit_size_directive && DECL_SIZE (DECL)              \
178           && ! AT_END && TOP_LEVEL                                      \
179           && DECL_INITIAL (DECL) == error_mark_node                     \
180           && !size_directive_output)                                    \
181         {                                                               \
182           size_directive_output = 1;                                    \
183           fprintf (FILE, "%s", SIZE_ASM_OP);                            \
184           assemble_name (FILE, name);                                   \
185           fprintf (FILE, ",%d\n",                                       \
186                    int_size_in_bytes (TREE_TYPE (DECL)));               \
187         }                                                               \
188     }                                                                   \
189   while (0)
190
191
192 /* This is how to declare the size of a function.  */
193
194 #undef ASM_DECLARE_FUNCTION_SIZE
195 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)                    \
196   do                                                                    \
197     {                                                                   \
198       if (!flag_inhibit_size_directive)                                 \
199         {                                                               \
200           char label[256];                                              \
201           static int labelno;                                           \
202           labelno++;                                                    \
203           ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno);          \
204           ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno);             \
205           fprintf (FILE, "%s", SIZE_ASM_OP);                            \
206           assemble_name (FILE, (FNAME));                                \
207           fprintf (FILE, ",");                                          \
208           assemble_name (FILE, label);                                  \
209           fprintf (FILE, "-");                                          \
210           assemble_name (FILE, (FNAME));                                \
211           putc ('\n', FILE);                                            \
212         }                                                               \
213     }                                                                   \
214   while (0)