1 /* This file is tc-m68k.h 2 Copyright (C) 1987-2016 Free Software Foundation, Inc. 3 4 This file is part of GAS, the GNU Assembler. 5 6 GAS is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 3, or (at your option) 9 any later version. 10 11 GAS is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with GAS; see the file COPYING. If not, write to the Free 18 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 19 02110-1301, USA. */ 20 21 #define TC_M68K 1 22 23 struct fix; 24 25 #define TARGET_BYTES_BIG_ENDIAN 1 26 27 #ifdef OBJ_AOUT 28 #ifdef TE_SUN3 29 #define TARGET_FORMAT "a.out-sunos-big" 30 #endif 31 #ifdef TE_NetBSD 32 #define TARGET_FORMAT "a.out-m68k-netbsd" 33 #endif 34 #ifdef TE_LINUX 35 #define TARGET_FORMAT "a.out-m68k-linux" 36 #endif 37 #ifndef TARGET_FORMAT 38 #define TARGET_FORMAT "a.out-zero-big" 39 #endif 40 #endif 41 42 #ifdef OBJ_ELF 43 #define TARGET_FORMAT "elf32-m68k" 44 #endif 45 46 #ifdef TE_APOLLO 47 #define COFF_MAGIC APOLLOM68KMAGIC 48 #define COFF_AOUTHDR_MAGIC APOLLO_COFF_VERSION_NUMBER 49 #undef OBJ_COFF_OMIT_OPTIONAL_HEADER 50 #endif 51 52 #ifdef TE_AUX 53 #define TARGET_FORMAT "coff-m68k-aux" 54 #endif 55 #ifdef TE_DELTA 56 #define TARGET_FORMAT "coff-m68k-sysv" 57 #endif 58 59 #ifndef COFF_MAGIC 60 #define COFF_MAGIC MC68MAGIC 61 #endif 62 #define TARGET_ARCH bfd_arch_m68k 63 64 #define tc_comment_chars m68k_comment_chars 65 extern const char *m68k_comment_chars; 66 67 #define LISTING_WORD_SIZE 2 /* A word is 2 bytes */ 68 #define LISTING_LHS_WIDTH 2 /* One word on the first line */ 69 #define LISTING_LHS_WIDTH_SECOND 2 /* One word on the second line */ 70 #define LISTING_LHS_CONT_LINES 4/* And 4 lines max */ 71 #define LISTING_HEADER "68K GAS " 72 73 #ifndef REGISTER_PREFIX 74 #define REGISTER_PREFIX '%' 75 #endif 76 77 #if !defined (REGISTER_PREFIX_OPTIONAL) 78 #if defined (M68KCOFF) || defined (OBJ_ELF) 79 #define REGISTER_PREFIX_OPTIONAL 0 80 #else /* ! (COFF || ELF) */ 81 #define REGISTER_PREFIX_OPTIONAL 1 82 #endif /* ! (COFF || ELF) */ 83 #endif /* not def REGISTER_PREFIX and not def OPTIONAL_REGISTER_PREFIX */ 84 85 #ifdef TE_DELTA 86 /* On the Delta, `%' can occur within a label name, but not as the 87 initial character. */ 88 #define LEX_PCT LEX_NAME 89 /* On the Delta, `~' can start a label name, but is converted to '.'. */ 90 #define LEX_TILDE LEX_BEGIN_NAME 91 #define tc_canonicalize_symbol_name(s) ((*(s) == '~' ? *(s) = '.' : '.'), s) 92 /* On the Delta, dots are not required before pseudo-ops. */ 93 #define NO_PSEUDO_DOT 1 94 #endif 95 96 extern void m68k_mri_mode_change (int); 97 #define MRI_MODE_CHANGE(i) m68k_mri_mode_change (i) 98 99 extern int m68k_conditional_pseudoop (pseudo_typeS *); 100 #define tc_conditional_pseudoop(pop) m68k_conditional_pseudoop (pop) 101 102 extern void m68k_frob_label (symbolS *); 103 #define tc_frob_label(sym) m68k_frob_label (sym) 104 105 extern void m68k_flush_pending_output (void); 106 #define md_flush_pending_output() m68k_flush_pending_output () 107 108 extern void m68k_frob_symbol (symbolS *); 109 110 #define tc_frob_symbol(sym,punt) \ 111 do \ 112 { \ 113 if (S_GET_SEGMENT (sym) == reg_section) \ 114 punt = 1; \ 115 m68k_frob_symbol (sym); \ 116 } \ 117 while (0) 118 119 #define NO_RELOC BFD_RELOC_NONE 120 #define RELAX_RELOC_ABS8 BFD_RELOC_8 121 #define RELAX_RELOC_ABS16 BFD_RELOC_16 122 #define RELAX_RELOC_ABS32 BFD_RELOC_32 123 #define RELAX_RELOC_PC8 BFD_RELOC_8_PCREL 124 #define RELAX_RELOC_PC16 BFD_RELOC_16_PCREL 125 #define RELAX_RELOC_PC32 BFD_RELOC_32_PCREL 126 127 #ifdef OBJ_ELF 128 #define tc_fix_adjustable(X) tc_m68k_fix_adjustable(X) 129 extern int tc_m68k_fix_adjustable (struct fix *); 130 131 /* Target *-*-elf implies an embedded target. No shared libs. 132 *-*-uclinux also requires special casing to prevent GAS from 133 generating unsupported R_68K_PC16 relocs. */ 134 #define EXTERN_FORCE_RELOC \ 135 ((strcmp (TARGET_OS, "elf") != 0) && (strcmp (TARGET_OS, "uclinux") != 0)) 136 137 /* Values passed to md_apply_fix don't include symbol values. */ 138 #define MD_APPLY_SYM_VALUE(FIX) 0 139 140 #define elf_tc_final_processing m68k_elf_final_processing 141 extern void m68k_elf_final_processing (void); 142 #endif 143 144 #define DIFF_EXPR_OK 145 146 extern int m68k_parse_long_option (char *); 147 #define md_parse_long_option m68k_parse_long_option 148 149 #define md_operand(x) 150 151 #define TARGET_ARCH bfd_arch_m68k 152 153 extern struct relax_type md_relax_table[]; 154 #define TC_GENERIC_RELAX_TABLE md_relax_table 155 156 /* We can't do a byte jump to the next instruction, so in that case 157 force word mode by faking AIM. */ 158 #define md_prepare_relax_scan(fragP, address, aim, this_state, this_type) \ 159 do \ 160 { \ 161 if (aim == 0 && this_type->rlx_forward == 127) \ 162 aim = 128; \ 163 } \ 164 while (0) 165 166 #define DWARF2_LINE_MIN_INSN_LENGTH 2 167 168 /* We want .cfi_* pseudo-ops for generating unwind info. */ 169 #define TARGET_USE_CFIPOP 1 170 171 #define DWARF2_DEFAULT_RETURN_COLUMN 24 172 #define DWARF2_CIE_DATA_ALIGNMENT (-4) 173 174 #define tc_regname_to_dw2regnum tc_m68k_regname_to_dw2regnum 175 extern int tc_m68k_regname_to_dw2regnum (const char *regname); 176 177 #define tc_cfi_frame_initial_instructions tc_m68k_frame_initial_instructions 178 extern void tc_m68k_frame_initial_instructions (void); 179 180 #ifdef TE_UCLINUX 181 /* elf2flt does not honor PT_LOAD's from the executable. 182 .text and .eh_frame sections will not end up in the same segment and so 183 we cannot use PC-relative encoding for CFI. */ 184 # define CFI_DIFF_EXPR_OK 0 185 186 /* However, follow compiler's guidance when it specifies encoding for LSDA. */ 187 # define CFI_DIFF_LSDA_OK 1 188 #endif 189 190 struct broken_word; 191 #define TC_CHECK_ADJUSTED_BROKEN_DOT_WORD(new_offset, brokw) \ 192 tc_m68k_check_adjusted_broken_word ((offsetT) (new_offset), (brokw)) 193 extern void tc_m68k_check_adjusted_broken_word (offsetT, 194 struct broken_word *); 195