OSDN Git Service

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