]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/ia64/sysv4.h
86d89acf1fb105b4716bee2fe2e1aeb3ae7cb240
[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 const char *name_ = NAME; \
60 if (*name_ == SDATA_NAME_FLAG_CHAR) \
61 name_++; \
62 if (*name_ == '*') \
63 name_++; \
64 else \
65 fputs (user_label_prefix, STREAM); \
66 fputs (name_, STREAM); \
67 fputc ('#', STREAM); \
68 } while (0)
69
70 /* Intel assembler requires both flags and type if declaring a non-predefined
71 section. */
72 #undef INIT_SECTION_ASM_OP
73 #define INIT_SECTION_ASM_OP "\t.section\t.init,\"ax\",\"progbits\""
74 #undef FINI_SECTION_ASM_OP
75 #define FINI_SECTION_ASM_OP "\t.section\t.fini,\"ax\",\"progbits\""
76
77 /* svr4.h undefines this, so we need to define it here. */
78 #define DBX_REGISTER_NUMBER(REGNO) \
79 ia64_dbx_register_number(REGNO)
80
81 /* Things that svr4.h defines to the wrong type, because it assumes 32 bit
82 ints and 32 bit longs. */
83
84 #undef SIZE_TYPE
85 #define SIZE_TYPE "long unsigned int"
86
87 #undef PTRDIFF_TYPE
88 #define PTRDIFF_TYPE "long int"
89
90 #undef WCHAR_TYPE
91 #define WCHAR_TYPE "int"
92
93 #undef WCHAR_TYPE_SIZE
94 #define WCHAR_TYPE_SIZE 32
95
96 /* We redefine this to use the ia64 .proc pseudo-op. */
97
98 #undef ASM_DECLARE_FUNCTION_NAME
99 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
100 do { \
101 fputs ("\t.proc ", FILE); \
102 assemble_name (FILE, NAME); \
103 fputc ('\n', FILE); \
104 ASM_OUTPUT_LABEL (FILE, NAME); \
105 } while (0)
106
107 /* We redefine this to use the ia64 .endp pseudo-op. */
108
109 #undef ASM_DECLARE_FUNCTION_SIZE
110 #define ASM_DECLARE_FUNCTION_SIZE(FILE, NAME, DECL) \
111 do { \
112 fputs ("\t.endp ", FILE); \
113 assemble_name (FILE, NAME); \
114 fputc ('\n', FILE); \
115 } while (0)
116
117 /* A C expression which outputs to the stdio stream STREAM some appropriate
118 text to go at the start of an assembler file. */
119
120 /* ??? Looks like almost every port, except for a few original ones, get this
121 wrong. Must emit #NO_APP as first line of file to turn of special assembler
122 preprocessing of files. */
123
124 /* ??? Even worse, it doesn't work, because gas does not accept the tab chars
125 that dwarf2out.c emits when #NO_APP. */
126
127 /* ??? Unrelated, but dwarf2out.c emits unnecessary newlines after strings,
128 may as well fix at the same time. */
129
130 #undef ASM_FILE_START
131 #define ASM_FILE_START(STREAM) \
132 do { \
133 output_file_directive (STREAM, main_input_filename); \
134 emit_safe_across_calls (STREAM); \
135 } while (0)
136
137 /* Case label alignment is handled by ADDR_VEC_ALIGN now. */
138
139 #undef ASM_OUTPUT_BEFORE_CASE_LABEL
140 #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE)
141
142 /* We override svr4.h so that we can support the sdata section. */
143
144 #undef SELECT_SECTION
145 #define SELECT_SECTION(DECL,RELOC) \
146 { \
147 if (TREE_CODE (DECL) == STRING_CST) \
148 { \
149 if (! flag_writable_strings) \
150 const_section (); \
151 else \
152 data_section (); \
153 } \
154 else if (TREE_CODE (DECL) == VAR_DECL) \
155 { \
156 if (XSTR (XEXP (DECL_RTL (DECL), 0), 0)[0] \
157 == SDATA_NAME_FLAG_CHAR) \
158 sdata_section (); \
159 /* ??? We need the extra ! RELOC check, because the default is to \
160 only check RELOC if flag_pic is set, and we don't set flag_pic \
161 (yet?). */ \
162 else if (DECL_READONLY_SECTION (DECL, RELOC) && ! (RELOC)) \
163 const_section (); \
164 else \
165 data_section (); \
166 } \
167 /* This could be a CONSTRUCTOR containing ADDR_EXPR of a VAR_DECL, \
168 in which case we can't put it in a shared library rodata. */ \
169 else if (flag_pic && (RELOC)) \
170 data_section (); \
171 else \
172 const_section (); \
173 }
174
175 /* Similarly for constant pool data. */
176
177 extern unsigned int ia64_section_threshold;
178 #undef SELECT_RTX_SECTION
179 #define SELECT_RTX_SECTION(MODE, RTX) \
180 { \
181 if (GET_MODE_SIZE (MODE) > 0 \
182 && GET_MODE_SIZE (MODE) <= ia64_section_threshold) \
183 sdata_section (); \
184 else if (flag_pic && symbolic_operand ((RTX), (MODE))) \
185 data_section (); \
186 else \
187 const_section (); \
188 }
189
190 #undef EXTRA_SECTIONS
191 #define EXTRA_SECTIONS in_const, in_sdata, in_sbss
192
193 #undef EXTRA_SECTION_FUNCTIONS
194 #define EXTRA_SECTION_FUNCTIONS \
195 CONST_SECTION_FUNCTION \
196 SDATA_SECTION_FUNCTION \
197 SBSS_SECTION_FUNCTION
198
199 #define SDATA_SECTION_ASM_OP "\t.sdata"
200
201 #define SDATA_SECTION_FUNCTION \
202 void \
203 sdata_section () \
204 { \
205 if (in_section != in_sdata) \
206 { \
207 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
208 in_section = in_sdata; \
209 } \
210 }
211
212 #define SBSS_SECTION_ASM_OP "\t.sbss"
213
214 #define SBSS_SECTION_FUNCTION \
215 void \
216 sbss_section () \
217 { \
218 if (in_section != in_sbss) \
219 { \
220 fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
221 in_section = in_sbss; \
222 } \
223 }