1 /* Definitions of target machine for GNU compiler, for DEC Alpha
3 Copyright (C) 1995, 1996, 1999 Free Software Foundation, Inc.
5 Donn Terry, Softway Systems, Inc.
7 Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
9 This file is part of GNU CC.
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)
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.
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. */
26 /* cpp handles __STDC__ */
27 /* The three "Alpha" defines on the first such line are from the CLAXP spec */
29 #define CPP_PREDEFINES " \
32 -D__Alpha_AXP -D_M_ALPHA -D_ALPHA_ \
33 -D__alpha -D__alpha__\
36 -Asystem(unix) -Asystem(interix) -Asystem(interix) -Acpu(alpha) -Amachine(alpha)"
38 #undef CPP_SUBTARGET_SPEC
39 #define CPP_SUBTARGET_SPEC "\
41 %{posix:-D_POSIX_SOURCE} \
42 -idirafter %$INTERIX_ROOT/usr/include"
45 #define TARGET_VERSION fprintf (stderr, " (alpha Interix)");
47 /* alpha.h sets this, but it doesn't apply to us */
48 #undef OBJECT_FORMAT_ECOFF
49 #undef OBJECT_FORMAT_COFF
53 /* MD_STARTFILE_PREFIX */
55 /* ASM_OUTPUT_LOOP_ALIGN; ASM_OUTPUT_ALIGN_CODE */
57 /* Codegen macro overrides for NT internal conventions */
59 /* the below are ecoff specific... we don't need them, so
60 undef them (they'll get a default later) */
62 #undef PUT_SDB_BLOCK_START
63 #undef PUT_SDB_BLOCK_END
65 /* the following are OSF linker (not gld) specific... we don't want them */
66 #undef HAS_INIT_SECTION
71 /* The following are needed for C++, but also needed for profiling */
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. */
81 #define USE_CONST_SECTION 1
83 #define CONST_SECTION_ASM_OP ".rdata"
85 /* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
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.) */
100 #define CTORS_SECTION_ASM_OP ".ctors"
101 #define DTORS_SECTION_ASM_OP ".dtors"
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. */
108 #undef EXTRA_SECTIONS
109 #define EXTRA_SECTIONS in_const, in_ctors, in_dtors
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. */
115 #undef EXTRA_SECTION_FUNCTIONS
116 #define EXTRA_SECTION_FUNCTIONS \
117 CONST_SECTION_FUNCTION \
118 CTORS_SECTION_FUNCTION \
119 DTORS_SECTION_FUNCTION
121 #undef READONLY_DATA_SECTION
122 #define READONLY_DATA_SECTION() const_section ()
124 extern void text_section ();
126 #define CONST_SECTION_FUNCTION \
130 if (!USE_CONST_SECTION) \
132 else if (in_section != in_const) \
134 fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \
135 in_section = in_const; \
139 #define CTORS_SECTION_FUNCTION \
143 if (in_section != in_ctors) \
145 fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
146 in_section = in_ctors; \
150 #define DTORS_SECTION_FUNCTION \
154 if (in_section != in_dtors) \
156 fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
157 in_section = in_dtors; \
161 #define INT_ASM_OP ".long"
163 /* A C statement (sans semicolon) to output an element in the table of
164 global constructors. */
165 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
168 fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
169 assemble_name (FILE, NAME); \
170 fprintf (FILE, "\n"); \
173 /* A C statement (sans semicolon) to output an element in the table of
174 global destructors. */
175 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
178 fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
179 assemble_name (FILE, NAME); \
180 fprintf (FILE, "\n"); \
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
187 #define SET_ASM_OP ".set"
188 /* Output a definition (implements alias) */
189 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
192 fprintf ((FILE), "\t"); \
193 assemble_name (FILE, LABEL1); \
194 fprintf (FILE, "="); \
195 assemble_name (FILE, LABEL2); \
196 fprintf (FILE, "\n"); \
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
205 #define HOST_PTR_PRINTF "%p"
206 #define HOST_PTR_AS_INT unsigned long
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)
212 /* DWARF2 Unwinding doesn't work with exception handling yet. */
213 #undef DWARF2_UNWIND_INFO
215 /* Don't assume anything about the header files. */
216 #define NO_IMPLICIT_EXTERN_C
218 /* The definition of this macro implies that there are cases where
219 a scalar value cannot be returned in registers.
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). */
225 #undef RETURN_IN_MEMORY
226 #define RETURN_IN_MEMORY(TYPE) \
227 (TREE_CODE (TYPE) == ARRAY_TYPE || int_size_in_bytes(TYPE) > 8)
229 #define ASM_LOAD_ADDR(loc, reg) " lda " #reg "," #loc "\n"
231 #undef ASM_FILE_START
232 #define ASM_FILE_START(FILE) \
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); \
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) \
247 assemble_name (FILE, SY); \
249 assemble_name (FILE, HI); \
251 assemble_name (FILE, LO); \