* glimits.h (__LONG_MAX__): Recognize __sparcv9 too.
[official-gcc.git] / gcc / config / netbsd.h
blob0fb4d400ee27e9fb7c80cfe94d292503e2e40630
1 /* NETBSD_NATIVE is defined when gcc is integrated into the NetBSD
2 source tree so it can be configured appropriately without using
3 the GNU configure/build mechanism. */
5 #ifdef NETBSD_NATIVE
7 /* Look for the include files in the system-defined places. */
9 #undef GPLUSPLUS_INCLUDE_DIR
10 #define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++"
12 #undef GCC_INCLUDE_DIR
13 #define GCC_INCLUDE_DIR "/usr/include"
15 #undef INCLUDE_DEFAULTS
16 #define INCLUDE_DEFAULTS \
17 { \
18 { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \
19 { GCC_INCLUDE_DIR, "GCC", 0, 0 }, \
20 { 0, 0, 0, 0 } \
23 /* Under NetBSD, the normal location of the compiler back ends is the
24 /usr/libexec directory. */
26 #undef STANDARD_EXEC_PREFIX
27 #define STANDARD_EXEC_PREFIX "/usr/libexec/"
29 /* Under NetBSD, the normal location of the various *crt*.o files is the
30 /usr/lib directory. */
32 #undef STANDARD_STARTFILE_PREFIX
33 #define STANDARD_STARTFILE_PREFIX "/usr/lib/"
35 #endif
38 /* Provide a CPP_SPEC appropriate for NetBSD. Current we just deal with
39 the GCC option `-posix'. */
41 #undef CPP_SPEC
42 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
44 /* Provide an ASM_SPEC appropriate for NetBSD. Currently we only deal
45 with the options for generating PIC code. */
47 #undef ASM_SPEC
48 #define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k -K}"
50 /* Provide a LIB_SPEC appropriate for NetBSD. Just select the appropriate
51 libc, depending on whether we're doing profiling. */
53 #undef LIB_SPEC
54 #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
56 /* Provide a LINK_SPEC appropriate for NetBSD. Here we provide support
57 for the special GCC options -static, -assert, and -nostdlib. */
59 #undef LINK_SPEC
60 #define LINK_SPEC \
61 "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{R*} %{static:-Bstatic} %{assert*}"
63 /* This defines which switch letters take arguments. */
64 #undef SWITCH_TAKES_ARG
65 #define SWITCH_TAKES_ARG(CHAR) \
66 (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
67 || (CHAR) == 'R')
69 /* We have atexit(3). */
71 #define HAVE_ATEXIT
73 /* Implicit library calls should use memcpy, not bcopy, etc. */
75 #define TARGET_MEM_FUNCTIONS
77 /* Handle #pragma weak and #pragma pack. */
79 #define HANDLE_SYSV_PRAGMA
82 * Some imports from svr4.h in support of shared libraries.
83 * Currently, we need the DECLARE_OBJECT_SIZE stuff.
86 /* Define the strings used for the .type, .size, and .set directives.
87 These strings generally do not vary from one system running netbsd
88 to another, but if a given system needs to use different pseudo-op
89 names for these, they may be overridden in the file which includes
90 this one. */
92 #undef TYPE_ASM_OP
93 #undef SIZE_ASM_OP
94 #undef SET_ASM_OP
95 #define TYPE_ASM_OP ".type"
96 #define SIZE_ASM_OP ".size"
97 #define SET_ASM_OP ".set"
99 /* This is how we tell the assembler that a symbol is weak. */
101 #undef ASM_WEAKEN_LABEL
102 #define ASM_WEAKEN_LABEL(FILE,NAME) \
103 do { fputs ("\t.globl\t", FILE); assemble_name (FILE, NAME); \
104 fputc ('\n', FILE); \
105 fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
106 fputc ('\n', FILE); } while (0)
108 /* The following macro defines the format used to output the second
109 operand of the .type assembler directive. Different svr4 assemblers
110 expect various different forms for this operand. The one given here
111 is just a default. You may need to override it in your machine-
112 specific tm.h file (depending upon the particulars of your assembler). */
114 #undef TYPE_OPERAND_FMT
115 #define TYPE_OPERAND_FMT "@%s"
117 /* Write the extra assembler code needed to declare a function's result.
118 Most svr4 assemblers don't require any special declaration of the
119 result value, but there are exceptions. */
121 #ifndef ASM_DECLARE_RESULT
122 #define ASM_DECLARE_RESULT(FILE, RESULT)
123 #endif
125 /* These macros generate the special .type and .size directives which
126 are used to set the corresponding fields of the linker symbol table
127 entries in an ELF object file under SVR4. These macros also output
128 the starting labels for the relevant functions/objects. */
130 /* Write the extra assembler code needed to declare a function properly.
131 Some svr4 assemblers need to also have something extra said about the
132 function's return value. We allow for that here. */
134 #undef ASM_DECLARE_FUNCTION_NAME
135 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
136 do { \
137 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
138 assemble_name (FILE, NAME); \
139 putc (',', FILE); \
140 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
141 putc ('\n', FILE); \
142 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
143 ASM_OUTPUT_LABEL(FILE, NAME); \
144 } while (0)
146 /* Write the extra assembler code needed to declare an object properly. */
148 #undef ASM_DECLARE_OBJECT_NAME
149 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
150 do { \
151 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
152 assemble_name (FILE, NAME); \
153 putc (',', FILE); \
154 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
155 putc ('\n', FILE); \
156 size_directive_output = 0; \
157 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
159 size_directive_output = 1; \
160 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
161 assemble_name (FILE, NAME); \
162 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
164 ASM_OUTPUT_LABEL(FILE, NAME); \
165 } while (0)
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) \
175 do { \
176 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, "\t%s\t ", SIZE_ASM_OP); \
184 assemble_name (FILE, name); \
185 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
187 } while (0)
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) \
193 do { \
194 if (!flag_inhibit_size_directive) \
196 char label[256]; \
197 static int labelno; \
198 labelno++; \
199 ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
200 ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
201 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
202 assemble_name (FILE, (FNAME)); \
203 fprintf (FILE, ","); \
204 assemble_name (FILE, label); \
205 fprintf (FILE, "-"); \
206 assemble_name (FILE, (FNAME)); \
207 putc ('\n', FILE); \
209 } while (0)