1 /* Common configuration file for NetBSD a.out targets.
2 Copyright (C) 2002 Free Software Foundation, Inc.
3 Contributed by Wasabi Systems, Inc.
5 This file is part of GNU CC.
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)
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.
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. */
22 /* This defines which switch letters take arguments. */
24 #undef SWITCH_TAKES_ARG
25 #define SWITCH_TAKES_ARG(CHAR) \
26 (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
30 /* Provide an ASM_SPEC appropriate for NetBSD. Currently we only deal
31 with the options for generating PIC code. */
34 #define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k -K}"
37 /* Provide a STARTFILE_SPEC appropriate for NetBSD a.out. Here we
38 provide support for the special GCC option -static. */
41 #define STARTFILE_SPEC \
48 %{static:scrt0%O%s}}}} \
51 /* Provide a LINK_SPEC appropriate for NetBSD a.out. Here we provide
52 support for the special GCC options -static, -assert, and -nostdlib. */
56 "%{nostdlib:-nostdlib} \
63 %{shared:-Bshareable} \
68 /* Some imports from svr4.h in support of shared libraries. */
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
79 #define TYPE_ASM_OP "\t.type\t"
80 #define SIZE_ASM_OP "\t.size\t"
81 #define SET_ASM_OP "\t.set\t"
84 /* This is how we tell the assembler that a symbol is weak. */
86 #undef ASM_WEAKEN_LABEL
87 #define ASM_WEAKEN_LABEL(FILE,NAME) \
90 fputs ("\t.globl\t", FILE); assemble_name (FILE, NAME); \
92 fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
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). */
104 #undef TYPE_OPERAND_FMT
105 #define TYPE_OPERAND_FMT "@%s"
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. */
112 #ifndef ASM_DECLARE_RESULT
113 #define ASM_DECLARE_RESULT(FILE, RESULT)
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. */
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. */
127 #undef ASM_DECLARE_FUNCTION_NAME
128 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
131 fprintf (FILE, "%s", TYPE_ASM_OP); \
132 assemble_name (FILE, NAME); \
134 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
136 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
137 ASM_OUTPUT_LABEL(FILE, NAME); \
142 /* Write the extra assembler code needed to declare an object properly. */
144 #undef ASM_DECLARE_OBJECT_NAME
145 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
148 fprintf (FILE, "%s", TYPE_ASM_OP); \
149 assemble_name (FILE, NAME); \
151 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
153 size_directive_output = 0; \
154 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
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))); \
162 ASM_OUTPUT_LABEL(FILE, NAME); \
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. */
173 #undef ASM_FINISH_DECLARE_OBJECT
174 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
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) \
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))); \
193 /* This is how to declare the size of a function. */
195 #undef ASM_DECLARE_FUNCTION_SIZE
196 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
199 if (!flag_inhibit_size_directive) \
202 static int 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)); \