Initial import from FreeBSD RELENG_4:
[games.git] / contrib / gcc / config / alpha / alpha-interix.h
1 /* Definitions of target machine for GNU compiler, for DEC Alpha
2    running Windows/NT.
3    Copyright (C) 1995, 1996, 1999 Free Software Foundation, Inc.
4
5    Donn Terry, Softway Systems, Inc.
6    From code
7        Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
8
9 This file is part of GNU CC.
10
11 GNU CC is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2, or (at your option)
14 any later version.
15
16 GNU CC is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with GNU CC; see the file COPYING.  If not, write to
23 the Free Software Foundation, 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA.  */
25
26 /* cpp handles __STDC__ */
27 /* The three "Alpha" defines on the first such line are from the CLAXP spec */
28 #undef CPP_PREDEFINES
29 #define CPP_PREDEFINES " \
30   -D__INTERIX \
31   -D__OPENNT \
32   -D__Alpha_AXP -D_M_ALPHA -D_ALPHA_  \
33   -D__alpha -D__alpha__\
34   -D__stdcall= \
35   -D__cdecl= \
36   -Asystem(unix) -Asystem(interix) -Asystem(interix) -Acpu(alpha) -Amachine(alpha)"
37
38 #undef CPP_SUBTARGET_SPEC
39 #define CPP_SUBTARGET_SPEC "\
40 -remap \
41 %{posix:-D_POSIX_SOURCE} \
42 -idirafter %$INTERIX_ROOT/usr/include"
43
44 #undef TARGET_VERSION
45 #define TARGET_VERSION fprintf (stderr, " (alpha Interix)");
46
47 /* alpha.h sets this, but it doesn't apply to us */
48 #undef OBJECT_FORMAT_ECOFF
49 #undef OBJECT_FORMAT_COFF
50
51 /* LINK_SPEC */
52
53 /* MD_STARTFILE_PREFIX */
54
55 /* ASM_OUTPUT_LOOP_ALIGN; ASM_OUTPUT_ALIGN_CODE */
56
57 /* Codegen macro overrides for NT internal conventions */
58
59 /* the below are ecoff specific... we don't need them, so
60    undef them (they'll get a default later) */
61
62 #undef PUT_SDB_BLOCK_START
63 #undef PUT_SDB_BLOCK_END
64
65 /* the following are OSF linker (not gld) specific... we don't want them */
66 #undef HAS_INIT_SECTION
67 #undef LD_INIT_SWITCH
68 #undef LD_FINI_SWITCH
69
70
71 /* The following are needed for C++, but also needed for profiling */
72
73 /* Support const sections and the ctors and dtors sections for g++.
74    Note that there appears to be two different ways to support const
75    sections at the moment.  You can either #define the symbol
76    READONLY_DATA_SECTION (giving it some code which switches to the
77    readonly data section) or else you can #define the symbols
78    EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and
79    SELECT_RTX_SECTION.  We do both here just to be on the safe side.  */
80
81 #define USE_CONST_SECTION       1
82
83 #define CONST_SECTION_ASM_OP    ".rdata"
84
85 /* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
86
87    Note that we want to give these sections the SHF_WRITE attribute
88    because these sections will actually contain data (i.e. tables of
89    addresses of functions in the current root executable or shared library
90    file) and, in the case of a shared library, the relocatable addresses
91    will have to be properly resolved/relocated (and then written into) by
92    the dynamic linker when it actually attaches the given shared library
93    to the executing process.  (Note that on SVR4, you may wish to use the
94    `-z text' option to the ELF linker, when building a shared library, as
95    an additional check that you are doing everything right.  But if you do
96    use the `-z text' option when building a shared library, you will get
97    errors unless the .ctors and .dtors sections are marked as writable
98    via the SHF_WRITE attribute.)  */
99
100 #define CTORS_SECTION_ASM_OP    ".ctors"
101 #define DTORS_SECTION_ASM_OP    ".dtors"
102
103 /* A default list of other sections which we might be "in" at any given
104    time.  For targets that use additional sections (e.g. .tdesc) you
105    should override this definition in the target-specific file which
106    includes this file.  */
107
108 #undef EXTRA_SECTIONS
109 #define EXTRA_SECTIONS in_const, in_ctors, in_dtors
110
111 /* A default list of extra section function definitions.  For targets
112    that use additional sections (e.g. .tdesc) you should override this
113    definition in the target-specific file which includes this file.  */
114
115 #undef EXTRA_SECTION_FUNCTIONS
116 #define EXTRA_SECTION_FUNCTIONS                                         \
117   CONST_SECTION_FUNCTION                                                \
118   CTORS_SECTION_FUNCTION                                                \
119   DTORS_SECTION_FUNCTION
120
121 #undef READONLY_DATA_SECTION
122 #define READONLY_DATA_SECTION() const_section ()
123
124 extern void text_section ();
125
126 #define CONST_SECTION_FUNCTION                                          \
127 void                                                                    \
128 const_section ()                                                        \
129 {                                                                       \
130   if (!USE_CONST_SECTION)                                               \
131     text_section();                                                     \
132   else if (in_section != in_const)                                      \
133     {                                                                   \
134       fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP);             \
135       in_section = in_const;                                            \
136     }                                                                   \
137 }
138
139 #define CTORS_SECTION_FUNCTION                                          \
140 void                                                                    \
141 ctors_section ()                                                        \
142 {                                                                       \
143   if (in_section != in_ctors)                                           \
144     {                                                                   \
145       fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP);             \
146       in_section = in_ctors;                                            \
147     }                                                                   \
148 }
149
150 #define DTORS_SECTION_FUNCTION                                          \
151 void                                                                    \
152 dtors_section ()                                                        \
153 {                                                                       \
154   if (in_section != in_dtors)                                           \
155     {                                                                   \
156       fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP);             \
157       in_section = in_dtors;                                            \
158     }                                                                   \
159 }
160
161 #define INT_ASM_OP              ".long"
162
163 /* A C statement (sans semicolon) to output an element in the table of
164    global constructors.  */
165 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)                               \
166   do {                                                                  \
167     ctors_section ();                                                   \
168     fprintf (FILE, "\t%s\t ", INT_ASM_OP);                              \
169     assemble_name (FILE, NAME);                                         \
170     fprintf (FILE, "\n");                                               \
171   } while (0)
172
173 /* A C statement (sans semicolon) to output an element in the table of
174    global destructors.  */
175 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)                                \
176   do {                                                                  \
177     dtors_section ();                                                   \
178     fprintf (FILE, "\t%s\t ", INT_ASM_OP);                              \
179     assemble_name (FILE, NAME);                                         \
180     fprintf (FILE, "\n");                                               \
181   } while (0)
182
183 /* The linker will take care of this, and having them causes problems with
184    ld -r (specifically -rU). */
185 #define CTOR_LISTS_DEFINED_EXTERNALLY 1
186
187 #define SET_ASM_OP      ".set"
188 /* Output a definition (implements alias) */
189 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                              \
190 do                                                                      \
191 {                                                                       \
192     fprintf ((FILE), "\t");                                             \
193     assemble_name (FILE, LABEL1);                                       \
194     fprintf (FILE, "=");                                                \
195     assemble_name (FILE, LABEL2);                                       \
196     fprintf (FILE, "\n");                                               \
197     }                                                                   \
198 while (0)
199
200 /* We use the defaults, so undef the null definitions */
201 #undef PUT_SDB_FUNCTION_START
202 #undef PUT_SDB_FUNCTION_END
203 #undef PUT_SDB_EPILOGUE_END
204
205 #define HOST_PTR_PRINTF "%p"
206 #define HOST_PTR_AS_INT unsigned long
207
208 #define PCC_BITFIELD_TYPE_MATTERS 1
209 #define PCC_BITFIELD_TYPE_TEST TYPE_NATIVE(rec)
210 #define GROUP_BITFIELDS_BY_ALIGN TYPE_NATIVE(rec)
211
212 /* DWARF2 Unwinding doesn't work with exception handling yet. */
213 #undef DWARF2_UNWIND_INFO
214
215 /* Don't assume anything about the header files. */
216 #define NO_IMPLICIT_EXTERN_C
217
218 /* The definition of this macro implies that there are cases where
219    a scalar value cannot be returned in registers.
220
221    On NT (according to the spec) anything except strings/array that fits
222    in 64 bits is returned in the registers (this appears to differ from
223    the rest of the Alpha family). */
224
225 #undef RETURN_IN_MEMORY
226 #define RETURN_IN_MEMORY(TYPE) \
227   (TREE_CODE (TYPE) == ARRAY_TYPE || int_size_in_bytes(TYPE) > 8)
228
229 #define ASM_LOAD_ADDR(loc, reg)   "     lda " #reg "," #loc "\n" 
230
231 #undef ASM_FILE_START
232 #define ASM_FILE_START(FILE)                                    \
233 {                                                               \
234   alpha_write_verstamp (FILE);                                  \
235   fprintf (FILE, "\t.set noreorder\n");                         \
236   fprintf (FILE, "\t.set volatile\n");                          \
237   fprintf (FILE, "\t.set noat\n");                              \
238   fprintf (FILE, "\t.globl\t__fltused\n");                      \
239   ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename);       \
240 }
241
242 /* The current Interix assembler (consistent with the DEC documentation)
243    uses a=b NOT .set a,b; .set is for assembler options. */
244 #undef ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL
245 #define ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL(FILE, SY, HI, LO)     \
246  do {                                                                   \
247   assemble_name (FILE, SY);                                             \
248   fputc ('=', FILE);                                                    \
249   assemble_name (FILE, HI);                                             \
250   fputc ('-', FILE);                                                    \
251   assemble_name (FILE, LO);                                             \
252  } while (0)