* target.h (asm_out.byte_op, asm_out.aligned_op, asm_out.unaligned_op,
[official-gcc.git] / gcc / config / ia64 / sysv4.h
blob1b5d4691efcde94151462fff074a58f3f7150a25
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 /* Stabs does not work properly for 64-bit targets. */
8 #undef DBX_DEBUGGING_INFO
10 /* Various pseudo-ops for which the Intel assembler uses non-standard
11 definitions. */
13 #undef STRING_ASM_OP
14 #define STRING_ASM_OP "\tstringz\t"
16 #undef SKIP_ASM_OP
17 #define SKIP_ASM_OP "\t.skip\t"
19 #undef COMMON_ASM_OP
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) \
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)
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) \
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 if (!ia64_asm_output_label) \
68 fputc ('#', STREAM); \
69 } while (0)
71 /* Intel assembler requires both flags and type if declaring a non-predefined
72 section. */
73 #undef INIT_SECTION_ASM_OP
74 #define INIT_SECTION_ASM_OP "\t.section\t.init,\"ax\",\"progbits\""
75 #undef FINI_SECTION_ASM_OP
76 #define FINI_SECTION_ASM_OP "\t.section\t.fini,\"ax\",\"progbits\""
78 /* svr4.h undefines this, so we need to define it here. */
79 #define DBX_REGISTER_NUMBER(REGNO) \
80 ia64_dbx_register_number(REGNO)
82 /* Things that svr4.h defines to the wrong type, because it assumes 32 bit
83 ints and 32 bit longs. */
85 #undef SIZE_TYPE
86 #define SIZE_TYPE "long unsigned int"
88 #undef PTRDIFF_TYPE
89 #define PTRDIFF_TYPE "long int"
91 #undef WCHAR_TYPE
92 #define WCHAR_TYPE "int"
94 #undef WCHAR_TYPE_SIZE
95 #define WCHAR_TYPE_SIZE 32
97 /* We redefine this to use the ia64 .proc pseudo-op. */
99 #undef ASM_DECLARE_FUNCTION_NAME
100 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
101 do { \
102 fputs ("\t.proc ", FILE); \
103 assemble_name (FILE, NAME); \
104 fputc ('\n', FILE); \
105 ASM_OUTPUT_LABEL (FILE, NAME); \
106 } while (0)
108 /* We redefine this to use the ia64 .endp pseudo-op. */
110 #undef ASM_DECLARE_FUNCTION_SIZE
111 #define ASM_DECLARE_FUNCTION_SIZE(FILE, NAME, DECL) \
112 do { \
113 fputs ("\t.endp ", FILE); \
114 assemble_name (FILE, NAME); \
115 fputc ('\n', FILE); \
116 } while (0)
118 /* A C expression which outputs to the stdio stream STREAM some appropriate
119 text to go at the start of an assembler file. */
121 /* ??? Looks like almost every port, except for a few original ones, get this
122 wrong. Must emit #NO_APP as first line of file to turn of special assembler
123 preprocessing of files. */
125 /* ??? Even worse, it doesn't work, because gas does not accept the tab chars
126 that dwarf2out.c emits when #NO_APP. */
128 /* ??? Unrelated, but dwarf2out.c emits unnecessary newlines after strings,
129 may as well fix at the same time. */
131 #undef ASM_FILE_START
132 #define ASM_FILE_START(STREAM) \
133 do { \
134 output_file_directive (STREAM, main_input_filename); \
135 emit_safe_across_calls (STREAM); \
136 } while (0)
138 /* We override svr4.h so that we can support the sdata section. */
140 #undef SELECT_SECTION
141 #define SELECT_SECTION(DECL,RELOC,ALIGN) \
143 if (TREE_CODE (DECL) == STRING_CST) \
145 if (! flag_writable_strings) \
146 mergeable_string_section ((DECL), (ALIGN), 0); \
147 else \
148 data_section (); \
150 else if (TREE_CODE (DECL) == VAR_DECL) \
152 if (XSTR (XEXP (DECL_RTL (DECL), 0), 0)[0] \
153 == SDATA_NAME_FLAG_CHAR) \
154 sdata_section (); \
155 /* ??? We need the extra RELOC check, because the default is to \
156 only check RELOC if flag_pic is set, and we don't set flag_pic \
157 (yet?). */ \
158 else if (!DECL_READONLY_SECTION (DECL, RELOC) || (RELOC)) \
159 data_section (); \
160 else if (flag_merge_constants < 2) \
161 /* C and C++ don't allow different variables to share \
162 the same location. -fmerge-all-constants allows \
163 even that (at the expense of not conforming). */ \
164 const_section (); \
165 else if (TREE_CODE (DECL_INITIAL (DECL)) == STRING_CST) \
166 mergeable_string_section (DECL_INITIAL (DECL), (ALIGN), 0); \
167 else \
168 mergeable_constant_section (DECL_MODE (DECL), (ALIGN), 0); \
170 /* This could be a CONSTRUCTOR containing ADDR_EXPR of a VAR_DECL, \
171 in which case we can't put it in a shared library rodata. */ \
172 else if (flag_pic && (RELOC)) \
173 data_section (); \
174 else \
175 const_section (); \
178 /* Similarly for constant pool data. */
180 extern unsigned int ia64_section_threshold;
181 #undef SELECT_RTX_SECTION
182 #define SELECT_RTX_SECTION(MODE, RTX, ALIGN) \
184 if (GET_MODE_SIZE (MODE) > 0 \
185 && GET_MODE_SIZE (MODE) <= ia64_section_threshold) \
186 sdata_section (); \
187 else if (flag_pic && symbolic_operand ((RTX), (MODE))) \
188 data_section (); \
189 else \
190 mergeable_constant_section ((MODE), (ALIGN), 0); \
193 #undef EXTRA_SECTIONS
194 #define EXTRA_SECTIONS in_const, in_sdata, in_sbss
196 #undef EXTRA_SECTION_FUNCTIONS
197 #define EXTRA_SECTION_FUNCTIONS \
198 CONST_SECTION_FUNCTION \
199 SDATA_SECTION_FUNCTION \
200 SBSS_SECTION_FUNCTION
202 #define SDATA_SECTION_ASM_OP "\t.sdata"
204 #define SDATA_SECTION_FUNCTION \
205 void \
206 sdata_section () \
208 if (in_section != in_sdata) \
210 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
211 in_section = in_sdata; \
215 #define SBSS_SECTION_ASM_OP "\t.sbss"
217 #define SBSS_SECTION_FUNCTION \
218 void \
219 sbss_section () \
221 if (in_section != in_sbss) \
223 fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
224 in_section = in_sbss; \