| 1 | /* This file is tc-m68k.h |
| 2 | Copyright 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, |
| 3 | 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007 |
| 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 3, 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 |
| 20 | Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA |
| 21 | 02110-1301, USA. */ |
| 22 | |
| 23 | #define TC_M68K 1 |
| 24 | |
| 25 | struct fix; |
| 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 | |
| 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 TARGET_ARCH bfd_arch_m68k |
| 65 | |
| 66 | #define tc_comment_chars m68k_comment_chars |
| 67 | extern const char *m68k_comment_chars; |
| 68 | |
| 69 | #define LISTING_WORD_SIZE 2 /* A word is 2 bytes */ |
| 70 | #define LISTING_LHS_WIDTH 2 /* One word on the first line */ |
| 71 | #define LISTING_LHS_WIDTH_SECOND 2 /* One word on the second line */ |
| 72 | #define LISTING_LHS_CONT_LINES 4/* And 4 lines max */ |
| 73 | #define LISTING_HEADER "68K GAS " |
| 74 | |
| 75 | #ifndef REGISTER_PREFIX |
| 76 | #define REGISTER_PREFIX '%' |
| 77 | #endif |
| 78 | |
| 79 | #if !defined (REGISTER_PREFIX_OPTIONAL) |
| 80 | #if defined (M68KCOFF) || defined (OBJ_ELF) |
| 81 | #define REGISTER_PREFIX_OPTIONAL 0 |
| 82 | #else /* ! (COFF || ELF) */ |
| 83 | #define REGISTER_PREFIX_OPTIONAL 1 |
| 84 | #endif /* ! (COFF || ELF) */ |
| 85 | #endif /* not def REGISTER_PREFIX and not def OPTIONAL_REGISTER_PREFIX */ |
| 86 | |
| 87 | #ifdef TE_DELTA |
| 88 | /* On the Delta, `%' can occur within a label name, but not as the |
| 89 | initial character. */ |
| 90 | #define LEX_PCT LEX_NAME |
| 91 | /* On the Delta, `~' can start a label name, but is converted to '.'. */ |
| 92 | #define LEX_TILDE LEX_BEGIN_NAME |
| 93 | #define tc_canonicalize_symbol_name(s) ((*(s) == '~' ? *(s) = '.' : '.'), s) |
| 94 | /* On the Delta, dots are not required before pseudo-ops. */ |
| 95 | #define NO_PSEUDO_DOT 1 |
| 96 | #endif |
| 97 | |
| 98 | extern void m68k_mri_mode_change (int); |
| 99 | #define MRI_MODE_CHANGE(i) m68k_mri_mode_change (i) |
| 100 | |
| 101 | extern int m68k_conditional_pseudoop (pseudo_typeS *); |
| 102 | #define tc_conditional_pseudoop(pop) m68k_conditional_pseudoop (pop) |
| 103 | |
| 104 | extern void m68k_frob_label (symbolS *); |
| 105 | #define tc_frob_label(sym) m68k_frob_label (sym) |
| 106 | |
| 107 | extern void m68k_flush_pending_output (void); |
| 108 | #define md_flush_pending_output() m68k_flush_pending_output () |
| 109 | |
| 110 | extern void m68k_frob_symbol (symbolS *); |
| 111 | |
| 112 | #define tc_frob_symbol(sym,punt) \ |
| 113 | do \ |
| 114 | { \ |
| 115 | if (S_GET_SEGMENT (sym) == reg_section) \ |
| 116 | punt = 1; \ |
| 117 | m68k_frob_symbol (sym); \ |
| 118 | } \ |
| 119 | while (0) |
| 120 | |
| 121 | #define NO_RELOC BFD_RELOC_NONE |
| 122 | #define RELAX_RELOC_ABS8 BFD_RELOC_8 |
| 123 | #define RELAX_RELOC_ABS16 BFD_RELOC_16 |
| 124 | #define RELAX_RELOC_ABS32 BFD_RELOC_32 |
| 125 | #define RELAX_RELOC_PC8 BFD_RELOC_8_PCREL |
| 126 | #define RELAX_RELOC_PC16 BFD_RELOC_16_PCREL |
| 127 | #define RELAX_RELOC_PC32 BFD_RELOC_32_PCREL |
| 128 | |
| 129 | #ifdef OBJ_ELF |
| 130 | #define tc_fix_adjustable(X) tc_m68k_fix_adjustable(X) |
| 131 | extern int tc_m68k_fix_adjustable (struct fix *); |
| 132 | |
| 133 | /* Target *-*-elf implies an embedded target. No shared libs. |
| 134 | *-*-uclinux also requires special casing to prevent GAS from |
| 135 | generating unsupported R_68K_PC16 relocs. */ |
| 136 | #define EXTERN_FORCE_RELOC \ |
| 137 | ((strcmp (TARGET_OS, "elf") != 0) && (strcmp (TARGET_OS, "uclinux") != 0)) |
| 138 | |
| 139 | /* Values passed to md_apply_fix don't include symbol values. */ |
| 140 | #define MD_APPLY_SYM_VALUE(FIX) 0 |
| 141 | |
| 142 | #define elf_tc_final_processing m68k_elf_final_processing |
| 143 | extern void m68k_elf_final_processing (void); |
| 144 | #endif |
| 145 | |
| 146 | #define DIFF_EXPR_OK |
| 147 | |
| 148 | extern int m68k_parse_long_option (char *); |
| 149 | #define md_parse_long_option m68k_parse_long_option |
| 150 | |
| 151 | #define md_operand(x) |
| 152 | |
| 153 | #define TARGET_ARCH bfd_arch_m68k |
| 154 | |
| 155 | extern struct relax_type md_relax_table[]; |
| 156 | #define TC_GENERIC_RELAX_TABLE md_relax_table |
| 157 | |
| 158 | /* We can't do a byte jump to the next instruction, so in that case |
| 159 | force word mode by faking AIM. */ |
| 160 | #define md_prepare_relax_scan(fragP, address, aim, this_state, this_type) \ |
| 161 | do \ |
| 162 | { \ |
| 163 | if (aim == 0 && this_type->rlx_forward == 127) \ |
| 164 | aim = 128; \ |
| 165 | } \ |
| 166 | while (0) |
| 167 | |
| 168 | #define DWARF2_LINE_MIN_INSN_LENGTH 2 |
| 169 | |
| 170 | /* We want .cfi_* pseudo-ops for generating unwind info. */ |
| 171 | #define TARGET_USE_CFIPOP 1 |
| 172 | |
| 173 | #define DWARF2_DEFAULT_RETURN_COLUMN 24 |
| 174 | #define DWARF2_CIE_DATA_ALIGNMENT (-4) |
| 175 | |
| 176 | #define tc_regname_to_dw2regnum tc_m68k_regname_to_dw2regnum |
| 177 | extern int tc_m68k_regname_to_dw2regnum (char *regname); |
| 178 | |
| 179 | #define tc_cfi_frame_initial_instructions tc_m68k_frame_initial_instructions |
| 180 | extern void tc_m68k_frame_initial_instructions (void); |