1 |
38 |
julius |
/* Definitions of target machine for GNU compiler,
|
2 |
|
|
for some generic XCOFF file format
|
3 |
|
|
Copyright (C) 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
|
4 |
|
|
|
5 |
|
|
This file is part of GCC.
|
6 |
|
|
|
7 |
|
|
GCC is free software; you can redistribute it and/or modify it
|
8 |
|
|
under the terms of the GNU General Public License as published
|
9 |
|
|
by the Free Software Foundation; either version 3, or (at your
|
10 |
|
|
option) any later version.
|
11 |
|
|
|
12 |
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT
|
13 |
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
14 |
|
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
15 |
|
|
License for more details.
|
16 |
|
|
|
17 |
|
|
You should have received a copy of the GNU General Public License
|
18 |
|
|
along with GCC; see the file COPYING3. If not see
|
19 |
|
|
<http://www.gnu.org/licenses/>. */
|
20 |
|
|
|
21 |
|
|
#define TARGET_OBJECT_FORMAT OBJECT_XCOFF
|
22 |
|
|
|
23 |
|
|
/* The RS/6000 uses the XCOFF format. */
|
24 |
|
|
#define XCOFF_DEBUGGING_INFO 1
|
25 |
|
|
|
26 |
|
|
/* Define if the object format being used is COFF or a superset. */
|
27 |
|
|
#define OBJECT_FORMAT_COFF
|
28 |
|
|
|
29 |
|
|
/* Define the magic numbers that we recognize as COFF.
|
30 |
|
|
|
31 |
|
|
AIX 4.3 adds U803XTOCMAGIC (0757) for 64-bit objects and AIX V5 adds
|
32 |
|
|
U64_TOCMAGIC (0767), but collect2.c does not include files in the
|
33 |
|
|
correct order to conditionally define the symbolic name in this macro.
|
34 |
|
|
|
35 |
|
|
The AIX linker accepts import/export files as object files,
|
36 |
|
|
so accept "#!" (0x2321) magic number. */
|
37 |
|
|
#define MY_ISCOFF(magic) \
|
38 |
|
|
((magic) == U802WRMAGIC || (magic) == U802ROMAGIC \
|
39 |
|
|
|| (magic) == U802TOCMAGIC || (magic) == 0757 || (magic) == 0767 \
|
40 |
|
|
|| (magic) == 0x2321)
|
41 |
|
|
|
42 |
|
|
/* We don't have GAS for the RS/6000 yet, so don't write out special
|
43 |
|
|
.stabs in cc1plus. */
|
44 |
|
|
|
45 |
|
|
#define FASCIST_ASSEMBLER
|
46 |
|
|
|
47 |
|
|
/* We define this to prevent the name mangler from putting dollar signs into
|
48 |
|
|
function names. */
|
49 |
|
|
|
50 |
|
|
#define NO_DOLLAR_IN_LABEL
|
51 |
|
|
|
52 |
|
|
/* We define this to 0 so that gcc will never accept a dollar sign in a
|
53 |
|
|
variable name. This is needed because the AIX assembler will not accept
|
54 |
|
|
dollar signs. */
|
55 |
|
|
|
56 |
|
|
#define DOLLARS_IN_IDENTIFIERS 0
|
57 |
|
|
|
58 |
|
|
/* AIX .align pseudo-op accept value from 0 to 12, corresponding to
|
59 |
|
|
log base 2 of the alignment in bytes; 12 = 4096 bytes = 32768 bits. */
|
60 |
|
|
|
61 |
|
|
#define MAX_OFILE_ALIGNMENT 32768
|
62 |
|
|
|
63 |
|
|
/* Return nonzero if this entry is to be written into the constant
|
64 |
|
|
pool in a special way. We do so if this is a SYMBOL_REF, LABEL_REF
|
65 |
|
|
or a CONST containing one of them. If -mfp-in-toc (the default),
|
66 |
|
|
we also do this for floating-point constants. We actually can only
|
67 |
|
|
do this if the FP formats of the target and host machines are the
|
68 |
|
|
same, but we can't check that since not every file that uses
|
69 |
|
|
GO_IF_LEGITIMATE_ADDRESS_P includes real.h. We also do this when
|
70 |
|
|
we can write the entry into the TOC and the entry is not larger
|
71 |
|
|
than a TOC entry. */
|
72 |
|
|
|
73 |
|
|
#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
|
74 |
|
|
(TARGET_TOC \
|
75 |
|
|
&& (GET_CODE (X) == SYMBOL_REF \
|
76 |
|
|
|| (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
|
77 |
|
|
&& GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
|
78 |
|
|
|| GET_CODE (X) == LABEL_REF \
|
79 |
|
|
|| (GET_CODE (X) == CONST_INT \
|
80 |
|
|
&& GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
|
81 |
|
|
|| (GET_CODE (X) == CONST_DOUBLE \
|
82 |
|
|
&& (TARGET_POWERPC64 \
|
83 |
|
|
|| TARGET_MINIMAL_TOC \
|
84 |
|
|
|| (SCALAR_FLOAT_MODE_P (GET_MODE (X)) \
|
85 |
|
|
&& ! TARGET_NO_FP_IN_TOC)))))
|
86 |
|
|
|
87 |
|
|
#define TARGET_ASM_OUTPUT_ANCHOR rs6000_xcoff_asm_output_anchor
|
88 |
|
|
#define TARGET_ASM_GLOBALIZE_LABEL rs6000_xcoff_asm_globalize_label
|
89 |
|
|
#define TARGET_ASM_INIT_SECTIONS rs6000_xcoff_asm_init_sections
|
90 |
|
|
#define TARGET_ASM_RELOC_RW_MASK rs6000_xcoff_reloc_rw_mask
|
91 |
|
|
#define TARGET_ASM_NAMED_SECTION rs6000_xcoff_asm_named_section
|
92 |
|
|
#define TARGET_ASM_SELECT_SECTION rs6000_xcoff_select_section
|
93 |
|
|
#define TARGET_ASM_SELECT_RTX_SECTION rs6000_xcoff_select_rtx_section
|
94 |
|
|
#define TARGET_ASM_UNIQUE_SECTION rs6000_xcoff_unique_section
|
95 |
|
|
#define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
|
96 |
|
|
#define TARGET_STRIP_NAME_ENCODING rs6000_xcoff_strip_name_encoding
|
97 |
|
|
#define TARGET_SECTION_TYPE_FLAGS rs6000_xcoff_section_type_flags
|
98 |
|
|
|
99 |
|
|
/* FP save and restore routines. */
|
100 |
|
|
#define SAVE_FP_PREFIX "._savef"
|
101 |
|
|
#define SAVE_FP_SUFFIX ""
|
102 |
|
|
#define RESTORE_FP_PREFIX "._restf"
|
103 |
|
|
#define RESTORE_FP_SUFFIX ""
|
104 |
|
|
|
105 |
|
|
/* Function name to call to do profiling. */
|
106 |
|
|
#undef RS6000_MCOUNT
|
107 |
|
|
#define RS6000_MCOUNT ".__mcount"
|
108 |
|
|
|
109 |
|
|
/* This outputs NAME to FILE up to the first null or '['. */
|
110 |
|
|
|
111 |
|
|
#define RS6000_OUTPUT_BASENAME(FILE, NAME) \
|
112 |
|
|
assemble_name ((FILE), (*targetm.strip_name_encoding) (NAME))
|
113 |
|
|
|
114 |
|
|
/* This is how to output the definition of a user-level label named NAME,
|
115 |
|
|
such as the label on a static function or variable NAME. */
|
116 |
|
|
|
117 |
|
|
#define ASM_OUTPUT_LABEL(FILE,NAME) \
|
118 |
|
|
do { RS6000_OUTPUT_BASENAME (FILE, NAME); fputs (":\n", FILE); } while (0)
|
119 |
|
|
|
120 |
|
|
/* This is how to output a command to make the user-level label named NAME
|
121 |
|
|
defined for reference from other files. */
|
122 |
|
|
|
123 |
|
|
/* Globalizing directive for a label. */
|
124 |
|
|
#define GLOBAL_ASM_OP "\t.globl "
|
125 |
|
|
|
126 |
|
|
#undef TARGET_ASM_FILE_START
|
127 |
|
|
#define TARGET_ASM_FILE_START rs6000_xcoff_file_start
|
128 |
|
|
#define TARGET_ASM_FILE_END rs6000_xcoff_file_end
|
129 |
|
|
#undef TARGET_ASM_FILE_START_FILE_DIRECTIVE
|
130 |
|
|
#define TARGET_ASM_FILE_START_FILE_DIRECTIVE false
|
131 |
|
|
|
132 |
|
|
/* This macro produces the initial definition of a function name.
|
133 |
|
|
On the RS/6000, we need to place an extra '.' in the function name and
|
134 |
|
|
output the function descriptor.
|
135 |
|
|
|
136 |
|
|
The csect for the function will have already been created when
|
137 |
|
|
text_section was selected. We do have to go back to that csect, however.
|
138 |
|
|
|
139 |
|
|
The third and fourth parameters to the .function pseudo-op (16 and 044)
|
140 |
|
|
are placeholders which no longer have any use. */
|
141 |
|
|
|
142 |
|
|
#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
|
143 |
|
|
{ if (TREE_PUBLIC (DECL)) \
|
144 |
|
|
{ \
|
145 |
|
|
if (!RS6000_WEAK || !DECL_WEAK (decl)) \
|
146 |
|
|
{ \
|
147 |
|
|
fputs ("\t.globl .", FILE); \
|
148 |
|
|
RS6000_OUTPUT_BASENAME (FILE, NAME); \
|
149 |
|
|
putc ('\n', FILE); \
|
150 |
|
|
} \
|
151 |
|
|
} \
|
152 |
|
|
else \
|
153 |
|
|
{ \
|
154 |
|
|
fputs ("\t.lglobl .", FILE); \
|
155 |
|
|
RS6000_OUTPUT_BASENAME (FILE, NAME); \
|
156 |
|
|
putc ('\n', FILE); \
|
157 |
|
|
} \
|
158 |
|
|
fputs ("\t.csect ", FILE); \
|
159 |
|
|
RS6000_OUTPUT_BASENAME (FILE, NAME); \
|
160 |
|
|
fputs (TARGET_32BIT ? "[DS]\n" : "[DS],3\n", FILE); \
|
161 |
|
|
RS6000_OUTPUT_BASENAME (FILE, NAME); \
|
162 |
|
|
fputs (":\n", FILE); \
|
163 |
|
|
fputs (TARGET_32BIT ? "\t.long ." : "\t.llong .", FILE); \
|
164 |
|
|
RS6000_OUTPUT_BASENAME (FILE, NAME); \
|
165 |
|
|
fputs (", TOC[tc0], 0\n", FILE); \
|
166 |
|
|
in_section = NULL; \
|
167 |
|
|
switch_to_section (function_section (DECL)); \
|
168 |
|
|
putc ('.', FILE); \
|
169 |
|
|
RS6000_OUTPUT_BASENAME (FILE, NAME); \
|
170 |
|
|
fputs (":\n", FILE); \
|
171 |
|
|
if (write_symbols != NO_DEBUG) \
|
172 |
|
|
xcoffout_declare_function (FILE, DECL, NAME); \
|
173 |
|
|
}
|
174 |
|
|
|
175 |
|
|
/* Output a reference to SYM on FILE. */
|
176 |
|
|
|
177 |
|
|
#define ASM_OUTPUT_SYMBOL_REF(FILE, SYM) \
|
178 |
|
|
rs6000_output_symbol_ref (FILE, SYM)
|
179 |
|
|
|
180 |
|
|
/* This says how to output an external. */
|
181 |
|
|
|
182 |
|
|
#undef ASM_OUTPUT_EXTERNAL
|
183 |
|
|
#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
|
184 |
|
|
{ rtx _symref = XEXP (DECL_RTL (DECL), 0); \
|
185 |
|
|
if ((TREE_CODE (DECL) == VAR_DECL \
|
186 |
|
|
|| TREE_CODE (DECL) == FUNCTION_DECL) \
|
187 |
|
|
&& (NAME)[strlen (NAME) - 1] != ']') \
|
188 |
|
|
{ \
|
189 |
|
|
XSTR (_symref, 0) = concat (XSTR (_symref, 0), \
|
190 |
|
|
(TREE_CODE (DECL) == FUNCTION_DECL \
|
191 |
|
|
? "[DS]" : "[RW]"), \
|
192 |
|
|
NULL); \
|
193 |
|
|
} \
|
194 |
|
|
}
|
195 |
|
|
|
196 |
|
|
/* This is how to output an internal label prefix. rs6000.c uses this
|
197 |
|
|
when generating traceback tables. */
|
198 |
|
|
|
199 |
|
|
#define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \
|
200 |
|
|
fprintf (FILE, "%s..", PREFIX)
|
201 |
|
|
|
202 |
|
|
/* This is how to output a label for a jump table. Arguments are the same as
|
203 |
|
|
for (*targetm.asm_out.internal_label), except the insn for the jump table is
|
204 |
|
|
passed. */
|
205 |
|
|
|
206 |
|
|
#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
|
207 |
|
|
{ ASM_OUTPUT_ALIGN (FILE, 2); (*targetm.asm_out.internal_label) (FILE, PREFIX, NUM); }
|
208 |
|
|
|
209 |
|
|
/* This is how to store into the string LABEL
|
210 |
|
|
the symbol_ref name of an internal numbered label where
|
211 |
|
|
PREFIX is the class of label and NUM is the number within the class.
|
212 |
|
|
This is suitable for output with `assemble_name'. */
|
213 |
|
|
|
214 |
|
|
#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
|
215 |
|
|
sprintf (LABEL, "*%s..%u", (PREFIX), (unsigned) (NUM))
|
216 |
|
|
|
217 |
|
|
/* This is how to output an assembler line to define N characters starting
|
218 |
|
|
at P to FILE. */
|
219 |
|
|
|
220 |
|
|
#define ASM_OUTPUT_ASCII(FILE, P, N) output_ascii ((FILE), (P), (N))
|
221 |
|
|
|
222 |
|
|
/* This is how to advance the location counter by SIZE bytes. */
|
223 |
|
|
|
224 |
|
|
#define SKIP_ASM_OP "\t.space "
|
225 |
|
|
|
226 |
|
|
#define ASM_OUTPUT_SKIP(FILE,SIZE) \
|
227 |
|
|
fprintf (FILE, "%s"HOST_WIDE_INT_PRINT_UNSIGNED"\n", SKIP_ASM_OP, (SIZE))
|
228 |
|
|
|
229 |
|
|
/* This says how to output an assembler line
|
230 |
|
|
to define a global common symbol. */
|
231 |
|
|
|
232 |
|
|
#define COMMON_ASM_OP "\t.comm "
|
233 |
|
|
|
234 |
|
|
#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
|
235 |
|
|
do { fputs (COMMON_ASM_OP, (FILE)); \
|
236 |
|
|
RS6000_OUTPUT_BASENAME ((FILE), (NAME)); \
|
237 |
|
|
if ((ALIGN) > 32) \
|
238 |
|
|
fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", (SIZE), \
|
239 |
|
|
exact_log2 ((ALIGN) / BITS_PER_UNIT)); \
|
240 |
|
|
else if ((SIZE) > 4) \
|
241 |
|
|
fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",3\n", (SIZE)); \
|
242 |
|
|
else \
|
243 |
|
|
fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED"\n", (SIZE)); \
|
244 |
|
|
} while (0)
|
245 |
|
|
|
246 |
|
|
/* This says how to output an assembler line
|
247 |
|
|
to define a local common symbol.
|
248 |
|
|
Alignment cannot be specified, but we can try to maintain
|
249 |
|
|
alignment after preceding TOC section if it was aligned
|
250 |
|
|
for 64-bit mode. */
|
251 |
|
|
|
252 |
|
|
#define LOCAL_COMMON_ASM_OP "\t.lcomm "
|
253 |
|
|
|
254 |
|
|
#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
|
255 |
|
|
do { fputs (LOCAL_COMMON_ASM_OP, (FILE)); \
|
256 |
|
|
RS6000_OUTPUT_BASENAME ((FILE), (NAME)); \
|
257 |
|
|
fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%s\n", \
|
258 |
|
|
(TARGET_32BIT ? (SIZE) : (ROUNDED)), \
|
259 |
|
|
xcoff_bss_section_name); \
|
260 |
|
|
} while (0)
|
261 |
|
|
|
262 |
|
|
/* This is how we tell the assembler that two symbols have the same value. */
|
263 |
|
|
#define SET_ASM_OP "\t.set "
|
264 |
|
|
|
265 |
|
|
/* This is how we tell the assembler to equate two values. */
|
266 |
|
|
#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
|
267 |
|
|
do { fprintf ((FILE), "%s", SET_ASM_OP); \
|
268 |
|
|
RS6000_OUTPUT_BASENAME (FILE, LABEL1); \
|
269 |
|
|
fprintf (FILE, ","); \
|
270 |
|
|
RS6000_OUTPUT_BASENAME (FILE, LABEL2); \
|
271 |
|
|
fprintf (FILE, "\n"); \
|
272 |
|
|
} while (0)
|
273 |
|
|
|
274 |
|
|
/* Used by rs6000_assemble_integer, among others. */
|
275 |
|
|
#define DOUBLE_INT_ASM_OP "\t.llong\t"
|
276 |
|
|
|
277 |
|
|
/* Output before instructions. */
|
278 |
|
|
#define TEXT_SECTION_ASM_OP "\t.csect .text[PR]"
|
279 |
|
|
|
280 |
|
|
/* Output before writable data.
|
281 |
|
|
Align entire section to BIGGEST_ALIGNMENT. */
|
282 |
|
|
#define DATA_SECTION_ASM_OP "\t.csect .data[RW],3"
|
283 |
|
|
|
284 |
|
|
/* Define to prevent DWARF2 unwind info in the data section rather
|
285 |
|
|
than in the .eh_frame section. We do this because the AIX linker
|
286 |
|
|
would otherwise garbage collect these sections. */
|
287 |
|
|
#define EH_FRAME_IN_DATA_SECTION 1
|