Update Copyright years for files modified in 2011 and/or 2012.
[official-gcc.git] / gcc / config / alpha / elf.h
blob96cbaa711ed9feff37f3f4740d20f1d8e08b49bf
1 /* Definitions of target machine for GNU compiler, for DEC Alpha w/ELF.
2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2007, 2008,
3 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
4 Contributed by Richard Henderson (rth@tamu.edu).
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #undef CC1_SPEC
23 #define CC1_SPEC "%{G*}"
25 #undef ASM_SPEC
26 #define ASM_SPEC "%{G*} %{relax:-relax} %{!gstabs*:-no-mdebug}%{gstabs*:-mdebug}"
28 /* Do not output a .file directive at the beginning of the input file. */
30 #undef TARGET_ASM_FILE_START_FILE_DIRECTIVE
31 #define TARGET_ASM_FILE_START_FILE_DIRECTIVE false
33 /* This is how to output an assembler line
34 that says to advance the location counter
35 to a multiple of 2**LOG bytes. */
37 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
38 if ((LOG) != 0) \
39 fprintf (FILE, "\t.align %d\n", LOG);
41 /* This says how to output assembler code to declare an
42 uninitialized internal linkage data object. Under SVR4,
43 the linker seems to want the alignment of data objects
44 to depend on their types. We do exactly that here. */
46 #undef ASM_OUTPUT_ALIGNED_LOCAL
47 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
48 do { \
49 if ((SIZE) <= (unsigned HOST_WIDE_INT) g_switch_value) \
50 switch_to_section (sbss_section); \
51 else \
52 switch_to_section (bss_section); \
53 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
54 if (!flag_inhibit_size_directive) \
55 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \
56 ASM_OUTPUT_ALIGN ((FILE), exact_log2((ALIGN) / BITS_PER_UNIT)); \
57 ASM_OUTPUT_LABEL(FILE, NAME); \
58 ASM_OUTPUT_SKIP((FILE), (SIZE) ? (SIZE) : 1); \
59 } while (0)
61 /* This says how to output assembler code to declare an
62 uninitialized external linkage data object. */
64 #undef ASM_OUTPUT_ALIGNED_BSS
65 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
66 do { \
67 ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN); \
68 } while (0)
70 #undef BSS_SECTION_ASM_OP
71 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
72 #undef SBSS_SECTION_ASM_OP
73 #define SBSS_SECTION_ASM_OP "\t.section\t.sbss,\"aw\""
74 #undef SDATA_SECTION_ASM_OP
75 #define SDATA_SECTION_ASM_OP "\t.section\t.sdata,\"aw\""
77 /* This is how we tell the assembler that two symbols have the same value. */
79 #undef ASM_OUTPUT_DEF
80 #define ASM_OUTPUT_DEF(FILE, ALIAS, NAME) \
81 do { \
82 assemble_name(FILE, ALIAS); \
83 fputs(" = ", FILE); \
84 assemble_name(FILE, NAME); \
85 fputc('\n', FILE); \
86 } while (0)
88 #undef ASM_OUTPUT_DEF_FROM_DECLS
89 #define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL, TARGET) \
90 do { \
91 const char *alias = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
92 const char *name = IDENTIFIER_POINTER (TARGET); \
93 if (TREE_CODE (DECL) == FUNCTION_DECL) \
94 { \
95 fputc ('$', FILE); \
96 assemble_name (FILE, alias); \
97 fputs ("..ng = $", FILE); \
98 assemble_name (FILE, name); \
99 fputs ("..ng\n", FILE); \
101 ASM_OUTPUT_DEF (FILE, alias, name); \
102 } while (0)
104 /* Provide a STARTFILE_SPEC appropriate for ELF. Here we add the
105 (even more) magical crtbegin.o file which provides part of the
106 support for getting C++ file-scope static object constructed
107 before entering `main'. */
109 #undef STARTFILE_SPEC
110 #ifdef HAVE_LD_PIE
111 #define STARTFILE_SPEC \
112 "%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
113 crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
114 #else
115 #define STARTFILE_SPEC \
116 "%{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}}\
117 crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
118 #endif
120 /* Provide a ENDFILE_SPEC appropriate for ELF. Here we tack on the
121 magical crtend.o file which provides part of the support for
122 getting C++ file-scope static object constructed before entering
123 `main', followed by a normal ELF "finalizer" file, `crtn.o'. */
125 #undef ENDFILE_SPEC
126 #define ENDFILE_SPEC \
127 "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
128 %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
130 /* Select a format to encode pointers in exception handling data. CODE
131 is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
132 true if the symbol may be affected by dynamic relocations.
134 Since application size is already constrained to <2GB by the form of
135 the ldgp relocation, we can use a 32-bit pc-relative relocation to
136 static data. Dynamic data is accessed indirectly to allow for read
137 only EH sections. */
138 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
139 (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4)
141 /* If defined, a C statement to be executed just prior to the output of
142 assembler code for INSN. */
143 #define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
144 (alpha_this_literal_sequence_number = 0, \
145 alpha_this_gpdisp_sequence_number = 0)
146 extern int alpha_this_literal_sequence_number;
147 extern int alpha_this_gpdisp_sequence_number;
149 /* Since the bits of the _init and _fini function is spread across
150 many object files, each potentially with its own GP, we must assume
151 we need to load our GP. Further, the .init/.fini section can
152 easily be more than 4MB away from the function to call so we can't
153 use bsr. */
154 #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
155 asm (SECTION_OP "\n" \
156 " br $29,1f\n" \
157 "1: ldgp $29,0($29)\n" \
158 " unop\n" \
159 " jsr $26," USER_LABEL_PREFIX #FUNC "\n" \
160 " .align 3\n" \
161 " .previous");
163 /* If we have the capability create headers for efficient EH lookup.
164 As of Jan 2002, only glibc 2.2.4 can actually make use of this, but
165 I imagine that other systems will catch up. In the meantime, it
166 doesn't harm to make sure that the data exists to be used later. */
167 #if defined(HAVE_LD_EH_FRAME_HDR)
168 #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
169 #endif