* target.h (asm_out.byte_op, asm_out.aligned_op, asm_out.unaligned_op,
[official-gcc.git] / gcc / config / svr3.h
blob4de6f52670c866bc0bfc7a7e56b7f3b1ce4ef9e6
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).
6 This file is part of GNU CC.
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.
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.
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.
23 To use this file, make up a file with a name like:
25 ?????svr3.h
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:
31 #include "?????.h"
32 #include "svr3.h"
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.
42 /* Define a symbol indicating that we are using svr3.h. */
43 #define USING_SVR3_H
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
49 /* Cpp, assembler, linker, library, and startfile spec's. */
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. */
56 #undef CPP_PREDEFINES
58 /* Output at beginning of assembler file. */
59 /* The .file command should always begin the output. */
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)
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)
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. */
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)))
83 /* This says how to output an assembler line
84 to define a local common symbol. */
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)
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. */
102 #define STARTFILE_SPEC \
103 "%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}"
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
111 /* Special flags for the linker. I don't know what they do. */
113 #define LINK_SPEC "%{T*} %{z:-lm}"
114 #endif
116 /* Allow #sccs in preprocessor. */
118 #define SCCS_DIRECTIVE
120 /* Output #ident as a .ident. */
122 #undef ASM_OUTPUT_IDENT
123 #define ASM_OUTPUT_IDENT(FILE, NAME) \
124 fprintf (FILE, "\t.ident \"%s\"\n", NAME);
126 /* Use periods rather than dollar signs in special g++ assembler names. */
128 #define NO_DOLLAR_IN_LABEL
130 /* Implicit library calls should use memcpy, not bcopy, etc. */
132 #define TARGET_MEM_FUNCTIONS
134 /* System V Release 3 uses COFF debugging info. */
136 #define SDB_DEBUGGING_INFO
138 /* We don't want to output DBX debugging information. */
140 #undef DBX_DEBUGGING_INFO
142 /* Define the actual types of some ANSI-mandated types. These
143 definitions should work for most SVR3 systems. */
145 #undef SIZE_TYPE
146 #define SIZE_TYPE "unsigned int"
148 #undef PTRDIFF_TYPE
149 #define PTRDIFF_TYPE "int"
151 #undef WCHAR_TYPE
152 #define WCHAR_TYPE "long int"
154 #undef WCHAR_TYPE_SIZE
155 #define WCHAR_TYPE_SIZE BITS_PER_WORD
157 /* The prefix to add to user-visible assembler symbols.
159 For System V Release 3 the convention is to prepend a leading
160 underscore onto user-level symbol names. */
162 #undef USER_LABEL_PREFIX
163 #define USER_LABEL_PREFIX "_"
165 /* This is how to output an internal numbered label where
166 PREFIX is the class of label and NUM is the number within the class.
168 For most svr3 systems, the convention is that any symbol which begins
169 with a period is not put into the linker symbol table by the assembler. */
171 #undef ASM_OUTPUT_INTERNAL_LABEL
172 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
173 asm_fprintf (FILE, "%0L%s%d:\n", PREFIX, NUM)
175 /* This is how to store into the string LABEL
176 the symbol_ref name of an internal numbered label where
177 PREFIX is the class of label and NUM is the number within the class.
178 This is suitable for output with `assemble_name'.
180 For most svr3 systems, the convention is that any symbol which begins
181 with a period is not put into the linker symbol table by the assembler. */
183 #undef ASM_GENERATE_INTERNAL_LABEL
184 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
185 sprintf (LABEL, "*%s%s%ld", LOCAL_LABEL_PREFIX, PREFIX, (long)(NUM))
187 /* We want local labels to start with period if made with asm_fprintf. */
188 #undef LOCAL_LABEL_PREFIX
189 #define LOCAL_LABEL_PREFIX "."
191 /* Support const sections and the ctors and dtors sections for g++.
192 Note that there appears to be two different ways to support const
193 sections at the moment. You can either #define the symbol
194 READONLY_DATA_SECTION (giving it some code which switches to the
195 readonly data section) or else you can #define the symbols
196 EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and
197 SELECT_RTX_SECTION. We do both here just to be on the safe side.
198 However, use of the const section is turned off by default
199 unless the specific tm.h file turns it on by defining
200 USE_CONST_SECTION as 1. */
202 /* Define a few machine-specific details of the implementation of
203 constructors.
205 The __CTORS_LIST__ goes in the .init section. Define CTOR_LIST_BEGIN
206 and CTOR_LIST_END to contribute to the .init section an instruction to
207 push a word containing 0 (or some equivalent of that).
209 Define TARGET_ASM_CONSTRUCTOR to push the address of the constructor. */
211 #define USE_CONST_SECTION 0
213 #define INIT_SECTION_ASM_OP "\t.section\t.init"
214 #define FINI_SECTION_ASM_OP "\t.section .fini,\"x\""
215 #define CONST_SECTION_ASM_OP "\t.section\t.rodata, \"x\""
216 #define DTORS_SECTION_ASM_OP FINI_SECTION_ASM_OP
218 /* CTOR_LIST_BEGIN and CTOR_LIST_END are machine-dependent
219 because they push on the stack. */
221 #ifndef STACK_GROWS_DOWNWARD
223 /* Constructor list on stack is in reverse order. Go to the end of the
224 list and go backwards to call constructors in the right order. */
225 #define DO_GLOBAL_CTORS_BODY \
226 do { \
227 func_ptr *p, *beg = alloca (0); \
228 for (p = beg; *p; p++) \
230 while (p != beg) \
231 (*--p) (); \
232 } while (0)
234 #else
236 /* Constructor list on stack is in correct order. Just call them. */
237 #define DO_GLOBAL_CTORS_BODY \
238 do { \
239 func_ptr *p, *beg = alloca (0); \
240 for (p = beg; *p; ) \
241 (*p++) (); \
242 } while (0)
244 #endif /* STACK_GROWS_DOWNWARD */
246 /* Add extra sections .rodata, .init and .fini. */
248 #undef EXTRA_SECTIONS
249 #define EXTRA_SECTIONS in_const, in_init, in_fini
251 #undef EXTRA_SECTION_FUNCTIONS
252 #define EXTRA_SECTION_FUNCTIONS \
253 CONST_SECTION_FUNCTION \
254 INIT_SECTION_FUNCTION \
255 FINI_SECTION_FUNCTION
257 #define INIT_SECTION_FUNCTION \
258 void \
259 init_section () \
261 if (in_section != in_init) \
263 fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP); \
264 in_section = in_init; \
268 #define FINI_SECTION_FUNCTION \
269 void \
270 fini_section () \
272 if (in_section != in_fini) \
274 fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP); \
275 in_section = in_fini; \
279 #define READONLY_DATA_SECTION() const_section ()
281 #define CONST_SECTION_FUNCTION \
282 void \
283 const_section () \
285 if (!USE_CONST_SECTION) \
286 text_section(); \
287 else if (in_section != in_const) \
289 fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \
290 in_section = in_const; \
294 /* A C statement or statements to switch to the appropriate
295 section for output of DECL. DECL is either a `VAR_DECL' node
296 or a constant of some sort. RELOC indicates whether forming
297 the initial value of DECL requires link-time relocations. */
299 #undef SELECT_SECTION
300 #define SELECT_SECTION(DECL,RELOC,ALIGN) \
302 if (TREE_CODE (DECL) == STRING_CST) \
304 if (! flag_writable_strings) \
305 const_section (); \
306 else \
307 data_section (); \
309 else if (TREE_CODE (DECL) == VAR_DECL) \
311 if ((0 && RELOC) /* should be (flag_pic && RELOC) */ \
312 || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \
313 || !DECL_INITIAL (DECL) \
314 || (DECL_INITIAL (DECL) != error_mark_node \
315 && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \
316 data_section (); \
317 else \
318 const_section (); \
320 else \
321 const_section (); \
324 /* A C statement or statements to switch to the appropriate
325 section for output of RTX in mode MODE. RTX is some kind
326 of constant in RTL. The argument MODE is redundant except
327 in the case of a `const_int' rtx. Currently, these always
328 go into the const section. */
330 #undef SELECT_RTX_SECTION
331 #define SELECT_RTX_SECTION(MODE,RTX,ALIGN) const_section()