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, 2002 Free Software Foundation, Inc.
4    Contributed by Ron Guilmette (rfg@monkeys.com).
5 
6 This file is part of GCC.
7 
8 GCC 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 GCC 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 GCC; 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 /* Define a symbol indicating that we are using svr3.h.  */
24 #define USING_SVR3_H
25 
26 /* Define a symbol so that libgcc* can know what sort of operating
27    environment and assembler syntax we are targeting for.  */
28 #define SVR3_target
29 
30 /* Assembler, linker, library, and startfile spec's.  */
31 
32 /* The .file command should always begin the output.  */
33 #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
34 
35 /* This says how to output an assembler line
36    to define a global common symbol.  */
37 /* We don't use ROUNDED because the standard compiler doesn't,
38    and the linker gives error messages if a common symbol
39    has more than one length value.  */
40 
41 #undef ASM_OUTPUT_COMMON
42 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)  \
43 ( fputs (".comm ", (FILE)),			\
44   assemble_name ((FILE), (NAME)),		\
45   fprintf ((FILE), ",%lu\n", (unsigned long)(SIZE)))
46 
47 /* This says how to output an assembler line
48    to define a local common symbol.  */
49 
50 /* Note that using bss_section here caused errors
51    in building shared libraries on system V.3.  */
52 #undef ASM_OUTPUT_LOCAL
53 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)	\
54   do {							\
55     int align = exact_log2 (ROUNDED);			\
56     if (align > 2) align = 2;				\
57     data_section ();					\
58     ASM_OUTPUT_ALIGN ((FILE), align == -1 ? 2 : align);	\
59     ASM_OUTPUT_LABEL ((FILE), (NAME));			\
60     fprintf ((FILE), "\t.set .,.+%u\n", (int)(ROUNDED));	\
61   } while (0)
62 
63 /* Output #ident as a .ident.  */
64 
65 #undef  ASM_OUTPUT_IDENT
66 #define ASM_OUTPUT_IDENT(FILE, NAME) \
67   fprintf (FILE, "\t.ident \"%s\"\n", NAME);
68 
69 /* Use periods rather than dollar signs in special g++ assembler names.  */
70 
71 #define NO_DOLLAR_IN_LABEL
72 
73 /* Implicit library calls should use memcpy, not bcopy, etc.  */
74 
75 #define TARGET_MEM_FUNCTIONS
76 
77 /* System V Release 3 uses COFF debugging info.  */
78 
79 #define SDB_DEBUGGING_INFO 1
80 
81 /* We don't want to output DBX debugging information.  */
82 
83 #undef DBX_DEBUGGING_INFO
84 
85 /* Define the actual types of some ANSI-mandated types.  These
86    definitions should work for most SVR3 systems.  */
87 
88 #undef SIZE_TYPE
89 #define SIZE_TYPE "unsigned int"
90 
91 #undef PTRDIFF_TYPE
92 #define PTRDIFF_TYPE "int"
93 
94 #undef WCHAR_TYPE
95 #define WCHAR_TYPE "long int"
96 
97 #undef WCHAR_TYPE_SIZE
98 #define WCHAR_TYPE_SIZE BITS_PER_WORD
99 
100 /* The prefix to add to user-visible assembler symbols.
101 
102    For System V Release 3 the convention is to prepend a leading
103    underscore onto user-level symbol names.  */
104 
105 #undef USER_LABEL_PREFIX
106 #define USER_LABEL_PREFIX "_"
107 
108 /* This is how to store into the string LABEL
109    the symbol_ref name of an internal numbered label where
110    PREFIX is the class of label and NUM is the number within the class.
111    This is suitable for output with `assemble_name'.
112 
113    For most svr3 systems, the convention is that any symbol which begins
114    with a period is not put into the linker symbol table by the assembler.  */
115 
116 #undef ASM_GENERATE_INTERNAL_LABEL
117 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)	\
118   sprintf (LABEL, "*%s%s%ld", LOCAL_LABEL_PREFIX, PREFIX, (long)(NUM))
119 
120 /* We want local labels to start with period if made with asm_fprintf.  */
121 #undef LOCAL_LABEL_PREFIX
122 #define LOCAL_LABEL_PREFIX "."
123 
124 /* Support const sections and the ctors and dtors sections for g++.  */
125 
126 /* Define a few machine-specific details of the implementation of
127    constructors.
128 
129    The __CTORS_LIST__ goes in the .init section.  Define CTOR_LIST_BEGIN
130    and CTOR_LIST_END to contribute to the .init section an instruction to
131    push a word containing 0 (or some equivalent of that).
132 
133    Define TARGET_ASM_CONSTRUCTOR to push the address of the constructor.  */
134 
135 #define INIT_SECTION_ASM_OP     "\t.section\t.init"
136 #define FINI_SECTION_ASM_OP     "\t.section .fini,\"x\""
137 #define DTORS_SECTION_ASM_OP    FINI_SECTION_ASM_OP
138 
139 /* CTOR_LIST_BEGIN and CTOR_LIST_END are machine-dependent
140    because they push on the stack.  */
141 
142 #ifndef STACK_GROWS_DOWNWARD
143 
144 /* Constructor list on stack is in reverse order.  Go to the end of the
145    list and go backwards to call constructors in the right order.  */
146 #define DO_GLOBAL_CTORS_BODY					\
147 do {								\
148   func_ptr *p, *beg = alloca (0);				\
149   for (p = beg; *p; p++)					\
150     ;								\
151   while (p != beg)						\
152     (*--p) ();							\
153 } while (0)
154 
155 #else
156 
157 /* Constructor list on stack is in correct order.  Just call them.  */
158 #define DO_GLOBAL_CTORS_BODY					\
159 do {								\
160   func_ptr *p, *beg = alloca (0);				\
161   for (p = beg; *p; )						\
162     (*p++) ();							\
163 } while (0)
164 
165 #endif /* STACK_GROWS_DOWNWARD */
166 
167 #undef EXTRA_SECTIONS
168 #define EXTRA_SECTIONS in_init, in_fini
169 
170 #undef EXTRA_SECTION_FUNCTIONS
171 #define EXTRA_SECTION_FUNCTIONS					\
172   INIT_SECTION_FUNCTION						\
173   FINI_SECTION_FUNCTION
174 
175 #define INIT_SECTION_FUNCTION					\
176 void								\
177 init_section ()							\
178 {								\
179   if (in_section != in_init)					\
180     {								\
181       fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP);	\
182       in_section = in_init;					\
183     }								\
184 }
185 
186 #define FINI_SECTION_FUNCTION					\
187 void								\
188 fini_section ()							\
189 {								\
190   if (in_section != in_fini)					\
191     {								\
192       fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP);	\
193       in_section = in_fini;					\
194     }								\
195 }
196