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}}}}"
50 /* Provide a LINK_SPEC appropriate for NetBSD a.out. Here we provide
51 support for the special GCC options -static, -assert, and -nostdlib. */
55 "%{nostdlib:-nostdlib} \
62 %{shared:-Bshareable} \
67 /* Some imports from svr4.h in support of shared libraries. */
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
78 #define TYPE_ASM_OP "\t.type\t"
79 #define SIZE_ASM_OP "\t.size\t"
80 #define SET_ASM_OP "\t.set\t"
83 /* This is how we tell the assembler that a symbol is weak. */
85 #undef ASM_WEAKEN_LABEL
86 #define ASM_WEAKEN_LABEL(FILE,NAME) \
89 fputs ("\t.globl\t", FILE); assemble_name (FILE, NAME); \
91 fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
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). */
103 #undef TYPE_OPERAND_FMT
104 #define TYPE_OPERAND_FMT "@%s"
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. */
111 #ifndef ASM_DECLARE_RESULT
112 #define ASM_DECLARE_RESULT(FILE, RESULT)
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. */
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. */
126 #undef ASM_DECLARE_FUNCTION_NAME
127 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
130 fprintf (FILE, "%s", TYPE_ASM_OP); \
131 assemble_name (FILE, NAME); \
133 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
135 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
136 ASM_OUTPUT_LABEL(FILE, NAME); \
141 /* Write the extra assembler code needed to declare an object properly. */
143 #undef ASM_DECLARE_OBJECT_NAME
144 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
147 fprintf (FILE, "%s", TYPE_ASM_OP); \
148 assemble_name (FILE, NAME); \
150 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
152 size_directive_output = 0; \
153 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
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))); \
161 ASM_OUTPUT_LABEL(FILE, NAME); \
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. */
172 #undef ASM_FINISH_DECLARE_OBJECT
173 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
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) \
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))); \
192 /* This is how to declare the size of a function. */
194 #undef ASM_DECLARE_FUNCTION_SIZE
195 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
198 if (!flag_inhibit_size_directive) \
201 static int 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)); \