Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* This file is tc-m68k.h |
f7e42eb4 | 2 | Copyright 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, |
9d0e75cb | 3 | 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 |
252b5132 RH |
4 | Free Software Foundation, Inc. |
5 | ||
6 | This file is part of GAS, the GNU Assembler. | |
7 | ||
8 | GAS is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 2, or (at your option) | |
11 | any later version. | |
12 | ||
13 | GAS is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with GAS; see the file COPYING. If not, write to the Free | |
4b4da160 NC |
20 | Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA |
21 | 02110-1301, USA. */ | |
252b5132 RH |
22 | |
23 | #define TC_M68K 1 | |
24 | ||
252b5132 | 25 | struct fix; |
252b5132 RH |
26 | |
27 | #define TARGET_BYTES_BIG_ENDIAN 1 | |
28 | ||
29 | #ifdef OBJ_AOUT | |
30 | #ifdef TE_SUN3 | |
31 | #define TARGET_FORMAT "a.out-sunos-big" | |
32 | #endif | |
33 | #ifdef TE_NetBSD | |
34 | #define TARGET_FORMAT "a.out-m68k-netbsd" | |
35 | #endif | |
36 | #ifdef TE_LINUX | |
37 | #define TARGET_FORMAT "a.out-m68k-linux" | |
38 | #endif | |
39 | #ifndef TARGET_FORMAT | |
40 | #define TARGET_FORMAT "a.out-zero-big" | |
41 | #endif | |
42 | #endif | |
43 | ||
44 | #ifdef OBJ_ELF | |
45 | #define TARGET_FORMAT "elf32-m68k" | |
46 | #endif | |
47 | ||
48 | #ifdef TE_APOLLO | |
49 | #define COFF_MAGIC APOLLOM68KMAGIC | |
50 | #define COFF_AOUTHDR_MAGIC APOLLO_COFF_VERSION_NUMBER | |
51 | #undef OBJ_COFF_OMIT_OPTIONAL_HEADER | |
52 | #endif | |
53 | ||
252b5132 RH |
54 | #ifdef TE_AUX |
55 | #define TARGET_FORMAT "coff-m68k-aux" | |
56 | #endif | |
57 | #ifdef TE_DELTA | |
58 | #define TARGET_FORMAT "coff-m68k-sysv" | |
59 | #endif | |
60 | ||
61 | #ifndef COFF_MAGIC | |
62 | #define COFF_MAGIC MC68MAGIC | |
63 | #endif | |
64 | #define BFD_ARCH bfd_arch_m68k /* for non-BFD_ASSEMBLER */ | |
65 | #define TARGET_ARCH bfd_arch_m68k /* BFD_ASSEMBLER */ | |
66 | #define COFF_FLAGS F_AR32W | |
67 | #define TC_COUNT_RELOC(x) ((x)->fx_addsy||(x)->fx_subsy) | |
68 | ||
a161fe53 | 69 | #define TC_COFF_FIX2RTYPE(FIX) tc_coff_fix2rtype(FIX) |
252b5132 | 70 | #define TC_COFF_SIZEMACHDEP(frag) tc_coff_sizemachdep(frag) |
8f738565 | 71 | extern int tc_coff_sizemachdep (struct frag *); |
252b5132 RH |
72 | #ifdef TE_SUN3 |
73 | /* This variable contains the value to write out at the beginning of | |
74 | the a.out file. The 2<<16 means that this is a 68020 file instead | |
75 | of an old-style 68000 file */ | |
76 | ||
77 | #define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE (2<<16|OMAGIC); /* Magic byte for file header */ | |
78 | #endif /* TE_SUN3 */ | |
79 | ||
80 | #ifndef AOUT_MACHTYPE | |
81 | #define AOUT_MACHTYPE m68k_aout_machtype | |
82 | extern int m68k_aout_machtype; | |
83 | #endif | |
84 | ||
85 | #define tc_comment_chars m68k_comment_chars | |
86 | extern const char *m68k_comment_chars; | |
87 | ||
88 | #define tc_crawl_symbol_chain(a) {;} /* not used */ | |
89 | #define tc_headers_hook(a) {;} /* not used */ | |
90 | #define tc_aout_pre_write_hook(x) {;} /* not used */ | |
91 | ||
92 | #define LISTING_WORD_SIZE 2 /* A word is 2 bytes */ | |
93 | #define LISTING_LHS_WIDTH 2 /* One word on the first line */ | |
94 | #define LISTING_LHS_WIDTH_SECOND 2 /* One word on the second line */ | |
95 | #define LISTING_LHS_CONT_LINES 4/* And 4 lines max */ | |
96 | #define LISTING_HEADER "68K GAS " | |
97 | ||
98 | #ifndef REGISTER_PREFIX | |
99 | #define REGISTER_PREFIX '%' | |
100 | #endif | |
101 | ||
102 | #if !defined (REGISTER_PREFIX_OPTIONAL) | |
103 | #if defined (M68KCOFF) || defined (OBJ_ELF) | |
104 | #ifndef BFD_ASSEMBLER | |
105 | #define LOCAL_LABEL(name) (name[0] == '.' \ | |
106 | && (name[1] == 'L' || name[1] == '.')) | |
107 | #endif /* ! BFD_ASSEMBLER */ | |
108 | #define REGISTER_PREFIX_OPTIONAL 0 | |
109 | #else /* ! (COFF || ELF) */ | |
110 | #define REGISTER_PREFIX_OPTIONAL 1 | |
111 | #endif /* ! (COFF || ELF) */ | |
112 | #endif /* not def REGISTER_PREFIX and not def OPTIONAL_REGISTER_PREFIX */ | |
113 | ||
114 | #ifdef TE_DELTA | |
115 | /* On the Delta, `%' can occur within a label name, but not as the | |
116 | initial character. */ | |
117 | #define LEX_PCT LEX_NAME | |
81d4177b | 118 | /* On the Delta, `~' can start a label name, but is converted to '.'. */ |
252b5132 RH |
119 | #define LEX_TILDE LEX_BEGIN_NAME |
120 | #define tc_canonicalize_symbol_name(s) ((*(s) == '~' ? *(s) = '.' : '.'), s) | |
121 | /* On the Delta, dots are not required before pseudo-ops. */ | |
abd63a32 | 122 | #define NO_PSEUDO_DOT 1 |
252b5132 RH |
123 | #ifndef BFD_ASSEMBLER |
124 | #undef LOCAL_LABEL | |
125 | #define LOCAL_LABEL(name) \ | |
126 | (name[0] == '.' || (name[0] == 'L' && name[1] == '%')) | |
127 | #endif | |
128 | #endif | |
129 | ||
8f738565 | 130 | extern void m68k_mri_mode_change (int); |
252b5132 RH |
131 | #define MRI_MODE_CHANGE(i) m68k_mri_mode_change (i) |
132 | ||
8f738565 | 133 | extern int m68k_conditional_pseudoop (pseudo_typeS *); |
252b5132 RH |
134 | #define tc_conditional_pseudoop(pop) m68k_conditional_pseudoop (pop) |
135 | ||
8f738565 | 136 | extern void m68k_frob_label (symbolS *); |
252b5132 RH |
137 | #define tc_frob_label(sym) m68k_frob_label (sym) |
138 | ||
8f738565 | 139 | extern void m68k_flush_pending_output (void); |
252b5132 RH |
140 | #define md_flush_pending_output() m68k_flush_pending_output () |
141 | ||
8f738565 | 142 | extern void m68k_frob_symbol (symbolS *); |
252b5132 RH |
143 | |
144 | #ifdef BFD_ASSEMBLER | |
145 | ||
146 | #define tc_frob_symbol(sym,punt) \ | |
147 | do \ | |
148 | { \ | |
149 | if (S_GET_SEGMENT (sym) == reg_section) \ | |
150 | punt = 1; \ | |
151 | m68k_frob_symbol (sym); \ | |
152 | } \ | |
153 | while (0) | |
154 | ||
155 | #define NO_RELOC BFD_RELOC_NONE | |
5cbdaa77 NC |
156 | #define RELAX_RELOC_ABS8 BFD_RELOC_8 |
157 | #define RELAX_RELOC_ABS16 BFD_RELOC_16 | |
158 | #define RELAX_RELOC_ABS32 BFD_RELOC_32 | |
159 | #define RELAX_RELOC_PC8 BFD_RELOC_8_PCREL | |
160 | #define RELAX_RELOC_PC16 BFD_RELOC_16_PCREL | |
161 | #define RELAX_RELOC_PC32 BFD_RELOC_32_PCREL | |
252b5132 RH |
162 | |
163 | #ifdef OBJ_ELF | |
8f36cd18 | 164 | #define tc_fix_adjustable(X) tc_m68k_fix_adjustable(X) |
8f738565 | 165 | extern int tc_m68k_fix_adjustable (struct fix *); |
8f36cd18 | 166 | |
6358301e NC |
167 | /* Target *-*-elf implies an embedded target. No shared libs. |
168 | *-*-uclinux also requires special casing to prevent GAS from | |
169 | generating unsupported R_68K_PC16 relocs. */ | |
170 | #define EXTERN_FORCE_RELOC \ | |
171 | ((strcmp (TARGET_OS, "elf") != 0) && (strcmp (TARGET_OS, "uclinux") != 0)) | |
a161fe53 | 172 | |
55cf6793 | 173 | /* Values passed to md_apply_fix don't include symbol values. */ |
a161fe53 | 174 | #define MD_APPLY_SYM_VALUE(FIX) 0 |
02198638 | 175 | |
0d96863f | 176 | #define elf_tc_final_processing m68k_elf_final_processing |
8f738565 | 177 | extern void m68k_elf_final_processing (void); |
252b5132 RH |
178 | #endif |
179 | ||
252b5132 RH |
180 | #else /* ! BFD_ASSEMBLER */ |
181 | ||
182 | #define tc_frob_coff_symbol(sym) m68k_frob_symbol (sym) | |
183 | ||
5cbdaa77 NC |
184 | #define NO_RELOC 0 |
185 | #define RELAX_RELOC_ABS8 0 | |
186 | #define RELAX_RELOC_ABS16 0 | |
187 | #define RELAX_RELOC_ABS32 0 | |
188 | #define RELAX_RELOC_PC8 0 | |
189 | #define RELAX_RELOC_PC16 0 | |
190 | #define RELAX_RELOC_PC32 0 | |
252b5132 RH |
191 | |
192 | #endif /* ! BFD_ASSEMBLER */ | |
193 | ||
194 | #define DIFF_EXPR_OK | |
195 | ||
8f738565 | 196 | extern void m68k_init_after_args (void); |
252b5132 RH |
197 | #define tc_init_after_args m68k_init_after_args |
198 | ||
8f738565 | 199 | extern int m68k_parse_long_option (char *); |
252b5132 RH |
200 | #define md_parse_long_option m68k_parse_long_option |
201 | ||
202 | #define md_operand(x) | |
203 | ||
252b5132 RH |
204 | #define TARGET_ARCH bfd_arch_m68k |
205 | ||
206 | extern struct relax_type md_relax_table[]; | |
207 | #define TC_GENERIC_RELAX_TABLE md_relax_table | |
208 | ||
d7861ad2 AM |
209 | /* We can't do a byte jump to the next instruction, so in that case |
210 | force word mode by faking AIM. */ | |
252b5132 | 211 | #define md_prepare_relax_scan(fragP, address, aim, this_state, this_type) \ |
d7861ad2 AM |
212 | do \ |
213 | { \ | |
214 | if (aim == 0 && this_type->rlx_forward == 127) \ | |
215 | aim = 128; \ | |
216 | } \ | |
217 | while (0) | |
f27a3839 AS |
218 | |
219 | #define DWARF2_LINE_MIN_INSN_LENGTH 2 | |
c04898f8 AS |
220 | |
221 | /* We want .cfi_* pseudo-ops for generating unwind info. */ | |
222 | #define TARGET_USE_CFIPOP 1 | |
223 | ||
224 | #define DWARF2_DEFAULT_RETURN_COLUMN 24 | |
225 | #define DWARF2_CIE_DATA_ALIGNMENT (-4) | |
226 | ||
227 | #define tc_regname_to_dw2regnum tc_m68k_regname_to_dw2regnum | |
228 | extern int tc_m68k_regname_to_dw2regnum (const char *regname); | |
229 | ||
230 | #define tc_cfi_frame_initial_instructions tc_m68k_frame_initial_instructions | |
231 | extern void tc_m68k_frame_initial_instructions (void); |