OSDN Git Service

* config/alpha/osf5.h (TARGET_LD_BUGGY_LDGP): New.
[pf3gnuchains/gcc-fork.git] / 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, 2000 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 -Acpu=alpha -Amachine=alpha"
37
38 #undef CPP_SUBTARGET_SPEC
39 #define CPP_SUBTARGET_SPEC "\
40 -remap \
41 %{posix:-D_POSIX_SOURCE} \
42 -isystem %$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 needed for C++, but also needed for profiling */
66
67 /* Support const sections and the ctors and dtors sections for g++.
68    Note that there appears to be two different ways to support const
69    sections at the moment.  You can either #define the symbol
70    READONLY_DATA_SECTION (giving it some code which switches to the
71    readonly data section) or else you can #define the symbols
72    EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and
73    SELECT_RTX_SECTION.  We do both here just to be on the safe side.  */
74
75 #define USE_CONST_SECTION       1
76
77 #define CONST_SECTION_ASM_OP    "\t.rdata"
78
79 /* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
80
81    Note that we want to give these sections the SHF_WRITE attribute
82    because these sections will actually contain data (i.e. tables of
83    addresses of functions in the current root executable or shared library
84    file) and, in the case of a shared library, the relocatable addresses
85    will have to be properly resolved/relocated (and then written into) by
86    the dynamic linker when it actually attaches the given shared library
87    to the executing process.  (Note that on SVR4, you may wish to use the
88    `-z text' option to the ELF linker, when building a shared library, as
89    an additional check that you are doing everything right.  But if you do
90    use the `-z text' option when building a shared library, you will get
91    errors unless the .ctors and .dtors sections are marked as writable
92    via the SHF_WRITE attribute.)  */
93
94 #define CTORS_SECTION_ASM_OP    "\t.ctors"
95 #define DTORS_SECTION_ASM_OP    "\t.dtors"
96
97 /* A default list of other sections which we might be "in" at any given
98    time.  For targets that use additional sections (e.g. .tdesc) you
99    should override this definition in the target-specific file which
100    includes this file.  */
101
102 #undef EXTRA_SECTIONS
103 #define EXTRA_SECTIONS in_const, in_ctors, in_dtors
104
105 /* A default list of extra section function definitions.  For targets
106    that use additional sections (e.g. .tdesc) you should override this
107    definition in the target-specific file which includes this file.  */
108
109 #undef EXTRA_SECTION_FUNCTIONS
110 #define EXTRA_SECTION_FUNCTIONS                                         \
111   CONST_SECTION_FUNCTION                                                \
112   CTORS_SECTION_FUNCTION                                                \
113   DTORS_SECTION_FUNCTION
114
115 #undef READONLY_DATA_SECTION
116 #define READONLY_DATA_SECTION() const_section ()
117
118 #define CONST_SECTION_FUNCTION                                          \
119 void                                                                    \
120 const_section ()                                                        \
121 {                                                                       \
122   if (!USE_CONST_SECTION)                                               \
123     text_section();                                                     \
124   else if (in_section != in_const)                                      \
125     {                                                                   \
126       fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP);             \
127       in_section = in_const;                                            \
128     }                                                                   \
129 }
130
131 #define CTORS_SECTION_FUNCTION                                          \
132 void                                                                    \
133 ctors_section ()                                                        \
134 {                                                                       \
135   if (in_section != in_ctors)                                           \
136     {                                                                   \
137       fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP);             \
138       in_section = in_ctors;                                            \
139     }                                                                   \
140 }
141
142 #define DTORS_SECTION_FUNCTION                                          \
143 void                                                                    \
144 dtors_section ()                                                        \
145 {                                                                       \
146   if (in_section != in_dtors)                                           \
147     {                                                                   \
148       fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP);             \
149       in_section = in_dtors;                                            \
150     }                                                                   \
151 }
152
153 #define INT_ASM_OP              "\t.long\t"
154
155 /* A C statement (sans semicolon) to output an element in the table of
156    global constructors.  */
157 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)                               \
158   do {                                                                  \
159     ctors_section ();                                                   \
160     fprintf (FILE, "%s", INT_ASM_OP);                                   \
161     assemble_name (FILE, NAME);                                         \
162     fprintf (FILE, "\n");                                               \
163   } while (0)
164
165 /* A C statement (sans semicolon) to output an element in the table of
166    global destructors.  */
167 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)                                \
168   do {                                                                  \
169     dtors_section ();                                                   \
170     fprintf (FILE, "%s", INT_ASM_OP);                                   \
171     assemble_name (FILE, NAME);                                         \
172     fprintf (FILE, "\n");                                               \
173   } while (0)
174
175 /* The linker will take care of this, and having them causes problems with
176    ld -r (specifically -rU). */
177 #define CTOR_LISTS_DEFINED_EXTERNALLY 1
178
179 #define SET_ASM_OP      "\t.set\t"
180 /* Output a definition (implements alias) */
181 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                              \
182 do                                                                      \
183 {                                                                       \
184     fprintf ((FILE), "\t");                                             \
185     assemble_name (FILE, LABEL1);                                       \
186     fprintf (FILE, "=");                                                \
187     assemble_name (FILE, LABEL2);                                       \
188     fprintf (FILE, "\n");                                               \
189     }                                                                   \
190 while (0)
191
192 /* We use the defaults, so undef the null definitions */
193 #undef PUT_SDB_FUNCTION_START
194 #undef PUT_SDB_FUNCTION_END
195 #undef PUT_SDB_EPILOGUE_END
196
197 #define HOST_PTR_PRINTF "%p"
198 #define HOST_PTR_AS_INT unsigned long
199
200 #define PCC_BITFIELD_TYPE_MATTERS 1
201 #define PCC_BITFIELD_TYPE_TEST TYPE_NATIVE(rec)
202 #define GROUP_BITFIELDS_BY_ALIGN TYPE_NATIVE(rec)
203
204 /* DWARF2 Unwinding doesn't work with exception handling yet. */
205 #undef DWARF2_UNWIND_INFO
206 #define DWARF2_UNWIND_INFO 0
207
208 /* Don't assume anything about the header files. */
209 #define NO_IMPLICIT_EXTERN_C
210
211 /* The definition of this macro implies that there are cases where
212    a scalar value cannot be returned in registers.
213
214    On NT (according to the spec) anything except strings/array that fits
215    in 64 bits is returned in the registers (this appears to differ from
216    the rest of the Alpha family). */
217
218 #undef RETURN_IN_MEMORY
219 #define RETURN_IN_MEMORY(TYPE) \
220   (TREE_CODE (TYPE) == ARRAY_TYPE || int_size_in_bytes(TYPE) > 8)
221
222 #define ASM_LOAD_ADDR(loc, reg)   "     lda " #reg "," #loc "\n" 
223
224 #undef ASM_FILE_START
225 #define ASM_FILE_START(FILE)                                    \
226 {                                                               \
227   alpha_write_verstamp (FILE);                                  \
228   fprintf (FILE, "\t.set noreorder\n");                         \
229   fprintf (FILE, "\t.set volatile\n");                          \
230   fprintf (FILE, "\t.set noat\n");                              \
231   fprintf (FILE, "\t.globl\t__fltused\n");                      \
232   ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename);       \
233 }
234
235 /* The current Interix assembler (consistent with the DEC documentation)
236    uses a=b NOT .set a,b; .set is for assembler options. */
237 #undef ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL
238 #define ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL(FILE, SY, HI, LO)     \
239  do {                                                                   \
240   assemble_name (FILE, SY);                                             \
241   fputc ('=', FILE);                                                    \
242   assemble_name (FILE, HI);                                             \
243   fputc ('-', FILE);                                                    \
244   assemble_name (FILE, LO);                                             \
245  } while (0)