]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/m68k/m68kelf.h
* config/stormy16/stormy16.c
[thirdparty/gcc.git] / gcc / config / m68k / m68kelf.h
CommitLineData
d1be3be3
JW
1/* m68kelf support, derived from m68kv4.h */
2
3/* Target definitions for GNU compiler for mc680x0 running System V.4
ca11c37c 4 Copyright (C) 1991, 1993, 2000, 2002, 2003 Free Software Foundation, Inc.
d1be3be3
JW
5
6 Written by Ron Guilmette (rfg@netcom.com) and Fred Fish (fnf@cygnus.com).
7
7ec022b2 8This file is part of GCC.
d1be3be3 9
7ec022b2 10GCC is free software; you can redistribute it and/or modify
d1be3be3
JW
11it under the terms of the GNU General Public License as published by
12the Free Software Foundation; either version 2, or (at your option)
13any later version.
14
7ec022b2 15GCC is distributed in the hope that it will be useful,
d1be3be3
JW
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
7ec022b2 21along with GCC; see the file COPYING. If not, write to
5f38fdda
JL
22the Free Software Foundation, 59 Temple Place - Suite 330,
23Boston, MA 02111-1307, USA. */
d1be3be3 24
d1be3be3
JW
25
26#ifndef SWBEG_ASM_OP
6e7b07a7 27#define SWBEG_ASM_OP "\t.swbeg\t"
d1be3be3
JW
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.
7a1929e1 43 These labels will not appear in the symbol table. */
d1be3be3
JW
44
45#undef LOCAL_LABEL_PREFIX
46#define LOCAL_LABEL_PREFIX "."
47
7a1929e1 48/* The prefix to add to user-visible assembler symbols. */
d1be3be3
JW
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
c1c1d123
AS
67#define ASM_RETURN_CASE_JUMP \
68 do { \
9425fb04 69 if (TARGET_COLDFIRE) \
c1c1d123
AS
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)"; \
2d37187d 78 } while (0)
d1be3be3
JW
79
80/* How to refer to registers in assembler output.
81 This sequence is indexed by compiler's hard-register-number.
82 Motorola format uses different register names than defined
83 in m68k.h. */
84
85#undef REGISTER_NAMES
86
87#define REGISTER_NAMES \
88{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
89 "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp", \
860c4900 90 "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7", "argptr" }
d1be3be3
JW
91
92/* This is how to output an assembler line that says to advance the
93 location counter to a multiple of 2**LOG bytes. */
94
95#undef ASM_OUTPUT_ALIGN
96#define ASM_OUTPUT_ALIGN(FILE,LOG) \
046b71ed 97do { \
d1be3be3 98 if ((LOG) > 0) \
016c8440 99 fprintf ((FILE), "%s%u\n", ALIGN_ASM_OP, 1 << (LOG)); \
d1be3be3 100 else if ((LOG) > 31) \
046b71ed
KG
101 abort (); \
102} while (0)
d1be3be3
JW
103
104/* Use proper assembler syntax for these macros. */
105#undef ASM_OUTPUT_REG_PUSH
106#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
107 asm_fprintf (FILE, "\t%Omove.l %s,-(%Rsp)\n", reg_names[REGNO])
108
109#undef ASM_OUTPUT_REG_POP
110#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
111 asm_fprintf (FILE, "\t%Omove.l (%Rsp)+,%s\n", reg_names[REGNO])
112
113/* Override the definition of NO_DOLLAR_IN_LABEL in svr4.h, for special
114 g++ assembler names. When this is defined, g++ uses embedded '.'
115 characters and some m68k assemblers have problems with this. The
116 chances are much greater that any particular assembler will permit
7a1929e1 117 embedded '$' characters. */
d1be3be3
JW
118
119#undef NO_DOLLAR_IN_LABEL
120
121/* Define PCC_STATIC_STRUCT_RETURN if the convention on the target machine
122 is to use the nonreentrant technique for returning structure and union
123 values, as commonly implemented by the AT&T Portable C Compiler (PCC).
124 When defined, the gcc option -fpcc-struct-return can be used to cause
125 this form to be generated. When undefined, the option does nothing.
126 For m68k SVR4, the convention is to use a reentrant technique compatible
127 with the gcc default, so override the definition of this macro in m68k.h */
128
129#undef PCC_STATIC_STRUCT_RETURN
130
131/* Local common symbols are declared to the assembler with ".lcomm" rather
132 than ".bss", so override the definition in svr4.h */
133
134#undef BSS_ASM_OP
6e7b07a7 135#define BSS_ASM_OP "\t.lcomm\t"
d1be3be3
JW
136
137/* Register in which address to store a structure value is passed to a
7a1929e1 138 function. The default in m68k.h is a1. For m68k/SVR4 it is a0. */
d1be3be3
JW
139
140#undef STRUCT_VALUE_REGNUM
141#define STRUCT_VALUE_REGNUM 8
142
143#define ASM_COMMENT_START "|"
144
d1be3be3
JW
145/* Define how the m68k registers should be numbered for Dwarf output.
146 The numbering provided here should be compatible with the native
147 SVR4 SDB debugger in the m68k/SVR4 reference port, where d0-d7
7a1929e1 148 are 0-7, a0-a8 are 8-15, and fp0-fp7 are 16-23. */
d1be3be3
JW
149
150#undef DBX_REGISTER_NUMBER
151#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
152
153/* The ASM_OUTPUT_SKIP macro is first defined in m68k.h, using ".skip".
154 It is then overridden by m68k/sgs.h to use ".space", and again by svr4.h
155 to use ".zero". The m68k/SVR4 assembler uses ".space", so repeat the
156 definition from m68k/sgs.h here. Note that ASM_NO_SKIP_IN_TEXT is
7a1929e1 157 defined in m68k/sgs.h, so we don't have to repeat it here. */
d1be3be3
JW
158
159#undef ASM_OUTPUT_SKIP
160#define ASM_OUTPUT_SKIP(FILE,SIZE) \
58e15542 161 fprintf (FILE, "%s%u\n", SPACE_ASM_OP, (int)(SIZE))
d1be3be3
JW
162
163#if 0
164/* SVR4 m68k assembler is bitching on the `comm i,1,1' which askes for
165 1 byte alignment. Don't generate alignment for COMMON seems to be
7a1929e1 166 safer until we the assembler is fixed. */
d1be3be3
JW
167#undef ASM_OUTPUT_ALIGNED_COMMON
168/* Same problem with this one. */
169#undef ASM_OUTPUT_ALIGNED_LOCAL
170#endif
171
172/* The `string' directive on m68k svr4 does not handle string with
173 escape char (ie., `\') right. Use normal way to output ASCII bytes
7a1929e1 174 seems to be safer. */
d1be3be3
JW
175#undef ASM_OUTPUT_ASCII
176#define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
177do { \
e59f7d3d 178 register int sp = 0, ch; \
301d03af 179 fputs (integer_asm_op (1, TRUE), (FILE)); \
d1be3be3
JW
180 do { \
181 ch = (PTR)[sp]; \
182 if (ch > ' ' && ! (ch & 0x80) && ch != '\\') \
183 { \
184 fprintf ((FILE), "'%c", ch); \
185 } \
186 else \
187 { \
188 fprintf ((FILE), "0x%x", ch); \
189 } \
190 if (++sp < (LEN)) \
191 { \
192 if ((sp % 10) == 0) \
193 { \
301d03af 194 fprintf ((FILE), "\n%s", integer_asm_op (1, TRUE)); \
d1be3be3
JW
195 } \
196 else \
197 { \
198 putc (',', (FILE)); \
199 } \
200 } \
201 } while (sp < (LEN)); \
202 putc ('\n', (FILE)); \
203} while (0)
204
205/* SVR4 m68k assembler is bitching on the syntax `2.b'.
206 So use the "LLDnnn-LLnnn" format. Define LLDnnn after the table. */
207
208#undef ASM_OUTPUT_CASE_END
209#define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE) \
210do { \
211 if (switch_table_difference_label_flag) \
016c8440 212 asm_fprintf ((FILE), "%s%LLD%d,%LL%d\n", SET_ASM_OP, (NUM), (NUM)); \
d1be3be3
JW
213 switch_table_difference_label_flag = 0; \
214} while (0)
215
216extern int switch_table_difference_label_flag;
217
218#undef ASM_OUTPUT_COMMON
219#undef ASM_OUTPUT_LOCAL
220#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
221( fputs (".comm ", (FILE)), \
222 assemble_name ((FILE), (NAME)), \
58e15542 223 fprintf ((FILE), ",%u\n", (int)(SIZE)))
d1be3be3
JW
224
225#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
226( fputs (".lcomm ", (FILE)), \
227 assemble_name ((FILE), (NAME)), \
58e15542 228 fprintf ((FILE), ",%u\n", (int)(SIZE)))
d1be3be3
JW
229
230/* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to
7a1929e1 231 keep switch tables in the text section. */
d1be3be3
JW
232
233#define JUMP_TABLES_IN_TEXT_SECTION 1
234
235/* Override the definition in svr4.h. In m68k svr4, using swbeg is the
7a1929e1 236 standard way to do switch table. */
d1be3be3
JW
237#undef ASM_OUTPUT_BEFORE_CASE_LABEL
238#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
016c8440 239 fprintf ((FILE), "%s&%d\n", SWBEG_ASM_OP, XVECLEN (PATTERN (TABLE), 1));
d1be3be3
JW
240/* end of stuff from m68kv4.h */
241
d1be3be3
JW
242#undef ENDFILE_SPEC
243#define ENDFILE_SPEC "crtend.o%s"
244
245#undef STARTFILE_SPEC
246#define STARTFILE_SPEC "crtbegin.o%s"
48b1580e
VM
247
248/* If defined, a C expression whose value is a string containing the
249 assembler operation to identify the following data as
250 uninitialized global data. If not defined, and neither
251 `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
252 uninitialized global data will be output in the data section if
253 `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
254 used. */
255#ifndef BSS_SECTION_ASM_OP
6e7b07a7 256#define BSS_SECTION_ASM_OP "\t.section\t.bss"
48b1580e
VM
257#endif
258
259/* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
260 separate, explicit argument. If you define this macro, it is used
261 in place of `ASM_OUTPUT_BSS', and gives you more flexibility in
262 handling the required alignment of the variable. The alignment is
263 specified as the number of bits.
264
265 Try to use function `asm_output_aligned_bss' defined in file
7a1929e1 266 `varasm.c' when defining this macro. */
48b1580e
VM
267#ifndef ASM_OUTPUT_ALIGNED_BSS
268#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
269 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
270#endif