import of gcc-2.8
[official-gcc.git] / gcc / config / m88k / dgux.h
blob3b94f4acfa7cbd60ee1bd3e98a27ef51e9b22500
1 /* Definitions of target machine for GNU compiler.
2 Motorola m88100 running DG/UX.
3 Copyright (C) 1988, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
4 Contributed by Michael Tiemann (tiemann@mcc.com)
5 Currently maintained by (gcc@dg-rtp.dg.com)
7 This file is part of GNU CC.
9 GNU CC is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
14 GNU CC is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with GNU CC; see the file COPYING. If not, write to
21 the Free Software Foundation, 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
24 /* You're not seeing double! To transition to dwarf debugging, both are
25 supported. The option -msvr4 specifies elf. With these combinations,
26 -g means dwarf. */
27 /* DWARF_DEBUGGING_INFO defined in svr4.h. */
28 #define SDB_DEBUGGING_INFO
29 #define PREFERRED_DEBUGGING_TYPE \
30 (TARGET_SVR4 ? DWARF_DEBUG : SDB_DEBUG)
32 #ifndef VERSION_INFO2
33 #define VERSION_INFO2 "$Revision: 1.25 $"
34 #endif
35 #ifndef NO_BUGS
36 #define AS_BUG_IMMEDIATE_LABEL
37 /* The DG/UX 4.30 assembler doesn't accept the symbol `fcr63'. */
38 #define AS_BUG_FLDCR
39 #endif
41 #include "svr4.h"
42 #include "m88k/m88k.h"
44 /* Augment TARGET_SWITCHES with the MXDB options. */
45 #define MASK_STANDARD 0x40000000 /* Retain standard information */
46 #define MASK_NOLEGEND 0x20000000 /* Discard legend information */
47 #define MASK_EXTERNAL_LEGEND 0x10000000 /* Make external legends */
49 #define TARGET_STANDARD (target_flags & MASK_STANDARD)
50 #define TARGET_NOLEGEND (target_flags & MASK_NOLEGEND)
51 #define TARGET_EXTERNAL_LEGEND (target_flags & MASK_EXTERNAL_LEGEND)
53 #undef SUBTARGET_SWITCHES
54 #define SUBTARGET_SWITCHES \
55 { "standard", MASK_STANDARD }, \
56 { "legend", -MASK_NOLEGEND }, \
57 { "no-legend", MASK_NOLEGEND }, \
58 { "external-legend", MASK_EXTERNAL_LEGEND }, \
59 /* the following is used only in the *_SPEC's */ \
60 { "keep-coff", 0 },
62 /* Default switches */
63 #undef TARGET_DEFAULT
64 #define TARGET_DEFAULT (MASK_CHECK_ZERO_DIV | \
65 MASK_OCS_DEBUG_INFO | \
66 MASK_OCS_FRAME_POSITION | \
67 MASK_STANDARD | \
68 MASK_SVR4)
69 #undef CPU_DEFAULT
70 #define CPU_DEFAULT MASK_88000
72 /* Macros to be automatically defined. __svr4__ is our extension.
73 __CLASSIFY_TYPE__ is used in the <varargs.h> and <stdarg.h> header
74 files with DG/UX revision 5.40 and later. This allows GNU CC to
75 operate without installing the header files. */
77 #undef CPP_PREDEFINES
78 #define CPP_PREDEFINES "-Dm88000 -Dm88k -Dunix -DDGUX -D__CLASSIFY_TYPE__=2\
79 -D__svr4__ -Asystem(unix) -Acpu(m88k) -Amachine(m88k)"
81 /* If -m88100 is in effect, add -Dm88100; similarly for -m88110.
82 Here, the CPU_DEFAULT is assumed to be -m88000. If not -ansi,
83 -traditional, or restricting include files to one specific source
84 target, specify full DG/UX features. */
85 #undef CPP_SPEC
86 #define CPP_SPEC "%(cpp_cpu) %{msvr3:-D_M88KBCS_TARGET} %{!msvr3:-D_DGUX_TARGET}"
88 /* Assembler support (-V, silicon filter, legends for mxdb). */
89 #undef ASM_SPEC
90 #define ASM_SPEC "%{pipe:%{!.s: - }\
91 %{!msvr3:%{!m88110:-KV3 }%{m88110:-KV04.00 }}}\
92 %(asm_cpu)"
94 /* Override svr4.h. */
95 #undef ASM_FINAL_SPEC
96 #undef STARTFILE_SPEC
98 /* Linker and library spec's.
99 -msvr4 is the default if -msvr3 is not specified.
100 -static, -shared, -symbolic, -h* and -z* access AT&T V.4 link options.
101 -svr4 instructs gcc to place /usr/lib/values-X[cat].o on the link line.
102 -msvr3 indicates linking done in a COFF environment and the link
103 script is added to the link line. In all environments, the first
104 and last objects are crtbegin.o (or bcscrtbegin.o) and crtend.o.
105 When the -G link option is used (-shared and -symbolic) a final
106 link is not being done. */
107 #undef ENDFILE_SPEC
108 #define ENDFILE_SPEC "crtend.o%s"
109 #undef LIB_SPEC
110 #define LIB_SPEC "%{!msvr3:%{!shared:-lstaticdgc}} %{!shared:%{!symbolic:-lc}}"
111 #undef LINK_SPEC
112 #define LINK_SPEC "%{z*} %{h*} %{v:-V} \
113 %{static:-dn -Bstatic} \
114 %{shared:-G -dy} \
115 %{symbolic:-Bsymbolic -G -dy} \
116 %{pg:-L/usr/lib/libp}%{p:-L/usr/lib/libp}"
117 #undef STARTFILE_SPEC
118 #define STARTFILE_SPEC "%(startfile_default)"
121 /* This macro defines names of additional specifications to put in the specs
122 that can be used in various specifications like CC1_SPEC. Its definition
123 is an initializer with a subgrouping for each command option.
125 Each subgrouping contains a string constant, that defines the
126 specification name, and a string constant that used by the GNU CC driver
127 program.
129 Do not define this macro if it does not need to do anything. */
131 #define EXTRA_SPECS \
132 { "cpp_cpu", CPP_CPU_SPEC }, \
133 { "asm_cpu", ASM_CPU_SPEC }, \
134 { "startfile_default", STARTFILE_DEFAULT_SPEC }, \
135 { "startfile_crtbegin", STARTFILE_CRTBEGIN_SPEC }
137 /* Keep this left justified, no white space is allowed between
138 the arguments to the -Wc option */
139 #define ASM_CPU_SPEC "\
140 %{v:-V} \
141 %{g:\
142 %{mno-legend:-Wc,off}\
143 %{!mno-legend:-Wc,-fix-bb,-s\"%i\"\
144 %{traditional:,-lc}\
145 %{!traditional:,-lansi-c}\
146 %{mstandard:,-keep-std}\
147 %{mexternal-legend:,-external}\
148 %{mocs-frame-position:,-ocs}}}"
150 #define CPP_CPU_SPEC "\
151 %{!m88000:%{!m88100:%{m88110:-D__m88110__}}} \
152 %{!m88000:%{!m88110:%{m88100:-D__m88100__}}} \
153 %{!ansi:%{!traditional:-D__OPEN_NAMESPACE__}}"
155 #define STARTFILE_DEFAULT_SPEC "\
156 %{!shared:%{!symbolic:%{pg:gcrt0.o%s} \
157 %{!pg:%{p:/lib/mcrt0.o}%{!p:/lib/crt0.o}} \
158 %(startfile_crtbegin) \
159 %{svr4:%{ansi:/lib/values-Xc.o} \
160 %{!ansi:%{traditional:/lib/values-Xt.o} \
161 %{!traditional:/usr/lib/values-Xa.o}}}}}"
163 #define STARTFILE_CRTBEGIN_SPEC "\
164 %{msvr3:m88kdgux.ld%s bcscrtbegin.o%s} \
165 %{!msvr3:crtbegin.o%s}"
167 #undef GPLUSPLUS_INCLUDE_DIR
168 #define GPLUSPLUS_INCLUDE_DIR "/usr/opt/g++/lib/g++-include"
170 /* Fast DG/UX version of profiler that does not require lots of
171 registers to be stored. */
172 #undef FUNCTION_PROFILER
173 #define FUNCTION_PROFILER(FILE, LABELNO) \
174 output_function_profiler (FILE, LABELNO, "gcc.mcount", 0)
176 /* Output the legend info for mxdb when debugging except if standard
177 debugging information only is explicitly requested. */
178 #undef ASM_FIRST_LINE
179 #define ASM_FIRST_LINE(FILE) \
180 do { \
181 if (TARGET_SVR4) \
183 if (TARGET_88110) \
184 fprintf (FILE, "\t%s\t \"%s\"\n", VERSION_ASM_OP, "04.00"); \
185 else \
186 fprintf (FILE, "\t%s\t \"%s\"\n", VERSION_ASM_OP, "03.00"); \
188 if (write_symbols != NO_DEBUG && !TARGET_NOLEGEND) \
190 fprintf (FILE, ";legend_info -fix-bb -h\"gcc-%s\" -s\"%s\"", \
191 VERSION_STRING, main_input_filename); \
192 fputs (flag_traditional ? " -lc" : " -lansi-c", FILE); \
193 if (TARGET_STANDARD) \
194 fputs (" -keep-std", FILE); \
195 if (TARGET_EXTERNAL_LEGEND) \
196 fputs (" -external", FILE); \
197 if (TARGET_OCS_FRAME_POSITION) \
198 fputs (" -ocs", FILE); \
199 fputc ('\n', FILE); \
201 } while (0)
203 /* Override svr4.h. */
204 #undef PTRDIFF_TYPE
205 #undef WCHAR_TYPE
206 #undef WCHAR_TYPE_SIZE
208 /* Override svr4.h and m88k.h except when compiling crtstuff.c. These must
209 be constant strings when compiling crtstuff.c. Otherwise, respect the
210 -mversion-STRING option used. */
211 #undef INIT_SECTION_PREAMBLE
212 #undef INIT_SECTION_ASM_OP
213 #undef FINI_SECTION_ASM_OP
214 #undef CTORS_SECTION_ASM_OP
215 #undef DTORS_SECTION_ASM_OP
217 #if defined (CRT_BEGIN) || defined (CRT_END) || defined (L__main)
218 /* routines to invoke global constructors and destructors are always COFF
219 to enable linking mixed COFF and ELF objects */
220 #define FINI_SECTION_ASM_OP ("section .fini,\"x\"")
221 #ifndef BCS
222 #define INIT_SECTION_PREAMBLE asm ("\taddu\tr31,r31,0x20")
223 #endif
224 #undef INIT_SECTION_ASM_OP
225 #define INIT_SECTION_ASM_OP ("section\t .init,\"x\"")
226 #undef CTORS_SECTION_ASM_OP
227 #define CTORS_SECTION_ASM_OP ("section\t .ctors,\"d\"")
228 #undef DTORS_SECTION_ASM_OP
229 #define DTORS_SECTION_ASM_OP ("section\t .dtors,\"d\"")
230 #undef OBJECT_FORMAT_ELF
231 #else
232 #undef INIT_SECTION_ASM_OP
233 #define INIT_SECTION_ASM_OP (TARGET_SVR4 \
234 ? "section\t .init,\"xa\"" \
235 : "section\t .init,\"x\"")
236 #undef CTORS_SECTION_ASM_OP
237 #define CTORS_SECTION_ASM_OP (TARGET_SVR4 \
238 ? "section\t .ctors,\"aw\"" \
239 : "section\t .ctors,\"d\"")
240 #undef DTORS_SECTION_ASM_OP
241 #define DTORS_SECTION_ASM_OP (TARGET_SVR4 \
242 ? "section\t .dtors,\"aw\"" \
243 : "section\t .dtors,\"d\"")
244 #endif /* crtstuff.c */
246 /* The lists of global object constructors and global destructors are always
247 placed in the .ctors/.dtors sections. This requires the use of a link
248 script if the COFF linker is used, but otherwise COFF and ELF objects
249 can be intermixed. A COFF object will pad the section to 16 bytes with
250 zeros; and ELF object will not contain padding. We deal with this by
251 putting a -1 marker at the begin and end of the list and ignoring zero
252 entries. */
254 /* Mark the end of the .ctors/.dtors sections with a -1. */
256 #define CTOR_LIST_BEGIN \
257 asm (CTORS_SECTION_ASM_OP); \
258 func_ptr __CTOR_LIST__[1] = { (func_ptr) (-1) }
260 #define CTOR_LIST_END \
261 asm (CTORS_SECTION_ASM_OP); \
262 func_ptr __CTOR_END__[1] = { (func_ptr) (-1) }
264 #define DTOR_LIST_BEGIN \
265 asm (DTORS_SECTION_ASM_OP); \
266 func_ptr __DTOR_LIST__[1] = { (func_ptr) (-1) }
268 #define DTOR_LIST_END \
269 asm (DTORS_SECTION_ASM_OP); \
270 func_ptr __DTOR_END__[1] = { (func_ptr) (-1) }
272 /* Walk the list ignoring NULL entries till we hit the terminating -1. */
273 #define DO_GLOBAL_CTORS_BODY \
274 do { \
275 int i; \
276 for (i=1;(int)(__CTOR_LIST__[i]) != -1; i++) \
277 if (((int *)__CTOR_LIST__)[i] != 0) \
278 __CTOR_LIST__[i] (); \
279 } while (0)
281 /* Walk the list looking for the terminating -1 that marks the end.
282 Go backward and ignore any NULL entries. */
283 #define DO_GLOBAL_DTORS_BODY \
284 do { \
285 int i; \
286 for (i=1;(int)(__DTOR_LIST__[i]) != -1; i++); \
287 for (i-=1;(int)(__DTOR_LIST__[i]) != -1; i--) \
288 if (((int *)__DTOR_LIST__)[i] != 0) \
289 __DTOR_LIST__[i] (); \
290 } while (0)
292 /* The maximum alignment which the object file format can support.
293 page alignment would seem to be enough */
294 #undef MAX_OFILE_ALIGNMENT
295 #define MAX_OFILE_ALIGNMENT 0x1000
297 /* Must use data section for relocatable constants when pic. */
298 #undef SELECT_RTX_SECTION
299 #define SELECT_RTX_SECTION(MODE,RTX) \
301 if (flag_pic && symbolic_operand (RTX)) \
302 data_section (); \
303 else \
304 const_section (); \