OSDN Git Service

(GO_IF_LEGITIMATE_ADDRESS) Reject invalid PIC addresses.
[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, 1989, 1990, 1991 Free Software Foundation, Inc.
4    Contributed by Michael Tiemann (tiemann@mcc.com)
5    Enhanced by Michael Meissner (meissner@osf.org)
6    Version 2 port by Tom Wood (twood@pets.sps.mot.com)
7
8 This file is part of GNU CC.
9
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.
14
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.
19
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, 675 Mass Ave, Cambridge, MA 02139, 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.6 $"
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_LEGEND             0x20000000 /* Retain legend information */
47 #define MASK_EXTERNAL_LEGEND    0x10000000 /* Make external legends */
48
49 #define TARGET_STANDARD           (target_flags & MASK_STANDARD)
50 #define TARGET_LEGEND             (target_flags & MASK_LEGEND)
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_LEGEND }, \
57     { "external-legend",                 MASK_EXTERNAL_LEGEND }, \
58     /* the following is used only in the *_SPEC's */ \
59     { "keep-coff",                       0 },
60
61 /* Default switches */
62 #undef  TARGET_DEFAULT
63 #define TARGET_DEFAULT  (MASK_CHECK_ZERO_DIV     | \
64                          MASK_OCS_DEBUG_INFO     | \
65                          MASK_OCS_FRAME_POSITION)
66 #undef  CPU_DEFAULT
67 #define CPU_DEFAULT MASK_88000
68
69 /* Macros to be automatically defined.  __svr4__ is our extension.
70    __CLASSIFY_TYPE__ is used in the <varargs.h> and <stdarg.h> header
71    files with DG/UX revision 5.40 and later.  This allows GNU CC to
72    operate without installing the header files.  */
73
74 #undef  CPP_PREDEFINES
75 #define CPP_PREDEFINES "-Dm88000 -Dm88k -Dunix -DDGUX -D__CLASSIFY_TYPE__=2\
76    -D__svr4__ -Asystem(unix) -Acpu(m88k) -Amachine(m88k)"
77
78 /* If -m88100 is in effect, add -Dm88100; similarly for -m88110.
79    Here, the CPU_DEFAULT is assumed to be -m88000.  If not -ansi,
80    -traditional, or restricting include files to one specific source
81    target, specify full DG/UX features.  */
82 #undef  CPP_SPEC
83 #define CPP_SPEC "%{!m88000:%{!m88100:%{m88110:-D__m88110__}}} \
84                   %{!m88000:%{!m88110:%{m88100:-D__m88100__}}} \
85                   %{!ansi:%{!traditional:-D__OPEN_NAMESPACE__}}"
86
87 /* Assembler support (-V, silicon filter, legends for mxdb).  */
88 #undef  ASM_SPEC
89 #define ASM_SPEC "\
90 %{V} %{v:%{!V:-V}} %{pipe:%{!.s: - }\
91 %{msvr4:%{mversion-03.00:-KV3}%{!mversion-03.00:%{mversion-*:-KV%*}}}}\
92 %{!mlegend:%{mstandard:-Wc,off}}\
93 %{mlegend:-Wc,-fix-bb,-h\"gcc-" VERSION_INFO2 "\",-s\"%i\"\
94 %{traditional:,-lc}%{!traditional:,-lansi-c}\
95 %{mstandard:,-keep-std}\
96 %{mkeep-coff:,-keep-coff}\
97 %{mexternal-legend:,-external}\
98 %{mocs-frame-position:,-ocs}}"
99
100 /* Override svr4.h.  */
101 #undef  ASM_FINAL_SPEC
102 #undef  STARTFILE_SPEC
103
104 /* Linker and library spec's.
105    -static, -shared, -symbolic, -h* and -z* access AT&T V.4 link options.
106    -svr4 instructs gcc to place /usr/lib/values-X[cat].o on link the line.
107    The absense of -msvr4 indicates linking done in a COFF environment and
108    adds the link script to the link line.  In all environments, the first
109    and last objects are crtbegin.o and crtend.o.
110    When the -G link option is used (-shared and -symbolic) a final link is
111    not being done.  */
112 #undef  LIB_SPEC
113 #define LIB_SPEC "%{msvr4:%{!shared:-lstaticdgc}} %{!shared:%{!symbolic:-lc}} crtend.o%s"
114 #undef  LINK_SPEC
115 #define LINK_SPEC "%{z*} %{h*} %{V} %{v:%{!V:-V}} \
116                    %{static:-dn -Bstatic} \
117                    %{shared:-G -dy} \
118                    %{symbolic:-Bsymbolic -G -dy} \
119                    %{pg:-L/usr/lib/libp}%{p:-L/usr/lib/libp}"
120 #undef  STARTFILE_SPEC
121 #define STARTFILE_SPEC "%{!shared:%{!symbolic:%{pg:gcrt0.o%s} \
122                          %{!pg:%{p:/lib/mcrt0.o}%{!p:/lib/crt0.o}} \
123                          %{!msvr4:m88kdgux.ld%s} crtbegin.o%s \
124                          %{svr4:%{ansi:/lib/values-Xc.o} \
125                           %{!ansi:%{traditional:/lib/values-Xt.o} \
126                            %{!traditional:/usr/lib/values-Xa.o}}}}}"
127
128 #undef  GPLUSPLUS_INCLUDE_DIR
129 #define GPLUSPLUS_INCLUDE_DIR "/usr/opt/g++/lib/g++-include"
130
131 /* Fast DG/UX version of profiler that does not require lots of
132    registers to be stored.  */
133 #undef  FUNCTION_PROFILER
134 #define FUNCTION_PROFILER(FILE, LABELNO) \
135   output_function_profiler (FILE, LABELNO, "gcc.mcount", 0)
136
137 /* Output the legend info for mxdb when debugging except if standard
138    debugging information only is explicitly requested.  */
139 #undef  ASM_FIRST_LINE
140 #define ASM_FIRST_LINE(FILE)                                            \
141   do {                                                                  \
142     if (TARGET_SVR4)                                                    \
143       {                                                                 \
144         if (TARGET_88110)                                               \
145           fprintf (FILE, "\t%s\t \"%s\"\n", VERSION_ASM_OP, "04.00");   \
146         else                                                            \
147           fprintf (FILE, "\t%s\t \"%s\"\n", VERSION_ASM_OP, "03.00");   \
148       }                                                                 \
149     if (write_symbols != NO_DEBUG                                       \
150         && ! (TARGET_STANDARD && ! TARGET_LEGEND))                      \
151       {                                                                 \
152         fprintf (FILE, ";legend_info -fix-bb -h\"gcc-%s\" -s\"%s\"",    \
153                  VERSION_STRING, main_input_filename);                  \
154         fputs (flag_traditional ? " -lc" : " -lansi-c", FILE);          \
155         if (TARGET_STANDARD)                                            \
156           fputs (" -keep-std", FILE);                                   \
157         if (TARGET_EXTERNAL_LEGEND)                                     \
158           fputs (" -external", FILE);                                   \
159         if (TARGET_OCS_FRAME_POSITION)                                  \
160           fputs (" -ocs", FILE);                                        \
161         fputc ('\n', FILE);                                             \
162       }                                                                 \
163   } while (0)
164
165 /* Override svr4.h.  */
166 #undef PTRDIFF_TYPE
167 #undef WCHAR_TYPE
168 #undef WCHAR_TYPE_SIZE
169
170 /* Override svr4.h and m88k.h except when compiling crtstuff.c.  These must
171    be constant strings when compiling crtstuff.c.  Otherwise, respect the
172    -mversion-STRING option used.  */
173 #if !defined (CRT_BEGIN) && !defined (CRT_END)
174 #undef  INIT_SECTION_ASM_OP
175 #define INIT_SECTION_ASM_OP (TARGET_SVR4                        \
176                              ? "section\t .init,\"xa\""         \
177                              : "section\t .init,\"x\"")
178 #undef  CTORS_SECTION_ASM_OP
179 #define CTORS_SECTION_ASM_OP (TARGET_SVR4                       \
180                               ? "section\t .ctors,\"aw\""       \
181                               : "section\t .ctors,\"d\"")
182 #undef  DTORS_SECTION_ASM_OP
183 #define DTORS_SECTION_ASM_OP (TARGET_SVR4                       \
184                               ? "section\t .dtors,\"aw\""       \
185                               : "section\t .dtors,\"d\"")
186 #endif /* crtstuff.c */
187
188 /* The lists of global object constructors and global destructors are always
189    placed in the .ctors/.dtors sections.  This requires the use of a link
190    script if the COFF linker is used, but otherwise COFF and ELF objects
191    can be intermixed.  A COFF object will pad the section to 16 bytes with
192    zeros; and ELF object will not contain padding.  We deal with this by
193    putting a -1 marker at the begin and end of the list and ignoring zero
194    entries.  */
195
196 /* Mark the end of the .ctors/.dtors sections with a -1.  */
197 #define CTOR_LIST_END                   \
198 asm (CTORS_SECTION_ASM_OP);             \
199 func_ptr __CTOR_END__[1] = { (func_ptr) (-1) }
200
201 #define DTOR_LIST_END                   \
202 asm (DTORS_SECTION_ASM_OP);             \
203 func_ptr __DTOR_END__[1] = { (func_ptr) (-1) }
204
205 /* Walk the list ignoring NULL entries till we hit the terminating -1.  */
206 #define DO_GLOBAL_CTORS_BODY                            \
207   do {                                                  \
208     int i;                                              \
209     for (i=1;(int)(__CTOR_LIST__[i]) != -1; i++)        \
210       if (((int *)__CTOR_LIST__)[i] != 0)               \
211         __CTOR_LIST__[i] ();                            \
212   } while (0)                                   
213
214 /* Walk the list looking for the terminating -1 that marks the end.
215    Go backward and ignore any NULL entries.  */
216 #define DO_GLOBAL_DTORS_BODY                            \
217   do {                                                  \
218     int i;                                              \
219     for (i=1;(int)(__DTOR_LIST__[i]) != -1; i++);       \
220     for (i-=1;(int)(__DTOR_LIST__[i]) != -1; i--)       \
221       if (((int *)__DTOR_LIST__)[i] != 0)               \
222         __DTOR_LIST__[i] ();                            \
223   } while (0)