OSDN Git Service

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