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.
5 This file is part of GCC.
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)
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.
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/>. */
21 /* TARGET_OS_CPP_BUILTINS() common to all NetBSD a.out targets. */
22 #define NETBSD_OS_CPP_BUILTINS_AOUT() \
25 NETBSD_OS_CPP_BUILTINS_COMMON(); \
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|fpie:-k} %{fPIC|fPIE:-k -K}"
36 #define AS_NEEDS_DASH_FOR_PIPED_INPUT
39 /* Provide a STARTFILE_SPEC appropriate for NetBSD a.out. Here we
40 provide support for the special GCC option -static. */
43 #define STARTFILE_SPEC \
50 %{static:scrt0%O%s}}}}"
52 /* Provide a LINK_SPEC appropriate for NetBSD a.out. Here we provide
53 support for the special GCC options -static, -assert, and -nostdlib. */
55 #undef NETBSD_LINK_SPEC_AOUT
56 #define NETBSD_LINK_SPEC_AOUT \
57 "%{nostdlib:-nostdlib} \
64 %{shared:-Bshareable} \
68 /* Default LINK_SPEC. */
70 #define LINK_SPEC NETBSD_LINK_SPEC_AOUT
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
81 #define TYPE_ASM_OP "\t.type\t"
82 #define SIZE_ASM_OP "\t.size\t"
83 #define SET_ASM_OP "\t.set\t"
86 /* This is how we tell the assembler that a symbol is weak. */
88 #undef ASM_WEAKEN_LABEL
89 #define ASM_WEAKEN_LABEL(FILE,NAME) \
92 fputs ("\t.globl\t", FILE); assemble_name (FILE, NAME); \
94 fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
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). */
106 #undef TYPE_OPERAND_FMT
107 #define TYPE_OPERAND_FMT "@%s"
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. */
114 #ifndef ASM_DECLARE_RESULT
115 #define ASM_DECLARE_RESULT(FILE, RESULT)
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. */
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. */
129 #undef ASM_DECLARE_FUNCTION_NAME
130 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
133 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
134 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
135 ASM_OUTPUT_FUNCTION_LABEL (FILE, NAME, DECL); \
140 /* Write the extra assembler code needed to declare an object properly. */
142 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
145 HOST_WIDE_INT size; \
147 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
149 size_directive_output = 0; \
150 if (!flag_inhibit_size_directive \
151 && (DECL) && DECL_SIZE (DECL)) \
153 size_directive_output = 1; \
154 size = int_size_in_bytes (TREE_TYPE (DECL)); \
155 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
158 ASM_OUTPUT_LABEL (FILE, NAME); \
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. */
168 #undef ASM_FINISH_DECLARE_OBJECT
169 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
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) \
179 size_directive_output = 1; \
180 size = int_size_in_bytes (TREE_TYPE (DECL)); \
181 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
187 /* This is how to declare the size of a function. */
189 #undef ASM_DECLARE_FUNCTION_SIZE
190 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
193 if (!flag_inhibit_size_directive) \
194 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \