OSDN Git Service

* config/m68hc11/m68hc11.c (m68hc11_initial_elimination_offset):
[pf3gnuchains/gcc-fork.git] / gcc / config / svr3.h
1 /* Operating system specific defines to be used when targeting GCC for
2    generic System V Release 3 system.
3    Copyright (C) 1991, 1996, 2000 Free Software Foundation, Inc.
4    Contributed by Ron Guilmette (rfg@monkeys.com).
5
6 This file is part of GNU CC.
7
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING.  If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.
22
23    To use this file, make up a file with a name like:
24
25         ?????svr3.h
26
27    where ????? is replaced by the name of the basic hardware that you
28    are targeting for.  Then, in the file ?????svr3.h, put something
29    like:
30
31         #include "?????.h"
32         #include "svr3.h"
33
34    followed by any really system-specific defines (or overrides of
35    defines) which you find that you need.  For example, CPP_PREDEFINES
36    is defined here with only the defined -Dunix and -DSVR3.  You should
37    probably override that in your target-specific ?????svr3.h file
38    with a set of defines that includes these, but also contains an
39    appropriate define for the type of hardware that you are targeting.
40 */
41
42 /* Define a symbol indicating that we are using svr3.h.  */
43 #define USING_SVR3_H
44
45 /* Define a symbol so that libgcc* can know what sort of operating
46    environment and assembler syntax we are targeting for.  */
47 #define SVR3_target
48
49 /* Cpp, assembler, linker, library, and startfile spec's.  */
50
51 /* You should redefine CPP_PREDEFINES in any file which includes this one.
52    The definition should be appropriate for the type of target system
53    involved, and it should include any -A (assertion) options which are
54    appropriate for the given target system.  */
55
56 #undef CPP_PREDEFINES
57
58 /* Output at beginning of assembler file.  */
59 /* The .file command should always begin the output.  */
60
61 #undef ASM_FILE_START
62 #define ASM_FILE_START(FILE)                                    \
63   do { output_file_directive ((FILE), main_input_filename);     \
64        if (optimize) { ASM_FILE_START_1 (FILE); }               \
65      } while (0)
66
67 /* By default, do nothing: a few machines support .optim, but not most.  */
68 #undef ASM_FILE_START_1
69 #define ASM_FILE_START_1(FILE)
70
71 /* This says how to output an assembler line
72    to define a global common symbol.  */
73 /* We don't use ROUNDED because the standard compiler doesn't,
74    and the linker gives error messages if a common symbol
75    has more than one length value.  */
76
77 #undef ASM_OUTPUT_COMMON
78 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)  \
79 ( fputs (".comm ", (FILE)),                     \
80   assemble_name ((FILE), (NAME)),               \
81   fprintf ((FILE), ",%u\n", (SIZE)))
82
83 /* This says how to output an assembler line
84    to define a local common symbol.  */
85
86 /* Note that using bss_section here caused errors
87    in building shared libraries on system V.3.  */
88 #undef ASM_OUTPUT_LOCAL
89 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)     \
90   do {                                                  \
91     int align = exact_log2 (ROUNDED);                   \
92     if (align > 2) align = 2;                           \
93     data_section ();                                    \
94     ASM_OUTPUT_ALIGN ((FILE), align == -1 ? 2 : align); \
95     ASM_OUTPUT_LABEL ((FILE), (NAME));                  \
96     fprintf ((FILE), "\t.set .,.+%u\n", (ROUNDED));     \
97   } while (0)
98
99 #if 0 /* For now, let's leave these machine-specific.  */
100 /* Use crt1.o as a startup file and crtn.o as a closing file.  */
101
102 #define STARTFILE_SPEC  \
103   "%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}"
104
105 #ifdef CROSS_COMPILE
106 #define LIB_SPEC "-lc crtn.o%s"
107 #else
108 #define LIB_SPEC "%{p:-L/usr/lib/libp}%{pg:-L/usr/lib/libp} -lc crtn.o%s"
109 #endif
110
111 /* Special flags for the linker.  I don't know what they do.  */
112
113 #define LINK_SPEC "%{T*} %{z:-lm}"
114 #endif
115
116 /* Allow #sccs in preprocessor.  */
117
118 #define SCCS_DIRECTIVE
119
120 /* Output #ident as a .ident.  */
121
122 #define ASM_OUTPUT_IDENT(FILE, NAME) \
123   fprintf (FILE, "\t.ident \"%s\"\n", NAME);
124
125 /* Use periods rather than dollar signs in special g++ assembler names.  */
126
127 #define NO_DOLLAR_IN_LABEL
128
129 /* Implicit library calls should use memcpy, not bcopy, etc.  */
130
131 #define TARGET_MEM_FUNCTIONS
132
133 /* System V Release 3 uses COFF debugging info.  */
134
135 #define SDB_DEBUGGING_INFO
136
137 /* We don't want to output DBX debugging information.  */
138
139 #undef DBX_DEBUGGING_INFO
140
141 /* Define the actual types of some ANSI-mandated types.  These
142    definitions should work for most SVR3 systems.  */
143
144 #undef SIZE_TYPE
145 #define SIZE_TYPE "unsigned int"
146
147 #undef PTRDIFF_TYPE
148 #define PTRDIFF_TYPE "int"
149
150 #undef WCHAR_TYPE
151 #define WCHAR_TYPE "long int"
152
153 #undef WCHAR_TYPE_SIZE
154 #define WCHAR_TYPE_SIZE BITS_PER_WORD
155
156 /* Assembler pseudos to introduce constants of various size.  These
157    definitions should work for most svr3 systems.  */
158
159 #undef ASM_BYTE_OP
160 #define ASM_BYTE_OP "\t.byte\t"
161
162 /* The prefix to add to user-visible assembler symbols.
163
164    For System V Release 3 the convention is to prepend a leading
165    underscore onto user-level symbol names.  */
166
167 #undef USER_LABEL_PREFIX
168 #define USER_LABEL_PREFIX "_"
169
170 /* This is how to output an internal numbered label where
171    PREFIX is the class of label and NUM is the number within the class.
172
173    For most svr3 systems, the convention is that any symbol which begins
174    with a period is not put into the linker symbol table by the assembler.  */
175
176 #undef ASM_OUTPUT_INTERNAL_LABEL
177 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)      \
178   asm_fprintf (FILE, "%0L%s%d:\n", PREFIX, NUM)
179
180 /* This is how to store into the string LABEL
181    the symbol_ref name of an internal numbered label where
182    PREFIX is the class of label and NUM is the number within the class.
183    This is suitable for output with `assemble_name'.
184
185    For most svr3 systems, the convention is that any symbol which begins
186    with a period is not put into the linker symbol table by the assembler.  */
187
188 #undef ASM_GENERATE_INTERNAL_LABEL
189 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)   \
190   sprintf (LABEL, "*%s%s%d", LOCAL_LABEL_PREFIX, PREFIX, NUM)
191
192 /* We want local labels to start with period if made with asm_fprintf.  */
193 #undef LOCAL_LABEL_PREFIX
194 #define LOCAL_LABEL_PREFIX "."
195
196 /* Support const sections and the ctors and dtors sections for g++.
197    Note that there appears to be two different ways to support const
198    sections at the moment.  You can either #define the symbol
199    READONLY_DATA_SECTION (giving it some code which switches to the
200    readonly data section) or else you can #define the symbols
201    EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and
202    SELECT_RTX_SECTION.  We do both here just to be on the safe side.
203    However, use of the const section is turned off by default
204    unless the specific tm.h file turns it on by defining
205    USE_CONST_SECTION as 1.  */
206
207 /* Define a few machine-specific details of the implementation of
208    constructors.
209
210    The __CTORS_LIST__ goes in the .init section.  Define CTOR_LIST_BEGIN
211    and CTOR_LIST_END to contribute to the .init section an instruction to
212    push a word containing 0 (or some equivalent of that).
213
214    Define ASM_OUTPUT_CONSTRUCTOR to push the address of the constructor.  */
215
216 #define USE_CONST_SECTION       0
217
218 #define INIT_SECTION_ASM_OP     "\t.section\t.init"
219 #define FINI_SECTION_ASM_OP     "\t.section .fini,\"x\""
220 #define CONST_SECTION_ASM_OP    "\t.section\t.rodata, \"x\""
221 #define CTORS_SECTION_ASM_OP    INIT_SECTION_ASM_OP
222 #define DTORS_SECTION_ASM_OP    FINI_SECTION_ASM_OP
223
224 /* CTOR_LIST_BEGIN and CTOR_LIST_END are machine-dependent
225    because they push on the stack.  */
226
227 #ifndef STACK_GROWS_DOWNWARD
228
229 /* Constructor list on stack is in reverse order.  Go to the end of the
230    list and go backwards to call constructors in the right order.  */
231 #define DO_GLOBAL_CTORS_BODY                                    \
232 do {                                                            \
233   func_ptr *p, *beg = alloca (0);                               \
234   for (p = beg; *p; p++)                                        \
235     ;                                                           \
236   while (p != beg)                                              \
237     (*--p) ();                                                  \
238 } while (0)
239
240 #else
241
242 /* Constructor list on stack is in correct order.  Just call them.  */
243 #define DO_GLOBAL_CTORS_BODY                                    \
244 do {                                                            \
245   func_ptr *p, *beg = alloca (0);                               \
246   for (p = beg; *p; )                                           \
247     (*p++) ();                                                  \
248 } while (0)
249
250 #endif /* STACK_GROWS_DOWNWARD */
251
252 /* Add extra sections .rodata, .init and .fini.  */
253
254 #undef EXTRA_SECTIONS
255 #define EXTRA_SECTIONS in_const, in_init, in_fini
256
257 #undef EXTRA_SECTION_FUNCTIONS
258 #define EXTRA_SECTION_FUNCTIONS                                 \
259   CONST_SECTION_FUNCTION                                        \
260   INIT_SECTION_FUNCTION                                         \
261   FINI_SECTION_FUNCTION
262
263 #define INIT_SECTION_FUNCTION                                   \
264 void                                                            \
265 init_section ()                                                 \
266 {                                                               \
267   if (in_section != in_init)                                    \
268     {                                                           \
269       fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP);      \
270       in_section = in_init;                                     \
271     }                                                           \
272 }
273
274 #define FINI_SECTION_FUNCTION                                   \
275 void                                                            \
276 fini_section ()                                                 \
277 {                                                               \
278   if (in_section != in_fini)                                    \
279     {                                                           \
280       fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP);      \
281       in_section = in_fini;                                     \
282     }                                                           \
283 }
284
285 #define READONLY_DATA_SECTION() const_section ()
286
287 #define CONST_SECTION_FUNCTION                                          \
288 void                                                                    \
289 const_section ()                                                        \
290 {                                                                       \
291   if (!USE_CONST_SECTION)                                               \
292     text_section();                                                     \
293   else if (in_section != in_const)                                      \
294     {                                                                   \
295       fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP);             \
296       in_section = in_const;                                            \
297     }                                                                   \
298 }
299
300 /* The ctors and dtors sections are not normally put into use 
301    by EXTRA_SECTIONS and EXTRA_SECTION_FUNCTIONS as defined in svr3.h,
302    but it can't hurt to define these macros for whatever systems use them.  */
303 #define CTORS_SECTION_FUNCTION                                          \
304 void                                                                    \
305 ctors_section ()                                                        \
306 {                                                                       \
307   if (in_section != in_ctors)                                           \
308     {                                                                   \
309       fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP);             \
310       in_section = in_ctors;                                            \
311     }                                                                   \
312 }
313
314 #define DTORS_SECTION_FUNCTION                                          \
315 void                                                                    \
316 dtors_section ()                                                        \
317 {                                                                       \
318   if (in_section != in_dtors)                                           \
319     {                                                                   \
320       fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP);             \
321       in_section = in_dtors;                                            \
322     }                                                                   \
323 }
324
325 /* This is machine-dependent
326    because it needs to push something on the stack.  */
327 #undef ASM_OUTPUT_CONSTRUCTOR
328
329 /* A C statement (sans semicolon) to output an element in the table of
330    global destructors.  */
331 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)                                \
332   do {                                                                  \
333     fini_section ();                                            \
334     fprintf (FILE, "%s\t ", ASM_LONG);                                  \
335     assemble_name (FILE, NAME);                                         \
336     fprintf (FILE, "\n");                                               \
337   } while (0)
338
339 /* A C statement or statements to switch to the appropriate
340    section for output of DECL.  DECL is either a `VAR_DECL' node
341    or a constant of some sort.  RELOC indicates whether forming
342    the initial value of DECL requires link-time relocations.  */
343
344 #define SELECT_SECTION(DECL,RELOC)                                      \
345 {                                                                       \
346   if (TREE_CODE (DECL) == STRING_CST)                                   \
347     {                                                                   \
348       if (! flag_writable_strings)                                      \
349         const_section ();                                               \
350       else                                                              \
351         data_section ();                                                \
352     }                                                                   \
353   else if (TREE_CODE (DECL) == VAR_DECL)                                \
354     {                                                                   \
355       if ((0 && RELOC)  /* should be (flag_pic && RELOC) */             \
356           || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL)          \
357           || !DECL_INITIAL (DECL)                                       \
358           || (DECL_INITIAL (DECL) != error_mark_node                    \
359               && !TREE_CONSTANT (DECL_INITIAL (DECL))))                 \
360         data_section ();                                                \
361       else                                                              \
362         const_section ();                                               \
363     }                                                                   \
364   else                                                                  \
365     const_section ();                                                   \
366 }
367
368 /* A C statement or statements to switch to the appropriate
369    section for output of RTX in mode MODE.  RTX is some kind
370    of constant in RTL.  The argument MODE is redundant except
371    in the case of a `const_int' rtx.  Currently, these always
372    go into the const section.  */
373
374 #define SELECT_RTX_SECTION(MODE,RTX) const_section()