]>
git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/ia64/sysv4.h
1 /* Override definitions in elfos.h/svr4.h to be correct for IA64. */
3 /* We want DWARF2 as specified by the IA64 ABI. */
4 #undef PREFERRED_DEBUGGING_TYPE
5 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
7 /* Various pseudo-ops for which the Intel assembler uses non-standard
11 #define ASM_BYTE_OP "\tdata1\t"
14 #define STRING_ASM_OP "\tstringz\t"
17 #define SKIP_ASM_OP "\t.skip\t"
20 #define COMMON_ASM_OP "\t.common\t"
22 #undef ASCII_DATA_ASM_OP
23 #define ASCII_DATA_ASM_OP "\tstring\t"
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. */
31 /* This is asm_output_aligned_bss from varasm.c without the ASM_GLOBALIZE_LABEL
32 call at the beginning. */
34 /* This is for final.c, because it is used by ASM_DECLARE_OBJECT_NAME. */
35 extern int size_directive_output
;
37 #undef ASM_OUTPUT_ALIGNED_LOCAL
38 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \
41 && XSTR (XEXP (DECL_RTL (DECL), 0), 0)[0] == SDATA_NAME_FLAG_CHAR) \
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); \
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. */
56 #undef ASM_OUTPUT_LABELREF
57 #define ASM_OUTPUT_LABELREF(STREAM, NAME) \
60 const char *real_name; \
61 const char *name_end; \
63 STRIP_NAME_ENCODING (real_name, NAME); \
64 name_end = strchr (real_name, '+'); \
66 fputs (user_label_prefix, STREAM); \
68 fwrite (real_name, name_end - real_name, 1, STREAM); \
70 fputs (real_name, STREAM); \
72 if (ia64_asm_output_label) \
73 fputc ('#', STREAM); \
76 fputs (name_end, STREAM); \
80 /* Intel assembler requires both flags and type if declaring a non-predefined
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 #undef CTORS_SECTION_ASM_OP
87 #define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"aw\",\"progbits\""
88 #undef DTORS_SECTION_ASM_OP
89 #define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"aw\",\"progbits\""
91 /* A C statement (sans semicolon) to output an element in the table of
92 global constructors. */
93 /* Must override this to get @fptr relocation. */
94 #undef ASM_OUTPUT_CONSTRUCTOR
95 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
98 if (TARGET_NO_PIC || TARGET_AUTO_PIC) \
99 fputs ("\tdata8\t ", FILE); \
101 fputs ("\tdata8\t @fptr(", FILE); \
102 assemble_name (FILE, NAME); \
103 if (TARGET_NO_PIC || TARGET_AUTO_PIC) \
104 fputs ("\n", FILE); \
106 fputs (")\n", FILE); \
109 /* A C statement (sans semicolon) to output an element in the table of
110 global destructors. */
111 /* Must override this to get @fptr relocation. */
112 #undef ASM_OUTPUT_DESTRUCTOR
113 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
116 if (TARGET_NO_PIC || TARGET_AUTO_PIC) \
117 fputs ("\tdata8\t ", FILE); \
119 fputs ("\tdata8\t @fptr(", FILE); \
120 assemble_name (FILE, NAME); \
121 if (TARGET_NO_PIC || TARGET_AUTO_PIC) \
122 fputs ("\n", FILE); \
124 fputs (")\n", FILE); \
127 /* svr4.h undefines this, so we need to define it here. */
128 #define DBX_REGISTER_NUMBER(REGNO) \
129 ia64_dbx_register_number(REGNO)
131 /* Things that svr4.h defines to the wrong type, because it assumes 32 bit
132 ints and 32 bit longs. */
135 #define SIZE_TYPE "long unsigned int"
138 #define PTRDIFF_TYPE "long int"
141 #define WCHAR_TYPE "int"
143 #undef WCHAR_TYPE_SIZE
144 #define WCHAR_TYPE_SIZE 32
146 /* We redefine this to use the ia64 .proc pseudo-op. */
148 #undef ASM_DECLARE_FUNCTION_NAME
149 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
151 fputs ("\t.proc ", FILE); \
152 assemble_name (FILE, NAME); \
153 fputc ('\n', FILE); \
154 ASM_OUTPUT_LABEL (FILE, NAME); \
157 /* We redefine this to use the ia64 .endp pseudo-op. */
159 #undef ASM_DECLARE_FUNCTION_SIZE
160 #define ASM_DECLARE_FUNCTION_SIZE(FILE, NAME, DECL) \
162 fputs ("\t.endp ", FILE); \
163 assemble_name (FILE, NAME); \
164 fputc ('\n', FILE); \
167 /* A C expression which outputs to the stdio stream STREAM some appropriate
168 text to go at the start of an assembler file. */
170 /* ??? Looks like almost every port, except for a few original ones, get this
171 wrong. Must emit #NO_APP as first line of file to turn of special assembler
172 preprocessing of files. */
174 /* ??? Even worse, it doesn't work, because gas does not accept the tab chars
175 that dwarf2out.c emits when #NO_APP. */
177 /* ??? Unrelated, but dwarf2out.c emits unnecessary newlines after strings,
178 may as well fix at the same time. */
180 #undef ASM_FILE_START
181 #define ASM_FILE_START(STREAM) \
183 output_file_directive (STREAM, main_input_filename); \
184 emit_safe_across_calls (STREAM); \
187 /* Case label alignment is handled by ADDR_VEC_ALIGN now. */
189 #undef ASM_OUTPUT_BEFORE_CASE_LABEL
190 #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE)
192 /* We override svr4.h so that we can support the sdata section. */
194 #undef SELECT_SECTION
195 #define SELECT_SECTION(DECL,RELOC) \
197 if (TREE_CODE (DECL) == STRING_CST) \
199 if (! flag_writable_strings) \
204 else if (TREE_CODE (DECL) == VAR_DECL) \
206 if (XSTR (XEXP (DECL_RTL (DECL), 0), 0)[0] \
207 == SDATA_NAME_FLAG_CHAR) \
209 /* ??? We need the extra ! RELOC check, because the default is to \
210 only check RELOC if flag_pic is set, and we don't set flag_pic \
212 else if (DECL_READONLY_SECTION (DECL, RELOC) && ! (RELOC)) \
217 /* This could be a CONSTRUCTOR containing ADDR_EXPR of a VAR_DECL, \
218 in which case we can't put it in a shared library rodata. */ \
219 else if (flag_pic && (RELOC)) \
225 /* Similarly for constant pool data. */
227 extern unsigned int ia64_section_threshold
;
228 #undef SELECT_RTX_SECTION
229 #define SELECT_RTX_SECTION(MODE, RTX) \
231 if (GET_MODE_SIZE (MODE) > 0 \
232 && GET_MODE_SIZE (MODE) <= ia64_section_threshold) \
234 else if (flag_pic && symbolic_operand ((RTX), (MODE))) \
240 #undef EXTRA_SECTIONS
241 #define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_sdata, in_sbss
243 #undef EXTRA_SECTION_FUNCTIONS
244 #define EXTRA_SECTION_FUNCTIONS \
245 CONST_SECTION_FUNCTION \
246 CTORS_SECTION_FUNCTION \
247 DTORS_SECTION_FUNCTION \
248 SDATA_SECTION_FUNCTION \
249 SBSS_SECTION_FUNCTION
251 #define SDATA_SECTION_ASM_OP "\t.sdata"
253 #define SDATA_SECTION_FUNCTION \
257 if (in_section != in_sdata) \
259 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
260 in_section = in_sdata; \
264 #define SBSS_SECTION_ASM_OP "\t.sbss"
266 #define SBSS_SECTION_FUNCTION \
270 if (in_section != in_sbss) \
272 fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
273 in_section = in_sbss; \