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