OSDN Git Service

(X_CFLAGS): New.
[pf3gnuchains/gcc-fork.git] / gcc / config / m88k / dgux.h
1 /* Definitions of target machine for GNU compiler.
2    Motorola m88100 running DG/UX.
3    Copyright (C) 1988, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
4    Contributed by Michael Tiemann (tiemann@mcc.com)
5    Currently maintained by (gcc@dg-rtp.dg.com)
6
7 This file is part of GNU CC.
8
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.
13
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.
18
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.  */
23
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)
31
32 #ifndef VERSION_INFO2
33 #define VERSION_INFO2   "$Revision: 1.21 $"
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
40
41 #include "svr4.h"
42 #include "m88k/m88k.h"
43
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 */
48
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)
52
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 },
61
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
71
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.  */
76
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)"
80
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) 
87                   %{msvr3:-D_M88KBCS_TARGET} %{!msvr3:-D_DGUX_TARGET}"
88
89 /* Assembler support (-V, silicon filter, legends for mxdb).  */
90 #undef  ASM_SPEC
91 #define ASM_SPEC "%{pipe:%{!.s: - }\
92                    %{!msvr3:%{!m88110:-KV3 }%{m88110:-KV04.00 }}}\
93                   %(asm_cpu)"
94
95 /* Override svr4.h.  */
96 #undef  ASM_FINAL_SPEC
97 #undef  STARTFILE_SPEC
98
99 /* Linker and library spec's.
100    -msvr4 is the default if -msvr3 is not specified.
101    -static, -shared, -symbolic, -h* and -z* access AT&T V.4 link options.
102    -svr4 instructs gcc to place /usr/lib/values-X[cat].o on the link line.
103    -msvr3 indicates linking done in a COFF environment and the link
104    script is added to the link line.  In all environments, the first
105    and last objects are crtbegin.o (or bcscrtbegin.o) and crtend.o.
106    When the -G link option is used (-shared and -symbolic) a final
107    link is not being done.  */
108 #undef  ENDFILE_SPEC
109 #define ENDFILE_SPEC "crtend.o%s"
110 #undef  LIB_SPEC
111 #define LIB_SPEC "%{!msvr3:%{!shared:-lstaticdgc}} %{!shared:%{!symbolic:-lc}}"
112 #undef  LINK_SPEC
113 #define LINK_SPEC "%{z*} %{h*} %{V} %{v:%{!V:-V}} \
114                    %{static:-dn -Bstatic} \
115                    %{shared:-G -dy} \
116                    %{symbolic:-Bsymbolic -G -dy} \
117                    %{pg:-L/usr/lib/libp}%{p:-L/usr/lib/libp}"
118 #undef  STARTFILE_SPEC
119 #define STARTFILE_SPEC "%(startfile_default)"
120
121
122 /* This macro defines names of additional specifications to put in the specs
123    that can be used in various specifications like CC1_SPEC.  Its definition
124    is an initializer with a subgrouping for each command option.
125
126    Each subgrouping contains a string constant, that defines the
127    specification name, and a string constant that used by the GNU CC driver
128    program.
129
130    Do not define this macro if it does not need to do anything.  */
131
132 #define EXTRA_SPECS                                     \
133   { "cpp_cpu",          CPP_CPU_SPEC },                 \
134   { "asm_cpu",          ASM_CPU_SPEC },                 \
135   { "startfile_default", STARTFILE_DEFAULT_SPEC },  \
136   { "startfile_crtbegin", STARTFILE_CRTBEGIN_SPEC }
137    
138 #define ASM_CPU_SPEC "\
139                   %{V} %{v:%{!V:-V}}\
140                   %{g:\
141                   %{mno-legend:-Wc,off}\
142                   %{!mno-legend:-Wc,-fix-bb,-s\"%i\"\
143                   %{traditional:,-lc}\
144                   %{!traditional:,-lansi-c}\
145                   %{mstandard:,-keep-std}\
146                   %{mexternal-legend:,-external}\
147                   %{mocs-frame-position:,-ocs}}}"
148
149 #define CPP_CPU_SPEC "\
150                   %{!m88000:%{!m88100:%{m88110:-D__m88110__}}} \
151                   %{!m88000:%{!m88110:%{m88100:-D__m88100__}}} \
152                   %{!ansi:%{!traditional:-D__OPEN_NAMESPACE__}}"
153
154 #define STARTFILE_DEFAULT_SPEC "\
155                         %{!shared:%{!symbolic:%{pg:gcrt0.o%s} \
156                          %{!pg:%{p:/lib/mcrt0.o}%{!p:/lib/crt0.o}} \
157                           %(startfile_crtbegin) \
158                          %{svr4:%{ansi:/lib/values-Xc.o} \
159                           %{!ansi:%{traditional:/lib/values-Xt.o} \
160                            %{!traditional:/usr/lib/values-Xa.o}}}}}"
161
162 #define STARTFILE_CRTBEGIN_SPEC "\
163                          %{msvr3:m88kdgux.ld%s bcscrtbegin.o%s} \
164                          %{!msvr3:crtbegin.o%s}"
165
166 #undef  GPLUSPLUS_INCLUDE_DIR
167 #define GPLUSPLUS_INCLUDE_DIR "/usr/opt/g++/lib/g++-include"
168
169 /* Fast DG/UX version of profiler that does not require lots of
170    registers to be stored.  */
171 #undef  FUNCTION_PROFILER
172 #define FUNCTION_PROFILER(FILE, LABELNO) \
173   output_function_profiler (FILE, LABELNO, "gcc.mcount", 0)
174
175 /* Output the legend info for mxdb when debugging except if standard
176    debugging information only is explicitly requested.  */
177 #undef  ASM_FIRST_LINE
178 #define ASM_FIRST_LINE(FILE)                                            \
179   do {                                                                  \
180     if (TARGET_SVR4)                                                    \
181       {                                                                 \
182         if (TARGET_88110)                                               \
183           fprintf (FILE, "\t%s\t \"%s\"\n", VERSION_ASM_OP, "04.00");   \
184         else                                                            \
185           fprintf (FILE, "\t%s\t \"%s\"\n", VERSION_ASM_OP, "03.00");   \
186       }                                                                 \
187     if (write_symbols != NO_DEBUG && !TARGET_NOLEGEND)                  \
188       {                                                                 \
189         fprintf (FILE, ";legend_info -fix-bb -h\"gcc-%s\" -s\"%s\"",    \
190                  VERSION_STRING, main_input_filename);                  \
191         fputs (flag_traditional ? " -lc" : " -lansi-c", FILE);          \
192         if (TARGET_STANDARD)                                            \
193           fputs (" -keep-std", FILE);                                   \
194         if (TARGET_EXTERNAL_LEGEND)                                     \
195           fputs (" -external", FILE);                                   \
196         if (TARGET_OCS_FRAME_POSITION)                                  \
197           fputs (" -ocs", FILE);                                        \
198         fputc ('\n', FILE);                                             \
199       }                                                                 \
200   } while (0)
201
202 /* Override svr4.h.  */
203 #undef PTRDIFF_TYPE
204 #undef WCHAR_TYPE
205 #undef WCHAR_TYPE_SIZE
206
207 /* Override svr4.h and m88k.h except when compiling crtstuff.c.  These must
208    be constant strings when compiling crtstuff.c.  Otherwise, respect the
209    -mversion-STRING option used.  */
210 #undef INIT_SECTION_PREAMBLE
211 #undef INIT_SECTION_ASM_OP
212 #undef FINI_SECTION_ASM_OP
213 #undef CTORS_SECTION_ASM_OP
214 #undef DTORS_SECTION_ASM_OP
215
216 #if defined (CRT_BEGIN) || defined (CRT_END) || defined (L__main)
217 /* routines to invoke global constructors and destructors are always COFF 
218    to enable linking mixed COFF and ELF objects */
219 #define FINI_SECTION_ASM_OP ("section  .fini,\"x\"")
220 #ifndef BCS
221 #define INIT_SECTION_PREAMBLE asm ("\taddu\tr31,r31,0x20")
222 #endif
223 #undef  INIT_SECTION_ASM_OP
224 #define INIT_SECTION_ASM_OP ("section\t .init,\"x\"")
225 #undef  CTORS_SECTION_ASM_OP
226 #define CTORS_SECTION_ASM_OP ("section\t .ctors,\"d\"")
227 #undef  DTORS_SECTION_ASM_OP
228 #define DTORS_SECTION_ASM_OP ("section\t .dtors,\"d\"")
229 #undef OBJECT_FORMAT_ELF
230 #else
231 #undef        INIT_SECTION_ASM_OP
232 #define INIT_SECTION_ASM_OP (TARGET_SVR4                      \
233                            ? "section\t .init,\"xa\""         \
234                            : "section\t .init,\"x\"")
235 #undef        CTORS_SECTION_ASM_OP
236 #define CTORS_SECTION_ASM_OP (TARGET_SVR4                     \
237                             ? "section\t .ctors,\"aw\""       \
238                             : "section\t .ctors,\"d\"")
239 #undef        DTORS_SECTION_ASM_OP
240 #define DTORS_SECTION_ASM_OP (TARGET_SVR4                     \
241                             ? "section\t .dtors,\"aw\""       \
242                             : "section\t .dtors,\"d\"")
243 #endif /* crtstuff.c */
244
245 /* The lists of global object constructors and global destructors are always
246    placed in the .ctors/.dtors sections.  This requires the use of a link
247    script if the COFF linker is used, but otherwise COFF and ELF objects
248    can be intermixed.  A COFF object will pad the section to 16 bytes with
249    zeros; and ELF object will not contain padding.  We deal with this by
250    putting a -1 marker at the begin and end of the list and ignoring zero
251    entries.  */
252
253 /* Mark the end of the .ctors/.dtors sections with a -1.  */
254
255 #define CTOR_LIST_BEGIN                 \
256 asm (CTORS_SECTION_ASM_OP);             \
257 func_ptr __CTOR_LIST__[1] = { (func_ptr) (-1) }
258
259 #define CTOR_LIST_END                   \
260 asm (CTORS_SECTION_ASM_OP);             \
261 func_ptr __CTOR_END__[1] = { (func_ptr) (-1) }
262
263 #define DTOR_LIST_BEGIN                 \
264 asm (DTORS_SECTION_ASM_OP);             \
265 func_ptr __DTOR_LIST__[1] = { (func_ptr) (-1) }
266
267 #define DTOR_LIST_END                   \
268 asm (DTORS_SECTION_ASM_OP);             \
269 func_ptr __DTOR_END__[1] = { (func_ptr) (-1) }
270
271 /* Walk the list ignoring NULL entries till we hit the terminating -1.  */
272 #define DO_GLOBAL_CTORS_BODY                            \
273   do {                                                  \
274     int i;                                              \
275     for (i=1;(int)(__CTOR_LIST__[i]) != -1; i++)        \
276       if (((int *)__CTOR_LIST__)[i] != 0)               \
277         __CTOR_LIST__[i] ();                            \
278   } while (0)                                   
279
280 /* Walk the list looking for the terminating -1 that marks the end.
281    Go backward and ignore any NULL entries.  */
282 #define DO_GLOBAL_DTORS_BODY                            \
283   do {                                                  \
284     int i;                                              \
285     for (i=1;(int)(__DTOR_LIST__[i]) != -1; i++);       \
286     for (i-=1;(int)(__DTOR_LIST__[i]) != -1; i--)       \
287       if (((int *)__DTOR_LIST__)[i] != 0)               \
288         __DTOR_LIST__[i] ();                            \
289   } while (0)                                   
290
291 /* The maximum alignment which the object file format can support.
292    page alignment would seem to be enough */
293 #undef MAX_OFILE_ALIGNMENT
294 #define MAX_OFILE_ALIGNMENT 0x1000
295
296 /* Must use data section for relocatable constants when pic.  */
297 #undef SELECT_RTX_SECTION
298 #define SELECT_RTX_SECTION(MODE,RTX)            \
299 {                                               \
300   if (flag_pic && symbolic_operand (RTX))       \
301     data_section ();                            \
302   else                                          \
303     const_section ();                           \
304 }