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>
4:
5: This file is part of GNU CC.
6:
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)
10: any later version.
11:
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.
16:
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. */
20:
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> */
24:
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/freebsd.h,v 1.2 2003/06/17 04:24:01 dillon Exp $ */
27:
28:
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. */
32:
33: #undef CPP_PREDEFINES
34: #define CPP_PREDEFINES \
35: "-D__alpha__ -D__alpha -Acpu(alpha) -Amachine(alpha)" \
36: FBSD_CPP_PREDEFINES
37:
38: #undef LINK_SPEC
39: #define LINK_SPEC "-m elf64alpha \
40: %{p:%e`-p' not supported; use `-pg' and gprof(1)} \
41: %{Wl,*:%*} \
42: %{assert*} %{R*} %{rpath*} %{defsym*} \
43: %{shared:-Bshareable %{h*} %{soname*}} \
44: %{symbolic:-Bsymbolic} \
45: %{!shared: \
46: %{!static: \
47: %{rdynamic:-export-dynamic} \
48: %{!dynamic-linker:-dynamic-linker /usr/libexec/ld-elf.so.1}} \
49: %{static:-Bstatic}}"
50:
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. */
54:
55: #undef ASM_SPEC
56: #define ASM_SPEC " %| %{mcpu=*:-m%*}"
57:
58: #undef ASM_FINAL_SPEC
59:
60: /* Provide a STARTFILE_SPEC for FreeBSD that is compatible with the
61: non-aout version used on i386. */
62:
63: #undef STARTFILE_SPEC
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}"
67:
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'. */
72:
73: #undef ENDFILE_SPEC
74: #define ENDFILE_SPEC \
75: "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
76:
77:
78: /************************[ Target stuff ]***********************************/
79:
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. */
83:
84: /* alpha.h gets this wrong for FreeBSD. We use the GCC defaults instead. */
85: #undef WCHAR_TYPE
86:
87: /* Handle cross-compilation on 32-bits machines (such as i386) for 64-bits
88: machines (Alpha in this case). */
89:
90: #if defined(__i386__)
91: #undef HOST_BITS_PER_LONG
92: #define HOST_BITS_PER_LONG 32
93: #undef HOST_WIDE_INT
94: #define HOST_WIDE_INT long long
95: #undef HOST_BITS_PER_WIDE_INT
96: #define HOST_BITS_PER_WIDE_INT 64
97: #endif
98:
99: /* This is the pseudo-op used to generate a 64-bit word of data with a
100: specific value in some section. */
101:
102: #undef INT_ASM_OP
103: #define INT_ASM_OP ".quad"
104:
105: #undef TARGET_VERSION
106: #define TARGET_VERSION fprintf (stderr, " (FreeBSD/Alpha ELF)");
107:
108: #define TARGET_AOUT (0)
109: #define TARGET_ELF (1)
110: #define TARGET_UNDERSCORES (0)
111:
112: #undef OBJECT_FORMAT_COFF
113: #undef EXTENDED_COFF
114:
115: #undef TARGET_DEFAULT
116: #define TARGET_DEFAULT (MASK_FP | MASK_FPREGS | MASK_GAS)
117:
118: #undef HAS_INIT_SECTION
119:
120: /* Show that we need a GP when profiling. */
121: #undef TARGET_PROFILING_NEEDS_GP
122: #define TARGET_PROFILING_NEEDS_GP
123:
124: /* We always use gas here, so we don't worry about ECOFF assembler problems. */
125: #undef TARGET_GAS
126: #define TARGET_GAS 1
127:
128:
129: /************************[ Assembler stuff ]********************************/
130:
131: /* This is how to begin an assembly language file.
132: ELF also needs a .version. */
133:
134: #undef ASM_FILE_START
135: #define ASM_FILE_START(FILE) \
136: { \
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"); \
141: }
142:
143: extern void output_file_directive ();
144: extern void alpha_output_lineno ();
145:
146: #undef ASM_OUTPUT_SOURCE_LINE
147: #define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE) \
148: alpha_output_lineno ((STREAM), (LINE))
149:
150: /* Switch into a generic section.
151: This is currently only used to support section attributes.
152:
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")
160:
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. */
165:
166: #undef SELECT_SECTION
167: #define SELECT_SECTION(DECL, RELOC) \
168: { \
169: if (TREE_CODE (DECL) == STRING_CST) \
170: { \
171: if (! flag_writable_strings) \
172: const_section (); \
173: else \
174: data_section (); \
175: } \
176: else if (TREE_CODE (DECL) == VAR_DECL) \
177: { \
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)))) \
183: data_section (); \
184: else \
185: const_section (); \
186: } \
187: else \
188: const_section (); \
189: }
190:
191: /* This is how we tell the assembler that two symbols have the same value. */
192:
193: #undef ASM_OUTPUT_DEF
194: #define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \
195: do { \
196: assemble_name((FILE), (NAME1)); \
197: fputs(" = ", (FILE)); \
198: assemble_name((FILE), (NAME2)); \
199: fputc('\n', (FILE)); \
200: } while (0)
201:
202:
203: /************************[ Debugger stuff ]*********************************/
204:
205: /* This is the char to use for continuation (in case we need to turn
206: continuation back on). */
207:
208: #undef DBX_CONTIN_CHAR
209: #define DBX_CONTIN_CHAR '?'