1 /* Definitions for DEC AXP Alpha running FreeBSD using the ELF format
2 Copyright (C) 2000 Free Software Foundation, Inc.
3 Contributed by David O'Brien <obrien@FreeBSD.org>
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
21 /* This is used on Alpha platforms that use the ELF format.
22 This was taken from the NetBSD configuration, and modified
23 for FreeBSD/Alpha by Hidetoshi Shimokawa <simokawa@FreeBSD.ORG> */
25 /* $FreeBSD: src/contrib/gcc/config/alpha/freebsd.h,v 1.9.2.3 2002/06/20 23:12:36 obrien Exp $ */
26 /* $DragonFly: src/contrib/gcc/config/alpha/Attic/freebsd.h,v 1.2 2003/06/17 04:24:01 dillon Exp $ */
29 /* Names to predefine in the preprocessor for this target machine.
30 XXX FreeBSD, by convention, shouldn't do __alpha, but lots of applications
31 expect it because that's what OSF/1 does. */
34 #define CPP_PREDEFINES \
35 "-D__alpha__ -D__alpha -Acpu(alpha) -Amachine(alpha)" \
39 #define LINK_SPEC "-m elf64alpha \
40 %{p:%e`-p' not supported; use `-pg' and gprof(1)} \
42 %{assert*} %{R*} %{rpath*} %{defsym*} \
43 %{shared:-Bshareable %{h*} %{soname*}} \
44 %{symbolic:-Bsymbolic} \
47 %{rdynamic:-export-dynamic} \
48 %{!dynamic-linker:-dynamic-linker /usr/libexec/ld-elf.so.1}} \
51 /* Provide an ASM_SPEC appropriate for a FreeBSD/Alpha target. This differs
52 from the generic FreeBSD ASM_SPEC in that no special handling of PIC is
53 necessary on the Alpha. */
56 #define ASM_SPEC " %| %{mcpu=*:-m%*}"
60 /* Provide a STARTFILE_SPEC for FreeBSD that is compatible with the
61 non-aout version used on i386. */
64 #define STARTFILE_SPEC \
65 "%{!shared: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}} \
66 crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
68 /* Provide a ENDFILE_SPEC appropriate for ELF. Here we tack on the
69 magical crtend.o file which provides part of the support for
70 getting C++ file-scope static object constructed before entering
71 `main', followed by a normal ELF "finalizer" file, `crtn.o'. */
74 #define ENDFILE_SPEC \
75 "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
78 /************************[ Target stuff ]***********************************/
80 /* Define the actual types of some ANSI-mandated types.
81 Needs to agree with <machine/ansi.h>. GCC defaults come from c-decl.c,
82 c-common.c, and config/<arch>/<arch>.h. */
84 /* alpha.h gets this wrong for FreeBSD. We use the GCC defaults instead. */
87 /* Handle cross-compilation on 32-bits machines (such as i386) for 64-bits
88 machines (Alpha in this case). */
91 #undef HOST_BITS_PER_LONG
92 #define HOST_BITS_PER_LONG 32
94 #define HOST_WIDE_INT long long
95 #undef HOST_BITS_PER_WIDE_INT
96 #define HOST_BITS_PER_WIDE_INT 64
99 /* This is the pseudo-op used to generate a 64-bit word of data with a
100 specific value in some section. */
103 #define INT_ASM_OP ".quad"
105 #undef TARGET_VERSION
106 #define TARGET_VERSION fprintf (stderr, " (FreeBSD/Alpha ELF)");
108 #define TARGET_AOUT (0)
109 #define TARGET_ELF (1)
110 #define TARGET_UNDERSCORES (0)
112 #undef OBJECT_FORMAT_COFF
115 #undef TARGET_DEFAULT
116 #define TARGET_DEFAULT (MASK_FP | MASK_FPREGS | MASK_GAS)
118 #undef HAS_INIT_SECTION
120 /* Show that we need a GP when profiling. */
121 #undef TARGET_PROFILING_NEEDS_GP
122 #define TARGET_PROFILING_NEEDS_GP
124 /* We always use gas here, so we don't worry about ECOFF assembler problems. */
129 /************************[ Assembler stuff ]********************************/
131 /* This is how to begin an assembly language file.
132 ELF also needs a .version. */
134 #undef ASM_FILE_START
135 #define ASM_FILE_START(FILE) \
137 alpha_write_verstamp (FILE); \
138 output_file_directive ((FILE), main_input_filename); \
139 fprintf ((FILE), "\t.version\t\"01.01\"\n"); \
140 fprintf ((FILE), "\t.set noat\n"); \
143 extern void output_file_directive ();
144 extern void alpha_output_lineno ();
146 #undef ASM_OUTPUT_SOURCE_LINE
147 #define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE) \
148 alpha_output_lineno ((STREAM), (LINE))
150 /* Switch into a generic section.
151 This is currently only used to support section attributes.
153 We make the section read-only and executable for a function decl,
154 read-only for a const data decl, and writable for a non-const data decl. */
155 #undef ASM_OUTPUT_SECTION_NAME
156 #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
157 fprintf ((FILE), ".section\t%s,\"%s\",@progbits\n", (NAME), \
158 (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \
159 (DECL) && DECL_READONLY_SECTION ((DECL), (RELOC)) ? "a" : "aw")
161 /* A C statement or statements to switch to the appropriate
162 section for output of DECL. DECL is either a `VAR_DECL' node
163 or a constant of some sort. RELOC indicates whether forming
164 the initial value of DECL requires link-time relocations. */
166 #undef SELECT_SECTION
167 #define SELECT_SECTION(DECL, RELOC) \
169 if (TREE_CODE (DECL) == STRING_CST) \
171 if (! flag_writable_strings) \
176 else if (TREE_CODE (DECL) == VAR_DECL) \
178 if ((flag_pic && (RELOC)) \
179 || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \
180 || !DECL_INITIAL (DECL) \
181 || (DECL_INITIAL (DECL) != error_mark_node \
182 && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \
191 /* This is how we tell the assembler that two symbols have the same value. */
193 #undef ASM_OUTPUT_DEF
194 #define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \
196 assemble_name((FILE), (NAME1)); \
197 fputs(" = ", (FILE)); \
198 assemble_name((FILE), (NAME2)); \
199 fputc('\n', (FILE)); \
203 /************************[ Debugger stuff ]*********************************/
205 /* This is the char to use for continuation (in case we need to turn
206 continuation back on). */
208 #undef DBX_CONTIN_CHAR
209 #define DBX_CONTIN_CHAR '?'