02fdede601e6758ce4f0f51690012dee7d69bda4
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 "data1"
14 #define STRING_ASM_OP "stringz"
17 #define SKIP_ASM_OP ".skip"
20 #define COMMON_ASM_OP ".common"
22 #undef ASCII_DATA_ASM_OP
23 #define ASCII_DATA_ASM_OP "string"
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 /* ??? Intel assembler does not allow "." in section names, so turn off
51 gnu.linkonce section support, but only when using the Intel assembler. */
52 #undef UNIQUE_SECTION_P
53 #define UNIQUE_SECTION_P(DECL) (TARGET_GNU_AS ? DECL_ONE_ONLY (DECL) : 0)
55 /* The # tells the Intel assembler that this is not a register name.
56 However, we can't emit the # in a label definition, so we set a variable
57 in ASM_OUTPUT_LABEL to control whether we want the postfix here or not. */
59 #undef ASM_OUTPUT_LABELREF
60 #define ASM_OUTPUT_LABELREF(STREAM, NAME) \
63 const char *real_name; \
64 STRIP_NAME_ENCODING (real_name, NAME); \
65 asm_fprintf (STREAM, "%U%s%s", real_name, \
66 (ia64_asm_output_label ? "" : "#")); \
70 /* Intel assembler requires both flags and type if declaring a non-predefined
72 #undef INIT_SECTION_ASM_OP
73 #define INIT_SECTION_ASM_OP ".section\t.init,\"ax\",\"progbits\""
74 #undef FINI_SECTION_ASM_OP
75 #define FINI_SECTION_ASM_OP ".section\t.fini,\"ax\",\"progbits\""
76 #undef CTORS_SECTION_ASM_OP
77 #define CTORS_SECTION_ASM_OP ".section\t.ctors,\"aw\",\"progbits\""
78 #undef DTORS_SECTION_ASM_OP
79 #define DTORS_SECTION_ASM_OP ".section\t.dtors,\"aw\",\"progbits\""
81 /* A C statement (sans semicolon) to output an element in the table of
82 global constructors. */
83 /* Must override this to get @fptr relocation. */
84 #undef ASM_OUTPUT_CONSTRUCTOR
85 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
88 if (TARGET_NO_PIC || TARGET_AUTO_PIC) \
89 fputs ("\tdata8\t ", FILE); \
91 fputs ("\tdata8\t @fptr(", FILE); \
92 assemble_name (FILE, NAME); \
93 if (TARGET_NO_PIC || TARGET_AUTO_PIC) \
96 fputs (")\n", FILE); \
99 /* A C statement (sans semicolon) to output an element in the table of
100 global destructors. */
101 /* Must override this to get @fptr relocation. */
102 #undef ASM_OUTPUT_DESTRUCTOR
103 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
106 if (TARGET_NO_PIC || TARGET_AUTO_PIC) \
107 fputs ("\tdata8\t ", FILE); \
109 fputs ("\tdata8\t @fptr(", FILE); \
110 assemble_name (FILE, NAME); \
111 if (TARGET_NO_PIC || TARGET_AUTO_PIC) \
112 fputs ("\n", FILE); \
114 fputs (")\n", FILE); \
117 /* svr4.h undefines this, so we need to define it here. */
118 #define DBX_REGISTER_NUMBER(REGNO) \
119 (IN_REGNO_P (REGNO) ? (32 + (REGNO) - IN_REG (0)) \
120 : LOC_REGNO_P (REGNO) ? (32 + ia64_input_regs + \
121 (REGNO) - LOC_REG (0)) \
122 : OUT_REGNO_P (REGNO) ? (32 + ia64_input_regs + ia64_local_regs \
123 + (REGNO) - OUT_REG (0)) \
124 : (REGNO) == FRAME_POINTER_REGNUM ? ia64_fp_regno \
127 /* Things that svr4.h defines to the wrong type, because it assumes 32 bit
128 ints and 32 bit longs. */
131 #define SIZE_TYPE "long unsigned int"
134 #define PTRDIFF_TYPE "long int"
137 #define WCHAR_TYPE "int"
139 #undef WCHAR_TYPE_SIZE
140 #define WCHAR_TYPE_SIZE 32
142 /* We don't want any symbol at the beginning of the file. This is defined in
143 dbxelf.h which is included from elfos.h, so we need to undef/define it
146 #undef ASM_IDENTIFY_GCC
147 #define ASM_IDENTIFY_GCC(FILE)
149 /* We redefine this to use the ia64 .proc pseudo-op. */
151 #undef ASM_DECLARE_FUNCTION_NAME
152 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
154 fputs ("\t.proc ", FILE); \
155 assemble_name (FILE, NAME); \
156 fputc ('\n', FILE); \
157 ASM_OUTPUT_LABEL (FILE, NAME); \
160 /* We redefine this to use the ia64 .endp pseudo-op. */
162 #undef ASM_DECLARE_FUNCTION_SIZE
163 #define ASM_DECLARE_FUNCTION_SIZE(FILE, NAME, DECL) \
165 fputs ("\t.endp ", FILE); \
166 assemble_name (FILE, NAME); \
167 fputc ('\n', FILE); \
170 /* A C expression which outputs to the stdio stream STREAM some appropriate
171 text to go at the start of an assembler file. */
173 /* ??? Looks like almost every port, except for a few original ones, get this
174 wrong. Must emit #NO_APP as first line of file to turn of special assembler
175 preprocessing of files. */
177 /* ??? Even worse, it doesn't work, because gas does not accept the tab chars
178 that dwarf2out.c emits when #NO_APP. */
180 /* ??? Unrelated, but dwarf2out.c emits unnecessary newlines after strings,
181 may as well fix at the same time. */
183 #undef ASM_FILE_START
184 #define ASM_FILE_START(STREAM) \
186 output_file_directive (STREAM, main_input_filename); \
187 ia64_file_start(STREAM); \
190 /* Case label alignment is handled by ADDR_VEC_ALIGN now. */
192 #undef ASM_OUTPUT_BEFORE_CASE_LABEL
193 #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE)
195 /* We override svr4.h so that we can support the sdata section. */
197 #undef SELECT_SECTION
198 #define SELECT_SECTION(DECL,RELOC) \
200 if (TREE_CODE (DECL) == STRING_CST) \
202 if (! flag_writable_strings) \
207 else if (TREE_CODE (DECL) == VAR_DECL) \
209 if (XSTR (XEXP (DECL_RTL (DECL), 0), 0)[0] \
210 == SDATA_NAME_FLAG_CHAR) \
212 /* ??? We need the extra ! RELOC check, because the default is to \
213 only check RELOC if flag_pic is set, and we don't set flag_pic \
215 else if (DECL_READONLY_SECTION (DECL, RELOC) && ! (RELOC)) \
220 /* This could be a CONSTRUCTOR containing ADDR_EXPR of a VAR_DECL, \
221 in which case we can't put it in a shared library rodata. */ \
222 else if (flag_pic && (RELOC)) \
228 /* Similarly for constant pool data. */
230 extern unsigned int ia64_section_threshold
;
231 #undef SELECT_RTX_SECTION
232 #define SELECT_RTX_SECTION(MODE, RTX) \
234 if (GET_MODE_SIZE (MODE) > 0 \
235 && GET_MODE_SIZE (MODE) <= ia64_section_threshold) \
237 else if (flag_pic && symbolic_operand ((RTX), (MODE))) \
243 #undef EXTRA_SECTIONS
244 #define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_sdata, in_sbss
246 #undef EXTRA_SECTION_FUNCTIONS
247 #define EXTRA_SECTION_FUNCTIONS \
248 CONST_SECTION_FUNCTION \
249 CTORS_SECTION_FUNCTION \
250 DTORS_SECTION_FUNCTION \
251 SDATA_SECTION_FUNCTION \
252 SBSS_SECTION_FUNCTION
254 #define SDATA_SECTION_ASM_OP ".sdata"
256 #define SDATA_SECTION_FUNCTION \
260 if (in_section != in_sdata) \
262 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
263 in_section = in_sdata; \
267 #define SBSS_SECTION_ASM_OP ".sbss"
269 #define SBSS_SECTION_FUNCTION \
273 if (in_section != in_sbss) \
275 fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
276 in_section = in_sbss; \