]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/netbsd.h
Initial revision
[thirdparty/gcc.git] / gcc / config / netbsd.h
1 /* Look for the include files in the system-defined places. */
2
3 #undef GPLUSPLUS_INCLUDE_DIR
4 #define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++"
5
6 #undef GCC_INCLUDE_DIR
7 #define GCC_INCLUDE_DIR "/usr/include"
8
9 #undef INCLUDE_DEFAULTS
10 #define INCLUDE_DEFAULTS \
11 { \
12 { GPLUSPLUS_INCLUDE_DIR, 1, 1 }, \
13 { GCC_INCLUDE_DIR, 0, 0 }, \
14 { 0, 0, 0 } \
15 }
16
17
18 /* Under NetBSD, the normal location of the `ld' and `as' programs is the
19 /usr/bin directory. */
20
21 #undef MD_EXEC_PREFIX
22 #define MD_EXEC_PREFIX "/usr/bin/"
23
24 /* Under NetBSD, the normal location of the various *crt*.o files is the
25 /usr/lib directory. */
26
27 #undef MD_STARTFILE_PREFIX
28 #define MD_STARTFILE_PREFIX "/usr/lib/"
29
30
31 /* Provide a CPP_SPEC appropriate for NetBSD. Current we just deal with
32 the GCC option `-posix'. */
33
34 #undef CPP_SPEC
35 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
36
37 /* Provide an ASM_SPEC appropriate for NetBSD. Currently we only deal
38 with the options for generating PIC code. */
39
40 #undef ASM_SPEC
41 #define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k -K}"
42
43 /* Provide a LIB_SPEC appropriate for NetBSD. Just select the appropriate
44 libc, depending on whether we're doing profiling. */
45
46 #undef LIB_SPEC
47 #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
48
49 /* Provide a LINK_SPEC appropriate for NetBSD. Here we provide support
50 for the special GCC options -static, -assert, and -nostdlib. */
51
52 #undef LINK_SPEC
53 #define LINK_SPEC \
54 "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*}"
55
56
57 /* We have atexit(3). */
58
59 #define HAVE_ATEXIT
60
61 /* Implicit library calls should use memcpy, not bcopy, etc. */
62
63 #define TARGET_MEM_FUNCTIONS
64 \f
65 /*
66 * Some imports from svr4.h in support of shared libraries.
67 * Currently, we need the DECLARE_OBJECT_SIZE stuff.
68 */
69
70 /* Define the strings used for the special svr4 .type and .size directives.
71 These strings generally do not vary from one system running svr4 to
72 another, but if a given system (e.g. m88k running svr) needs to use
73 different pseudo-op names for these, they may be overridden in the
74 file which includes this one. */
75
76 #define TYPE_ASM_OP ".type"
77 #define SIZE_ASM_OP ".size"
78 #define WEAK_ASM_OP ".weak"
79
80 /* The following macro defines the format used to output the second
81 operand of the .type assembler directive. Different svr4 assemblers
82 expect various different forms for this operand. The one given here
83 is just a default. You may need to override it in your machine-
84 specific tm.h file (depending upon the particulars of your assembler). */
85
86 #define TYPE_OPERAND_FMT "@%s"
87
88 /* Write the extra assembler code needed to declare a function's result.
89 Most svr4 assemblers don't require any special declaration of the
90 result value, but there are exceptions. */
91
92 #ifndef ASM_DECLARE_RESULT
93 #define ASM_DECLARE_RESULT(FILE, RESULT)
94 #endif
95
96 /* These macros generate the special .type and .size directives which
97 are used to set the corresponding fields of the linker symbol table
98 entries in an ELF object file under SVR4. These macros also output
99 the starting labels for the relevant functions/objects. */
100
101 /* Write the extra assembler code needed to declare a function properly.
102 Some svr4 assemblers need to also have something extra said about the
103 function's return value. We allow for that here. */
104
105 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
106 do { \
107 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
108 assemble_name (FILE, NAME); \
109 putc (',', FILE); \
110 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
111 putc ('\n', FILE); \
112 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
113 ASM_OUTPUT_LABEL(FILE, NAME); \
114 } while (0)
115
116 /* Write the extra assembler code needed to declare an object properly. */
117
118 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
119 do { \
120 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
121 assemble_name (FILE, NAME); \
122 putc (',', FILE); \
123 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
124 putc ('\n', FILE); \
125 size_directive_output = 0; \
126 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
127 { \
128 size_directive_output = 1; \
129 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
130 assemble_name (FILE, NAME); \
131 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
132 } \
133 ASM_OUTPUT_LABEL(FILE, NAME); \
134 } while (0)
135
136 /* Output the size directive for a decl in rest_of_decl_compilation
137 in the case where we did not do so before the initializer.
138 Once we find the error_mark_node, we know that the value of
139 size_directive_output was set
140 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
141
142 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
143 do { \
144 char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
145 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
146 && ! AT_END && TOP_LEVEL \
147 && DECL_INITIAL (DECL) == error_mark_node \
148 && !size_directive_output) \
149 { \
150 size_directive_output = 1; \
151 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
152 assemble_name (FILE, name); \
153 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
154 } \
155 } while (0)
156
157 /* This is how to declare the size of a function. */
158
159 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
160 do { \
161 if (!flag_inhibit_size_directive) \
162 { \
163 char label[256]; \
164 static int labelno; \
165 labelno++; \
166 ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
167 ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
168 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
169 assemble_name (FILE, (FNAME)); \
170 fprintf (FILE, ","); \
171 assemble_name (FILE, label); \
172 fprintf (FILE, "-"); \
173 assemble_name (FILE, (FNAME)); \
174 putc ('\n', FILE); \
175 } \
176 } while (0)