OSDN Git Service

Undo patch of May 24. Don't pass "-e start" if -nostdlib again.
[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 #define TYPE_ASM_OP     ".type"
86 #define SIZE_ASM_OP     ".size"
87
88 /* This is how we tell the assembler that a symbol is weak.  */
89
90 #undef ASM_WEAKEN_LABEL
91 #define ASM_WEAKEN_LABEL(FILE,NAME) \
92   do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
93        fputc ('\n', FILE); } while (0)
94
95 /* The following macro defines the format used to output the second
96    operand of the .type assembler directive.  Different svr4 assemblers
97    expect various different forms for this operand.  The one given here
98    is just a default.  You may need to override it in your machine-
99    specific tm.h file (depending upon the particulars of your assembler).  */
100
101 #undef TYPE_OPERAND_FMT
102 #define TYPE_OPERAND_FMT        "@%s"
103
104 /* Write the extra assembler code needed to declare a function's result.
105    Most svr4 assemblers don't require any special declaration of the
106    result value, but there are exceptions.  */
107
108 #ifndef ASM_DECLARE_RESULT
109 #define ASM_DECLARE_RESULT(FILE, RESULT)
110 #endif
111
112 /* These macros generate the special .type and .size directives which
113    are used to set the corresponding fields of the linker symbol table
114    entries in an ELF object file under SVR4.  These macros also output
115    the starting labels for the relevant functions/objects.  */
116
117 /* Write the extra assembler code needed to declare a function properly.
118    Some svr4 assemblers need to also have something extra said about the
119    function's return value.  We allow for that here.  */
120
121 #undef ASM_DECLARE_FUNCTION_NAME
122 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)                     \
123   do {                                                                  \
124     fprintf (FILE, "\t%s\t ", TYPE_ASM_OP);                             \
125     assemble_name (FILE, NAME);                                         \
126     putc (',', FILE);                                                   \
127     fprintf (FILE, TYPE_OPERAND_FMT, "function");                       \
128     putc ('\n', FILE);                                                  \
129     ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));                      \
130     ASM_OUTPUT_LABEL(FILE, NAME);                                       \
131   } while (0)
132
133 /* Write the extra assembler code needed to declare an object properly.  */
134
135 #undef ASM_DECLARE_OBJECT_NAME
136 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)                       \
137   do {                                                                  \
138     fprintf (FILE, "\t%s\t ", TYPE_ASM_OP);                             \
139     assemble_name (FILE, NAME);                                         \
140     putc (',', FILE);                                                   \
141     fprintf (FILE, TYPE_OPERAND_FMT, "object");                         \
142     putc ('\n', FILE);                                                  \
143     size_directive_output = 0;                                          \
144     if (!flag_inhibit_size_directive && DECL_SIZE (DECL))               \
145       {                                                                 \
146         size_directive_output = 1;                                      \
147         fprintf (FILE, "\t%s\t ", SIZE_ASM_OP);                         \
148         assemble_name (FILE, NAME);                                     \
149         fprintf (FILE, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL))); \
150       }                                                                 \
151     ASM_OUTPUT_LABEL(FILE, NAME);                                       \
152   } while (0)
153
154 /* Output the size directive for a decl in rest_of_decl_compilation
155    in the case where we did not do so before the initializer.
156    Once we find the error_mark_node, we know that the value of
157    size_directive_output was set
158    by ASM_DECLARE_OBJECT_NAME when it was run for the same decl.  */
159
160 #undef ASM_FINISH_DECLARE_OBJECT
161 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)         \
162 do {                                                                     \
163      char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);                   \
164      if (!flag_inhibit_size_directive && DECL_SIZE (DECL)                \
165          && ! AT_END && TOP_LEVEL                                        \
166          && DECL_INITIAL (DECL) == error_mark_node                       \
167          && !size_directive_output)                                      \
168        {                                                                 \
169          size_directive_output = 1;                                      \
170          fprintf (FILE, "\t%s\t ", SIZE_ASM_OP);                         \
171          assemble_name (FILE, name);                                     \
172          fprintf (FILE, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL))); \
173        }                                                                 \
174    } while (0)
175
176 /* This is how to declare the size of a function.  */
177
178 #undef ASM_DECLARE_FUNCTION_SIZE
179 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)                    \
180   do {                                                                  \
181     if (!flag_inhibit_size_directive)                                   \
182       {                                                                 \
183         char label[256];                                                \
184         static int labelno;                                             \
185         labelno++;                                                      \
186         ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno);            \
187         ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno);               \
188         fprintf (FILE, "\t%s\t ", SIZE_ASM_OP);                         \
189         assemble_name (FILE, (FNAME));                                  \
190         fprintf (FILE, ",");                                            \
191         assemble_name (FILE, label);                                    \
192         fprintf (FILE, "-");                                            \
193         assemble_name (FILE, (FNAME));                                  \
194         putc ('\n', FILE);                                              \
195       }                                                                 \
196   } while (0)