]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/ia64/sysv4.h
Move constructor/destructor handling into target hooks.
[thirdparty/gcc.git] / gcc / config / ia64 / sysv4.h
1 /* Override definitions in elfos.h/svr4.h to be correct for IA64. */
2
3 /* We want DWARF2 as specified by the IA64 ABI. */
4 #undef PREFERRED_DEBUGGING_TYPE
5 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
6
7 /* Various pseudo-ops for which the Intel assembler uses non-standard
8 definitions. */
9
10 #undef ASM_BYTE_OP
11 #define ASM_BYTE_OP "\tdata1\t"
12
13 #undef STRING_ASM_OP
14 #define STRING_ASM_OP "\tstringz\t"
15
16 #undef SKIP_ASM_OP
17 #define SKIP_ASM_OP "\t.skip\t"
18
19 #undef COMMON_ASM_OP
20 #define COMMON_ASM_OP "\t.common\t"
21
22 #undef ASCII_DATA_ASM_OP
23 #define ASCII_DATA_ASM_OP "\tstring\t"
24
25 /* ??? Unfortunately, .lcomm doesn't work, because it puts things in either
26 .bss or .sbss, and we can't control the decision of which is used. When
27 I use .lcomm, I get a cryptic "Section group has no member" error from
28 the Intel simulator. So we must explicitly put variables in .bss
29 instead. This matters only if we care about the Intel assembler. */
30
31 /* This is asm_output_aligned_bss from varasm.c without the ASM_GLOBALIZE_LABEL
32 call at the beginning. */
33
34 /* This is for final.c, because it is used by ASM_DECLARE_OBJECT_NAME. */
35 extern int size_directive_output;
36
37 #undef ASM_OUTPUT_ALIGNED_LOCAL
38 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \
39 do { \
40 if ((DECL) \
41 && XSTR (XEXP (DECL_RTL (DECL), 0), 0)[0] == SDATA_NAME_FLAG_CHAR) \
42 sbss_section (); \
43 else \
44 bss_section (); \
45 ASM_OUTPUT_ALIGN (FILE, floor_log2 ((ALIGN) / BITS_PER_UNIT)); \
46 ASM_DECLARE_OBJECT_NAME (FILE, NAME, DECL); \
47 ASM_OUTPUT_SKIP (FILE, SIZE ? SIZE : 1); \
48 } while (0)
49
50 /* The # tells the Intel assembler that this is not a register name.
51 However, we can't emit the # in a label definition, so we set a variable
52 in ASM_OUTPUT_LABEL to control whether we want the postfix here or not.
53 We append the # to the label name, but since NAME can be an expression
54 we have to scan it for a non-label character and insert the # there. */
55
56 #undef ASM_OUTPUT_LABELREF
57 #define ASM_OUTPUT_LABELREF(STREAM, NAME) \
58 do \
59 { \
60 const char *real_name; \
61 const char *name_end; \
62 \
63 STRIP_NAME_ENCODING (real_name, NAME); \
64 name_end = strchr (real_name, '+'); \
65 \
66 fputs (user_label_prefix, STREAM); \
67 if (name_end) \
68 fwrite (real_name, name_end - real_name, 1, STREAM); \
69 else \
70 fputs (real_name, STREAM); \
71 \
72 if (ia64_asm_output_label) \
73 fputc ('#', STREAM); \
74 \
75 if (name_end) \
76 fputs (name_end, STREAM); \
77 } \
78 while (0)
79
80 /* Intel assembler requires both flags and type if declaring a non-predefined
81 section. */
82 #undef INIT_SECTION_ASM_OP
83 #define INIT_SECTION_ASM_OP "\t.section\t.init,\"ax\",\"progbits\""
84 #undef FINI_SECTION_ASM_OP
85 #define FINI_SECTION_ASM_OP "\t.section\t.fini,\"ax\",\"progbits\""
86
87 /* svr4.h undefines this, so we need to define it here. */
88 #define DBX_REGISTER_NUMBER(REGNO) \
89 ia64_dbx_register_number(REGNO)
90
91 /* Things that svr4.h defines to the wrong type, because it assumes 32 bit
92 ints and 32 bit longs. */
93
94 #undef SIZE_TYPE
95 #define SIZE_TYPE "long unsigned int"
96
97 #undef PTRDIFF_TYPE
98 #define PTRDIFF_TYPE "long int"
99
100 #undef WCHAR_TYPE
101 #define WCHAR_TYPE "int"
102
103 #undef WCHAR_TYPE_SIZE
104 #define WCHAR_TYPE_SIZE 32
105
106 /* We redefine this to use the ia64 .proc pseudo-op. */
107
108 #undef ASM_DECLARE_FUNCTION_NAME
109 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
110 do { \
111 fputs ("\t.proc ", FILE); \
112 assemble_name (FILE, NAME); \
113 fputc ('\n', FILE); \
114 ASM_OUTPUT_LABEL (FILE, NAME); \
115 } while (0)
116
117 /* We redefine this to use the ia64 .endp pseudo-op. */
118
119 #undef ASM_DECLARE_FUNCTION_SIZE
120 #define ASM_DECLARE_FUNCTION_SIZE(FILE, NAME, DECL) \
121 do { \
122 fputs ("\t.endp ", FILE); \
123 assemble_name (FILE, NAME); \
124 fputc ('\n', FILE); \
125 } while (0)
126
127 /* A C expression which outputs to the stdio stream STREAM some appropriate
128 text to go at the start of an assembler file. */
129
130 /* ??? Looks like almost every port, except for a few original ones, get this
131 wrong. Must emit #NO_APP as first line of file to turn of special assembler
132 preprocessing of files. */
133
134 /* ??? Even worse, it doesn't work, because gas does not accept the tab chars
135 that dwarf2out.c emits when #NO_APP. */
136
137 /* ??? Unrelated, but dwarf2out.c emits unnecessary newlines after strings,
138 may as well fix at the same time. */
139
140 #undef ASM_FILE_START
141 #define ASM_FILE_START(STREAM) \
142 do { \
143 output_file_directive (STREAM, main_input_filename); \
144 emit_safe_across_calls (STREAM); \
145 } while (0)
146
147 /* Case label alignment is handled by ADDR_VEC_ALIGN now. */
148
149 #undef ASM_OUTPUT_BEFORE_CASE_LABEL
150 #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE)
151
152 /* We override svr4.h so that we can support the sdata section. */
153
154 #undef SELECT_SECTION
155 #define SELECT_SECTION(DECL,RELOC) \
156 { \
157 if (TREE_CODE (DECL) == STRING_CST) \
158 { \
159 if (! flag_writable_strings) \
160 const_section (); \
161 else \
162 data_section (); \
163 } \
164 else if (TREE_CODE (DECL) == VAR_DECL) \
165 { \
166 if (XSTR (XEXP (DECL_RTL (DECL), 0), 0)[0] \
167 == SDATA_NAME_FLAG_CHAR) \
168 sdata_section (); \
169 /* ??? We need the extra ! RELOC check, because the default is to \
170 only check RELOC if flag_pic is set, and we don't set flag_pic \
171 (yet?). */ \
172 else if (DECL_READONLY_SECTION (DECL, RELOC) && ! (RELOC)) \
173 const_section (); \
174 else \
175 data_section (); \
176 } \
177 /* This could be a CONSTRUCTOR containing ADDR_EXPR of a VAR_DECL, \
178 in which case we can't put it in a shared library rodata. */ \
179 else if (flag_pic && (RELOC)) \
180 data_section (); \
181 else \
182 const_section (); \
183 }
184
185 /* Similarly for constant pool data. */
186
187 extern unsigned int ia64_section_threshold;
188 #undef SELECT_RTX_SECTION
189 #define SELECT_RTX_SECTION(MODE, RTX) \
190 { \
191 if (GET_MODE_SIZE (MODE) > 0 \
192 && GET_MODE_SIZE (MODE) <= ia64_section_threshold) \
193 sdata_section (); \
194 else if (flag_pic && symbolic_operand ((RTX), (MODE))) \
195 data_section (); \
196 else \
197 const_section (); \
198 }
199
200 #undef EXTRA_SECTIONS
201 #define EXTRA_SECTIONS in_const, in_sdata, in_sbss
202
203 #undef EXTRA_SECTION_FUNCTIONS
204 #define EXTRA_SECTION_FUNCTIONS \
205 CONST_SECTION_FUNCTION \
206 SDATA_SECTION_FUNCTION \
207 SBSS_SECTION_FUNCTION
208
209 #define SDATA_SECTION_ASM_OP "\t.sdata"
210
211 #define SDATA_SECTION_FUNCTION \
212 void \
213 sdata_section () \
214 { \
215 if (in_section != in_sdata) \
216 { \
217 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
218 in_section = in_sdata; \
219 } \
220 }
221
222 #define SBSS_SECTION_ASM_OP "\t.sbss"
223
224 #define SBSS_SECTION_FUNCTION \
225 void \
226 sbss_section () \
227 { \
228 if (in_section != in_sbss) \
229 { \
230 fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
231 in_section = in_sbss; \
232 } \
233 }