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 /* Some imports from svr4.h in support of shared libraries. */
74 /* Define the strings used for the .type, .size, and .set directives.
75 These strings generally do not vary from one system running NetBSD
76 to another, but if a given system needs to use different pseudo-op
77 names for these, they may be overridden in the file included after
83 #define TYPE_ASM_OP "\t.type\t"
84 #define SIZE_ASM_OP "\t.size\t"
85 #define SET_ASM_OP "\t.set\t"
88 /* This is how we tell the assembler that a symbol is weak. */
90 #undef ASM_WEAKEN_LABEL
91 #define ASM_WEAKEN_LABEL(FILE,NAME) \
94 fputs ("\t.globl\t", FILE); assemble_name (FILE, NAME); \
96 fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
102 /* The following macro defines the format used to output the second
103 operand of the .type assembler directive. Different svr4 assemblers
104 expect various different forms of this operand. The one given here
105 is just a default. You may need to override it in your machine-
106 specific tm.h file (depending on the particulars of your assembler). */
108 #undef TYPE_OPERAND_FMT
109 #define TYPE_OPERAND_FMT "@%s"
112 /* Write the extra assembler code needed to declare a function's result.
113 Most svr4 assemblers don't require any special declaration of the
114 result value, but there are exceptions. */
116 #ifndef ASM_DECLARE_RESULT
117 #define ASM_DECLARE_RESULT(FILE, RESULT)
121 /* These macros generate the special .type and .size directives which
122 are used to set the corresponding fields of the linker symbol table
123 entries in an ELF object file under SVR4 (and a.out on NetBSD).
124 These macros also output the starting labels for the relevant
125 functions/objects. */
127 /* Write the extra assembler code needed to declare a function properly.
128 Some svr4 assemblers need to also have something extra said about the
129 function's return value. We allow for that here. */
131 #undef ASM_DECLARE_FUNCTION_NAME
132 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
135 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
136 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
137 ASM_OUTPUT_FUNCTION_LABEL (FILE, NAME, DECL); \
142 /* Write the extra assembler code needed to declare an object properly. */
144 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
147 HOST_WIDE_INT size; \
149 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
151 size_directive_output = 0; \
152 if (!flag_inhibit_size_directive \
153 && (DECL) && DECL_SIZE (DECL)) \
155 size_directive_output = 1; \
156 size = int_size_in_bytes (TREE_TYPE (DECL)); \
157 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
160 ASM_OUTPUT_LABEL (FILE, NAME); \
164 /* Output the size directive for a decl in rest_of_decl_compilation
165 in the case where we did not do so before the initializer.
166 Once we find the error_mark_node, we know that the value of
167 size_directive_output was set
168 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
170 #undef ASM_FINISH_DECLARE_OBJECT
171 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
174 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
175 HOST_WIDE_INT size; \
176 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
177 && ! AT_END && TOP_LEVEL \
178 && DECL_INITIAL (DECL) == error_mark_node \
179 && !size_directive_output) \
181 size_directive_output = 1; \
182 size = int_size_in_bytes (TREE_TYPE (DECL)); \
183 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
189 /* This is how to declare the size of a function. */
191 #undef ASM_DECLARE_FUNCTION_SIZE
192 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
195 if (!flag_inhibit_size_directive) \
196 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \