1 |
38 |
julius |
/* m68kelf support, derived from m68kv4.h */
|
2 |
|
|
|
3 |
|
|
/* Target definitions for GNU compiler for mc680x0 running System V.4
|
4 |
|
|
Copyright (C) 1991, 1993, 2000, 2002, 2003, 2004, 2007
|
5 |
|
|
Free Software Foundation, Inc.
|
6 |
|
|
|
7 |
|
|
Written by Ron Guilmette (rfg@netcom.com) and Fred Fish (fnf@cygnus.com).
|
8 |
|
|
|
9 |
|
|
This file is part of GCC.
|
10 |
|
|
|
11 |
|
|
GCC is free software; you can redistribute it and/or modify
|
12 |
|
|
it under the terms of the GNU General Public License as published by
|
13 |
|
|
the Free Software Foundation; either version 3, or (at your option)
|
14 |
|
|
any later version.
|
15 |
|
|
|
16 |
|
|
GCC is distributed in the hope that it will be useful,
|
17 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
|
|
GNU General Public License for more details.
|
20 |
|
|
|
21 |
|
|
You should have received a copy of the GNU General Public License
|
22 |
|
|
along with GCC; see the file COPYING3. If not see
|
23 |
|
|
<http://www.gnu.org/licenses/>. */
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
#ifndef SWBEG_ASM_OP
|
27 |
|
|
#define SWBEG_ASM_OP "\t.swbeg\t"
|
28 |
|
|
#endif
|
29 |
|
|
|
30 |
|
|
/* Here are four prefixes that are used by asm_fprintf to
|
31 |
|
|
facilitate customization for alternate assembler syntaxes.
|
32 |
|
|
Machines with no likelihood of an alternate syntax need not
|
33 |
|
|
define these and need not use asm_fprintf. */
|
34 |
|
|
|
35 |
|
|
/* The prefix for register names. Note that REGISTER_NAMES
|
36 |
|
|
is supposed to include this prefix. Also note that this is NOT an
|
37 |
|
|
fprintf format string, it is a literal string */
|
38 |
|
|
|
39 |
|
|
#undef REGISTER_PREFIX
|
40 |
|
|
#define REGISTER_PREFIX "%"
|
41 |
|
|
|
42 |
|
|
/* The prefix for local (compiler generated) labels.
|
43 |
|
|
These labels will not appear in the symbol table. */
|
44 |
|
|
|
45 |
|
|
#undef LOCAL_LABEL_PREFIX
|
46 |
|
|
#define LOCAL_LABEL_PREFIX "."
|
47 |
|
|
|
48 |
|
|
/* The prefix to add to user-visible assembler symbols. */
|
49 |
|
|
|
50 |
|
|
#undef USER_LABEL_PREFIX
|
51 |
|
|
#define USER_LABEL_PREFIX ""
|
52 |
|
|
|
53 |
|
|
/* The prefix for immediate operands. */
|
54 |
|
|
|
55 |
|
|
#undef IMMEDIATE_PREFIX
|
56 |
|
|
#define IMMEDIATE_PREFIX "#"
|
57 |
|
|
|
58 |
|
|
/* In the machine description we can't use %R, because it will not be seen
|
59 |
|
|
by ASM_FPRINTF. (Isn't that a design bug?). */
|
60 |
|
|
|
61 |
|
|
#undef REGISTER_PREFIX_MD
|
62 |
|
|
#define REGISTER_PREFIX_MD "%%"
|
63 |
|
|
|
64 |
|
|
/* config/m68k.md has an explicit reference to the program counter,
|
65 |
|
|
prefix this by the register prefix. */
|
66 |
|
|
|
67 |
|
|
#define ASM_RETURN_CASE_JUMP \
|
68 |
|
|
do { \
|
69 |
|
|
if (TARGET_COLDFIRE) \
|
70 |
|
|
{ \
|
71 |
|
|
if (ADDRESS_REG_P (operands[0])) \
|
72 |
|
|
return "jmp %%pc@(2,%0:l)"; \
|
73 |
|
|
else \
|
74 |
|
|
return "ext%.l %0\n\tjmp %%pc@(2,%0:l)"; \
|
75 |
|
|
} \
|
76 |
|
|
else \
|
77 |
|
|
return "jmp %%pc@(2,%0:w)"; \
|
78 |
|
|
} while (0)
|
79 |
|
|
|
80 |
|
|
/* This is how to output an assembler line that says to advance the
|
81 |
|
|
location counter to a multiple of 2**LOG bytes. */
|
82 |
|
|
|
83 |
|
|
#undef ASM_OUTPUT_ALIGN
|
84 |
|
|
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
|
85 |
|
|
do { \
|
86 |
|
|
if ((LOG) > 0) \
|
87 |
|
|
fprintf ((FILE), "%s%u\n", ALIGN_ASM_OP, 1 << (LOG)); \
|
88 |
|
|
} while (0)
|
89 |
|
|
|
90 |
|
|
/* Use proper assembler syntax for these macros. */
|
91 |
|
|
#undef ASM_OUTPUT_REG_PUSH
|
92 |
|
|
#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
|
93 |
|
|
asm_fprintf (FILE, "\t%Omove.l %s,-(%Rsp)\n", reg_names[REGNO])
|
94 |
|
|
|
95 |
|
|
#undef ASM_OUTPUT_REG_POP
|
96 |
|
|
#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
|
97 |
|
|
asm_fprintf (FILE, "\t%Omove.l (%Rsp)+,%s\n", reg_names[REGNO])
|
98 |
|
|
|
99 |
|
|
/* Override the definition of NO_DOLLAR_IN_LABEL in svr4.h, for special
|
100 |
|
|
g++ assembler names. When this is defined, g++ uses embedded '.'
|
101 |
|
|
characters and some m68k assemblers have problems with this. The
|
102 |
|
|
chances are much greater that any particular assembler will permit
|
103 |
|
|
embedded '$' characters. */
|
104 |
|
|
|
105 |
|
|
#undef NO_DOLLAR_IN_LABEL
|
106 |
|
|
|
107 |
|
|
/* Define PCC_STATIC_STRUCT_RETURN if the convention on the target machine
|
108 |
|
|
is to use the nonreentrant technique for returning structure and union
|
109 |
|
|
values, as commonly implemented by the AT&T Portable C Compiler (PCC).
|
110 |
|
|
When defined, the gcc option -fpcc-struct-return can be used to cause
|
111 |
|
|
this form to be generated. When undefined, the option does nothing.
|
112 |
|
|
For m68k SVR4, the convention is to use a reentrant technique compatible
|
113 |
|
|
with the gcc default, so override the definition of this macro in m68k.h */
|
114 |
|
|
|
115 |
|
|
#undef PCC_STATIC_STRUCT_RETURN
|
116 |
|
|
|
117 |
|
|
/* Local common symbols are declared to the assembler with ".lcomm" rather
|
118 |
|
|
than ".bss", so override the definition in svr4.h */
|
119 |
|
|
|
120 |
|
|
#undef BSS_ASM_OP
|
121 |
|
|
#define BSS_ASM_OP "\t.lcomm\t"
|
122 |
|
|
|
123 |
|
|
/* Register in which address to store a structure value is passed to a
|
124 |
|
|
function. The default in m68k.h is a1. For m68k/SVR4 it is a0. */
|
125 |
|
|
|
126 |
|
|
#undef M68K_STRUCT_VALUE_REGNUM
|
127 |
|
|
#define M68K_STRUCT_VALUE_REGNUM 8
|
128 |
|
|
|
129 |
|
|
#define ASM_COMMENT_START "|"
|
130 |
|
|
|
131 |
|
|
/* Define how the m68k registers should be numbered for Dwarf output.
|
132 |
|
|
The numbering provided here should be compatible with the native
|
133 |
|
|
SVR4 SDB debugger in the m68k/SVR4 reference port, where d0-d7
|
134 |
|
|
are 0-7, a0-a8 are 8-15, and fp0-fp7 are 16-23. */
|
135 |
|
|
|
136 |
|
|
#undef DBX_REGISTER_NUMBER
|
137 |
|
|
#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
|
138 |
|
|
|
139 |
|
|
/* The ASM_OUTPUT_SKIP macro is first defined in m68k.h, using ".skip".
|
140 |
|
|
It is then overridden by m68k/sgs.h to use ".space", and again by svr4.h
|
141 |
|
|
to use ".zero". The m68k/SVR4 assembler uses ".space", so repeat the
|
142 |
|
|
definition from m68k/sgs.h here. Note that ASM_NO_SKIP_IN_TEXT is
|
143 |
|
|
defined in m68k/sgs.h, so we don't have to repeat it here. */
|
144 |
|
|
|
145 |
|
|
#undef ASM_OUTPUT_SKIP
|
146 |
|
|
#define ASM_OUTPUT_SKIP(FILE,SIZE) \
|
147 |
|
|
fprintf (FILE, "%s%u\n", SPACE_ASM_OP, (int)(SIZE))
|
148 |
|
|
|
149 |
|
|
#if 0
|
150 |
|
|
/* SVR4 m68k assembler is bitching on the `comm i,1,1' which askes for
|
151 |
|
|
1 byte alignment. Don't generate alignment for COMMON seems to be
|
152 |
|
|
safer until we the assembler is fixed. */
|
153 |
|
|
#undef ASM_OUTPUT_ALIGNED_COMMON
|
154 |
|
|
/* Same problem with this one. */
|
155 |
|
|
#undef ASM_OUTPUT_ALIGNED_LOCAL
|
156 |
|
|
#endif
|
157 |
|
|
|
158 |
|
|
/* The `string' directive on m68k svr4 does not handle string with
|
159 |
|
|
escape char (i.e., `\') right. Use normal way to output ASCII bytes
|
160 |
|
|
seems to be safer. */
|
161 |
|
|
#undef ASM_OUTPUT_ASCII
|
162 |
|
|
#define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
|
163 |
|
|
do { \
|
164 |
|
|
register int sp = 0, ch; \
|
165 |
|
|
fputs (integer_asm_op (1, TRUE), (FILE)); \
|
166 |
|
|
do { \
|
167 |
|
|
ch = (PTR)[sp]; \
|
168 |
|
|
if (ch > ' ' && ! (ch & 0x80) && ch != '\\') \
|
169 |
|
|
{ \
|
170 |
|
|
fprintf ((FILE), "'%c", ch); \
|
171 |
|
|
} \
|
172 |
|
|
else \
|
173 |
|
|
{ \
|
174 |
|
|
fprintf ((FILE), "0x%x", ch); \
|
175 |
|
|
} \
|
176 |
|
|
if (++sp < (LEN)) \
|
177 |
|
|
{ \
|
178 |
|
|
if ((sp % 10) == 0) \
|
179 |
|
|
{ \
|
180 |
|
|
fprintf ((FILE), "\n%s", integer_asm_op (1, TRUE)); \
|
181 |
|
|
} \
|
182 |
|
|
else \
|
183 |
|
|
{ \
|
184 |
|
|
putc (',', (FILE)); \
|
185 |
|
|
} \
|
186 |
|
|
} \
|
187 |
|
|
} while (sp < (LEN)); \
|
188 |
|
|
putc ('\n', (FILE)); \
|
189 |
|
|
} while (0)
|
190 |
|
|
|
191 |
|
|
#undef ASM_OUTPUT_COMMON
|
192 |
|
|
#undef ASM_OUTPUT_LOCAL
|
193 |
|
|
#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
|
194 |
|
|
( fputs (".comm ", (FILE)), \
|
195 |
|
|
assemble_name ((FILE), (NAME)), \
|
196 |
|
|
fprintf ((FILE), ",%u\n", (int)(SIZE)))
|
197 |
|
|
|
198 |
|
|
#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
|
199 |
|
|
( fputs (".lcomm ", (FILE)), \
|
200 |
|
|
assemble_name ((FILE), (NAME)), \
|
201 |
|
|
fprintf ((FILE), ",%u\n", (int)(SIZE)))
|
202 |
|
|
|
203 |
|
|
/* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to
|
204 |
|
|
keep switch tables in the text section. */
|
205 |
|
|
|
206 |
|
|
#define JUMP_TABLES_IN_TEXT_SECTION 1
|
207 |
|
|
|
208 |
|
|
/* Override the definition in svr4.h. In m68k svr4, using swbeg is the
|
209 |
|
|
standard way to do switch table. */
|
210 |
|
|
#undef ASM_OUTPUT_BEFORE_CASE_LABEL
|
211 |
|
|
#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
|
212 |
|
|
fprintf ((FILE), "%s&%d\n", SWBEG_ASM_OP, XVECLEN (PATTERN (TABLE), 1));
|
213 |
|
|
/* end of stuff from m68kv4.h */
|
214 |
|
|
|
215 |
|
|
#undef ENDFILE_SPEC
|
216 |
|
|
#define ENDFILE_SPEC "crtend.o%s"
|
217 |
|
|
|
218 |
|
|
#undef STARTFILE_SPEC
|
219 |
|
|
#define STARTFILE_SPEC "crtbegin.o%s"
|
220 |
|
|
|
221 |
|
|
/* If defined, a C expression whose value is a string containing the
|
222 |
|
|
assembler operation to identify the following data as
|
223 |
|
|
uninitialized global data. If not defined, and neither
|
224 |
|
|
`ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
|
225 |
|
|
uninitialized global data will be output in the data section if
|
226 |
|
|
`-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
|
227 |
|
|
used. */
|
228 |
|
|
#ifndef BSS_SECTION_ASM_OP
|
229 |
|
|
#define BSS_SECTION_ASM_OP "\t.section\t.bss"
|
230 |
|
|
#endif
|
231 |
|
|
|
232 |
|
|
/* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
|
233 |
|
|
separate, explicit argument. If you define this macro, it is used
|
234 |
|
|
in place of `ASM_OUTPUT_BSS', and gives you more flexibility in
|
235 |
|
|
handling the required alignment of the variable. The alignment is
|
236 |
|
|
specified as the number of bits.
|
237 |
|
|
|
238 |
|
|
Try to use function `asm_output_aligned_bss' defined in file
|
239 |
|
|
`varasm.c' when defining this macro. */
|
240 |
|
|
#ifndef ASM_OUTPUT_ALIGNED_BSS
|
241 |
|
|
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
|
242 |
|
|
asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
|
243 |
|
|
#endif
|