* final.c (HAVE_READONLY_DATA_SECTION): New.
[official-gcc.git] / gcc / config / m88k / dgux.h
blob7c12b7c7a47dc8ca0085487d7a5a9dc3e7461efc
1 /* Definitions of target machine for GNU compiler.
2 Motorola m88100 running DG/UX.
3 Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002
4 Free Software Foundation, Inc.
5 Contributed by Michael Tiemann (tiemann@mcc.com)
6 Currently maintained by (gcc@dg-rtp.dg.com)
8 This file is part of GNU CC.
10 GNU CC is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2, or (at your option)
13 any later version.
15 GNU CC is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with GNU CC; see the file COPYING. If not, write to
22 the Free Software Foundation, 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA. */
25 /* You're not seeing double! To transition to dwarf debugging, both are
26 supported. The option -msvr4 specifies elf. With these combinations,
27 -g means dwarf. */
28 /* DWARF_DEBUGGING_INFO defined in svr4.h. */
29 #undef SDB_DEBUGGING_INFO
30 #define SDB_DEBUGGING_INFO
31 #undef PREFERRED_DEBUGGING_TYPE
32 #define PREFERRED_DEBUGGING_TYPE \
33 (TARGET_SVR4 ? DWARF_DEBUG : SDB_DEBUG)
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 /* TODO: convert includes to ${tm_file} list in config.gcc. */
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 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\",-lansi-c\
144 %{mstandard:,-keep-std}\
145 %{mexternal-legend:,-external}\
146 %{mocs-frame-position:,-ocs}}}"
148 #define CPP_CPU_SPEC "\
149 %{!m88000:%{!m88100:%{m88110:-D__m88110__}}} \
150 %{!m88000:%{!m88110:%{m88100:-D__m88100__}}} \
151 %{!ansi:-D__OPEN_NAMESPACE__}"
153 #define STARTFILE_DEFAULT_SPEC "\
154 %{!shared:%{!symbolic:%{pg:gcrt0.o%s} \
155 %{!pg:%{p:/lib/mcrt0.o}%{!p:/lib/crt0.o}} \
156 %(startfile_crtbegin) \
157 %{svr4:%{ansi:/lib/values-Xc.o} \
158 %{!ansi:/usr/lib/values-Xa.o}}}}"
160 #define STARTFILE_CRTBEGIN_SPEC "\
161 %{msvr3:m88kdgux.ld%s bcscrtbegin.o%s} \
162 %{!msvr3:crtbegin.o%s}"
164 #undef GPLUSPLUS_INCLUDE_DIR
165 #define GPLUSPLUS_INCLUDE_DIR "/usr/opt/g++/lib/g++-include"
167 /* Fast DG/UX version of profiler that does not require lots of
168 registers to be stored. */
169 #undef FUNCTION_PROFILER
170 #define FUNCTION_PROFILER(FILE, LABELNO) \
171 output_function_profiler (FILE, LABELNO, "gcc.mcount", 0)
173 /* Output the legend info for mxdb when debugging except if standard
174 debugging information only is explicitly requested. */
175 #undef ASM_FIRST_LINE
176 #define ASM_FIRST_LINE(FILE) \
177 do { \
178 if (TARGET_SVR4) \
180 if (TARGET_88110) \
181 fprintf (FILE, "%s\"%s\"\n", VERSION_ASM_OP, "04.00"); \
182 else \
183 fprintf (FILE, "%s\"%s\"\n", VERSION_ASM_OP, "03.00"); \
185 if (write_symbols != NO_DEBUG && !TARGET_NOLEGEND) \
187 fprintf (FILE, ";legend_info -fix-bb -h\"gcc-%s\" -s\"%s\"", \
188 version_string, main_input_filename); \
189 fputs (" -lansi-c", FILE); \
190 if (TARGET_STANDARD) \
191 fputs (" -keep-std", FILE); \
192 if (TARGET_EXTERNAL_LEGEND) \
193 fputs (" -external", FILE); \
194 if (TARGET_OCS_FRAME_POSITION) \
195 fputs (" -ocs", FILE); \
196 fputc ('\n', FILE); \
198 } while (0)
200 /* Override svr4.h. */
201 #undef PTRDIFF_TYPE
202 #undef WCHAR_TYPE
203 #undef WCHAR_TYPE_SIZE
205 /* Override svr4.h and m88k.h except when compiling crtstuff.c. These must
206 be constant strings when compiling crtstuff.c. Otherwise, respect the
207 -mversion-STRING option used. */
208 #undef INIT_SECTION_PREAMBLE
209 #undef INIT_SECTION_ASM_OP
210 #undef FINI_SECTION_ASM_OP
211 #undef CTORS_SECTION_ASM_OP
212 #undef DTORS_SECTION_ASM_OP
214 #if defined (CRT_BEGIN) || defined (CRT_END) || defined (L__main)
215 /* routines to invoke global constructors and destructors are always COFF
216 to enable linking mixed COFF and ELF objects */
217 #define FINI_SECTION_ASM_OP ("\tsection .fini,\"x\"")
218 #ifndef BCS
219 #define INIT_SECTION_PREAMBLE asm ("\taddu\tr31,r31,0x20")
220 #endif
221 #undef INIT_SECTION_ASM_OP
222 #define INIT_SECTION_ASM_OP ("\tsection\t .init,\"x\"")
223 #undef CTORS_SECTION_ASM_OP
224 #define CTORS_SECTION_ASM_OP ("\tsection\t .ctors,\"d\"")
225 #undef DTORS_SECTION_ASM_OP
226 #define DTORS_SECTION_ASM_OP ("\tsection\t .dtors,\"d\"")
227 #undef OBJECT_FORMAT_ELF
228 #else
229 #undef INIT_SECTION_ASM_OP
230 #define INIT_SECTION_ASM_OP (TARGET_SVR4 \
231 ? "\tsection\t .init,\"xa\"" \
232 : "\tsection\t .init,\"x\"")
233 #undef CTORS_SECTION_ASM_OP
234 #define CTORS_SECTION_ASM_OP (TARGET_SVR4 \
235 ? "\tsection\t .ctors,\"aw\"" \
236 : "\tsection\t .ctors,\"d\"")
237 #undef DTORS_SECTION_ASM_OP
238 #define DTORS_SECTION_ASM_OP (TARGET_SVR4 \
239 ? "\tsection\t .dtors,\"aw\"" \
240 : "\tsection\t .dtors,\"d\"")
241 #endif /* crtstuff.c */
243 /* The lists of global object constructors and global destructors are always
244 placed in the .ctors/.dtors sections. This requires the use of a link
245 script if the COFF linker is used, but otherwise COFF and ELF objects
246 can be intermixed. A COFF object will pad the section to 16 bytes with
247 zeros; and ELF object will not contain padding. We deal with this by
248 putting a -1 marker at the begin and end of the list and ignoring zero
249 entries. */
251 /* Mark the end of the .ctors/.dtors sections with a -1. */
253 #define CTOR_LIST_BEGIN \
254 asm (CTORS_SECTION_ASM_OP); \
255 func_ptr __CTOR_LIST__[1] = { (func_ptr) (-1) }
257 #define CTOR_LIST_END \
258 asm (CTORS_SECTION_ASM_OP); \
259 func_ptr __CTOR_END__[1] = { (func_ptr) (-1) }
261 #define DTOR_LIST_BEGIN \
262 asm (DTORS_SECTION_ASM_OP); \
263 func_ptr __DTOR_LIST__[1] = { (func_ptr) (-1) }
265 #define DTOR_LIST_END \
266 asm (DTORS_SECTION_ASM_OP); \
267 func_ptr __DTOR_END__[1] = { (func_ptr) (-1) }
269 /* Walk the list ignoring NULL entries till we hit the terminating -1. */
270 #define DO_GLOBAL_CTORS_BODY \
271 do { \
272 int i; \
273 for (i=1;(int)(__CTOR_LIST__[i]) != -1; i++) \
274 if (((int *)__CTOR_LIST__)[i] != 0) \
275 __CTOR_LIST__[i] (); \
276 } while (0)
278 /* Walk the list looking for the terminating -1 that marks the end.
279 Go backward and ignore any NULL entries. */
280 #define DO_GLOBAL_DTORS_BODY \
281 do { \
282 int i; \
283 for (i=1;(int)(__DTOR_LIST__[i]) != -1; i++); \
284 for (i-=1;(int)(__DTOR_LIST__[i]) != -1; i--) \
285 if (((int *)__DTOR_LIST__)[i] != 0) \
286 __DTOR_LIST__[i] (); \
287 } while (0)
289 /* The maximum alignment which the object file format can support.
290 page alignment would seem to be enough */
291 #undef MAX_OFILE_ALIGNMENT
292 #define MAX_OFILE_ALIGNMENT 0x1000
294 /* Must use data section for relocatable constants when pic. */
295 #undef SELECT_RTX_SECTION
296 #define SELECT_RTX_SECTION(MODE,RTX,ALIGN) \
298 if (flag_pic && symbolic_operand ((RTX), (MODE))) \
299 data_section (); \
300 else \
301 readonly_data_section (); \