OSDN Git Service

2009-06-16 H.J. Lu <hongjiu.lu@intel.com>
[pf3gnuchains/gcc-fork.git] / gcc / config / m68k / m68kelf.h
1 /* 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 three 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 /* config/m68k.md has an explicit reference to the program counter,
54    prefix this by the register prefix.  */
55
56 #define ASM_RETURN_CASE_JUMP                            \
57   do {                                                  \
58     if (TARGET_COLDFIRE)                                \
59       {                                                 \
60         if (ADDRESS_REG_P (operands[0]))                \
61           return "jmp %%pc@(2,%0:l)";                   \
62         else                                            \
63           return "ext%.l %0\n\tjmp %%pc@(2,%0:l)";      \
64       }                                                 \
65     else                                                \
66       return "jmp %%pc@(2,%0:w)";                       \
67   } while (0)
68
69 /* This is how to output an assembler line that says to advance the
70    location counter to a multiple of 2**LOG bytes.  */
71
72 #undef ASM_OUTPUT_ALIGN
73 #define ASM_OUTPUT_ALIGN(FILE,LOG)                              \
74 do {                                                            \
75   if ((LOG) > 0)                                                \
76     fprintf ((FILE), "%s%u\n", ALIGN_ASM_OP, 1 << (LOG));       \
77 } while (0)
78
79 /* Register in which address to store a structure value is passed to a
80    function.  The default in m68k.h is a1.  For m68k/SVR4 it is a0.  */
81
82 #undef M68K_STRUCT_VALUE_REGNUM
83 #define M68K_STRUCT_VALUE_REGNUM A0_REG
84
85 /* The static chain regnum defaults to a0, but we use that for
86    structure return, so have to use a1 for the static chain.  */
87
88 #undef STATIC_CHAIN_REGNUM
89 #define STATIC_CHAIN_REGNUM A1_REG
90 #undef M68K_STATIC_CHAIN_REG_NAME
91 #define M68K_STATIC_CHAIN_REG_NAME REGISTER_PREFIX "a1"
92
93 #define ASM_COMMENT_START "|"
94
95 /* Define how the m68k registers should be numbered for Dwarf output.
96    The numbering provided here should be compatible with the native
97    SVR4 SDB debugger in the m68k/SVR4 reference port, where d0-d7
98    are 0-7, a0-a8 are 8-15, and fp0-fp7 are 16-23.  */
99
100 #undef DBX_REGISTER_NUMBER
101 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
102
103 #if 0
104 /* SVR4 m68k assembler is bitching on the `comm i,1,1' which askes for 
105    1 byte alignment. Don't generate alignment for COMMON seems to be
106    safer until we the assembler is fixed.  */
107 #undef ASM_OUTPUT_ALIGNED_COMMON
108 /* Same problem with this one.  */
109 #undef ASM_OUTPUT_ALIGNED_LOCAL
110 #endif
111
112 #undef ASM_OUTPUT_COMMON
113 #undef ASM_OUTPUT_LOCAL
114 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)  \
115 ( fputs (".comm ", (FILE)),                     \
116   assemble_name ((FILE), (NAME)),               \
117   fprintf ((FILE), ",%u\n", (int)(SIZE)))
118
119 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)  \
120 ( fputs (".lcomm ", (FILE)),                    \
121   assemble_name ((FILE), (NAME)),               \
122   fprintf ((FILE), ",%u\n", (int)(SIZE)))
123
124 /* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to
125    keep switch tables in the text section.  */
126    
127 #define JUMP_TABLES_IN_TEXT_SECTION 1
128
129 /* Override the definition in svr4.h. In m68k svr4, using swbeg is the 
130    standard way to do switch table.  */
131 #undef ASM_OUTPUT_BEFORE_CASE_LABEL
132 #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE)             \
133   fprintf ((FILE), "%s&%d\n", SWBEG_ASM_OP, XVECLEN (PATTERN (TABLE), 1));
134 /* end of stuff from m68kv4.h */
135
136 #undef ENDFILE_SPEC
137 #define ENDFILE_SPEC "crtend.o%s"
138
139 #undef  STARTFILE_SPEC
140 #define STARTFILE_SPEC "crtbegin.o%s"
141
142 /* If defined, a C expression whose value is a string containing the
143    assembler operation to identify the following data as
144    uninitialized global data.  If not defined, and neither
145    `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
146    uninitialized global data will be output in the data section if
147    `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
148    used.  */
149 #ifndef BSS_SECTION_ASM_OP
150 #define BSS_SECTION_ASM_OP      "\t.section\t.bss"
151 #endif
152
153 /* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
154    separate, explicit argument.  If you define this macro, it is used
155    in place of `ASM_OUTPUT_BSS', and gives you more flexibility in
156    handling the required alignment of the variable.  The alignment is
157    specified as the number of bits.
158
159    Try to use function `asm_output_aligned_bss' defined in file
160    `varasm.c' when defining this macro.  */
161 #ifndef ASM_OUTPUT_ALIGNED_BSS
162 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
163   asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
164 #endif