1 /* This file is tc-m68k.h 2 Copyright (C) 1987, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000 3 Free Software Foundation, Inc. 4 5 This file is part of GAS, the GNU Assembler. 6 7 GAS is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation; either version 2, or (at your option) 10 any later version. 11 12 GAS is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with GAS; see the file COPYING. If not, write to the Free 19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 20 02111-1307, USA. */ 21 22 #define TC_M68K 1 23 24 #ifdef ANSI_PROTOTYPES 25 struct fix; 26 #endif 27 28 #define TARGET_BYTES_BIG_ENDIAN 1 29 30 #ifdef OBJ_AOUT 31 #ifdef TE_SUN3 32 #define TARGET_FORMAT "a.out-sunos-big" 33 #endif 34 #ifdef TE_NetBSD 35 #define TARGET_FORMAT "a.out-m68k-netbsd" 36 #endif 37 #ifdef TE_LINUX 38 #define TARGET_FORMAT "a.out-m68k-linux" 39 #endif 40 #ifndef TARGET_FORMAT 41 #define TARGET_FORMAT "a.out-zero-big" 42 #endif 43 #endif 44 45 #ifdef OBJ_ELF 46 #define TARGET_FORMAT "elf32-m68k" 47 #endif 48 49 #ifdef TE_APOLLO 50 #define COFF_MAGIC APOLLOM68KMAGIC 51 #define COFF_AOUTHDR_MAGIC APOLLO_COFF_VERSION_NUMBER 52 #undef OBJ_COFF_OMIT_OPTIONAL_HEADER 53 #endif 54 55 #ifdef TE_LYNX 56 #define TARGET_FORMAT "coff-m68k-lynx" 57 #endif 58 #ifdef TE_AUX 59 #define TARGET_FORMAT "coff-m68k-aux" 60 #endif 61 #ifdef TE_DELTA 62 #define TARGET_FORMAT "coff-m68k-sysv" 63 #endif 64 65 #ifndef COFF_MAGIC 66 #define COFF_MAGIC MC68MAGIC 67 #endif 68 #define BFD_ARCH bfd_arch_m68k /* for non-BFD_ASSEMBLER */ 69 #define TARGET_ARCH bfd_arch_m68k /* BFD_ASSEMBLER */ 70 #define COFF_FLAGS F_AR32W 71 #define TC_COUNT_RELOC(x) ((x)->fx_addsy||(x)->fx_subsy) 72 73 #define TC_COFF_FIX2RTYPE(fixP) tc_coff_fix2rtype(fixP) 74 #define TC_COFF_SIZEMACHDEP(frag) tc_coff_sizemachdep(frag) 75 extern int tc_coff_sizemachdep PARAMS ((struct frag *)); 76 #ifdef TE_SUN3 77 /* This variable contains the value to write out at the beginning of 78 the a.out file. The 2<<16 means that this is a 68020 file instead 79 of an old-style 68000 file */ 80 81 #define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE (2<<16|OMAGIC); /* Magic byte for file header */ 82 #endif /* TE_SUN3 */ 83 84 #ifndef AOUT_MACHTYPE 85 #define AOUT_MACHTYPE m68k_aout_machtype 86 extern int m68k_aout_machtype; 87 #endif 88 89 #define tc_comment_chars m68k_comment_chars 90 extern const char *m68k_comment_chars; 91 92 #define tc_crawl_symbol_chain(a) {;} /* not used */ 93 #define tc_headers_hook(a) {;} /* not used */ 94 #define tc_aout_pre_write_hook(x) {;} /* not used */ 95 96 #define LISTING_WORD_SIZE 2 /* A word is 2 bytes */ 97 #define LISTING_LHS_WIDTH 2 /* One word on the first line */ 98 #define LISTING_LHS_WIDTH_SECOND 2 /* One word on the second line */ 99 #define LISTING_LHS_CONT_LINES 4/* And 4 lines max */ 100 #define LISTING_HEADER "68K GAS " 101 102 #ifndef REGISTER_PREFIX 103 #define REGISTER_PREFIX '%' 104 #endif 105 106 #if !defined (REGISTER_PREFIX_OPTIONAL) 107 #if defined (M68KCOFF) || defined (OBJ_ELF) 108 #ifndef BFD_ASSEMBLER 109 #define LOCAL_LABEL(name) (name[0] == '.' \ 110 && (name[1] == 'L' || name[1] == '.')) 111 #endif /* ! BFD_ASSEMBLER */ 112 #define REGISTER_PREFIX_OPTIONAL 0 113 #else /* ! (COFF || ELF) */ 114 #define REGISTER_PREFIX_OPTIONAL 1 115 #endif /* ! (COFF || ELF) */ 116 #endif /* not def REGISTER_PREFIX and not def OPTIONAL_REGISTER_PREFIX */ 117 118 #ifdef TE_DELTA 119 /* On the Delta, `%' can occur within a label name, but not as the 120 initial character. */ 121 #define LEX_PCT LEX_NAME 122 /* On the Delta, `~' can start a label name, but is converted to '.'. */ 123 #define LEX_TILDE LEX_BEGIN_NAME 124 #define tc_canonicalize_symbol_name(s) ((*(s) == '~' ? *(s) = '.' : '.'), s) 125 /* On the Delta, dots are not required before pseudo-ops. */ 126 #define NO_PSEUDO_DOT 1 127 #ifndef BFD_ASSEMBLER 128 #undef LOCAL_LABEL 129 #define LOCAL_LABEL(name) \ 130 (name[0] == '.' || (name[0] == 'L' && name[1] == '%')) 131 #endif 132 #endif 133 134 extern void m68k_mri_mode_change PARAMS ((int)); 135 #define MRI_MODE_CHANGE(i) m68k_mri_mode_change (i) 136 137 extern int m68k_conditional_pseudoop PARAMS ((pseudo_typeS *)); 138 #define tc_conditional_pseudoop(pop) m68k_conditional_pseudoop (pop) 139 140 extern void m68k_frob_label PARAMS ((symbolS *)); 141 #define tc_frob_label(sym) m68k_frob_label (sym) 142 143 extern void m68k_flush_pending_output PARAMS ((void)); 144 #define md_flush_pending_output() m68k_flush_pending_output () 145 146 extern void m68k_frob_symbol PARAMS ((symbolS *)); 147 148 #ifdef BFD_ASSEMBLER 149 150 #define tc_frob_symbol(sym,punt) \ 151 do \ 152 { \ 153 if (S_GET_SEGMENT (sym) == reg_section) \ 154 punt = 1; \ 155 m68k_frob_symbol (sym); \ 156 } \ 157 while (0) 158 159 #define NO_RELOC BFD_RELOC_NONE 160 161 #ifdef OBJ_ELF 162 163 /* This expression evaluates to false if the relocation is for a local object 164 for which we still want to do the relocation at runtime. True if we 165 are willing to perform this relocation while building the .o file. If 166 the reloc is against an externally visible symbol, then the assembler 167 should never do the relocation. */ 168 169 #define TC_RELOC_RTSYM_LOC_FIXUP(FIX) \ 170 ((FIX)->fx_addsy == NULL \ 171 || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \ 172 && ! S_IS_WEAK ((FIX)->fx_addsy) \ 173 && S_IS_DEFINED ((FIX)->fx_addsy) \ 174 && ! S_IS_COMMON ((FIX)->fx_addsy))) 175 176 #define tc_fix_adjustable(X) tc_m68k_fix_adjustable(X) 177 extern int tc_m68k_fix_adjustable PARAMS ((struct fix *)); 178 #define elf_tc_final_processing m68k_elf_final_processing 179 extern void m68k_elf_final_processing PARAMS ((void)); 180 #endif 181 182 #define TC_FORCE_RELOCATION(FIX) \ 183 ((FIX)->fx_r_type == BFD_RELOC_VTABLE_INHERIT \ 184 || (FIX)->fx_r_type == BFD_RELOC_VTABLE_ENTRY) 185 186 #else /* ! BFD_ASSEMBLER */ 187 188 #define tc_frob_coff_symbol(sym) m68k_frob_symbol (sym) 189 190 #define NO_RELOC 0 191 192 #endif /* ! BFD_ASSEMBLER */ 193 194 #define DIFF_EXPR_OK 195 196 extern void m68k_init_after_args PARAMS ((void)); 197 #define tc_init_after_args m68k_init_after_args 198 199 extern int m68k_parse_long_option PARAMS ((char *)); 200 #define md_parse_long_option m68k_parse_long_option 201 202 #define md_operand(x) 203 204 #define TARGET_WORD_SIZE 32 205 #define TARGET_ARCH bfd_arch_m68k 206 207 extern struct relax_type md_relax_table[]; 208 #define TC_GENERIC_RELAX_TABLE md_relax_table 209 210 /* Copied from write.c */ 211 /* This was formerly called M68K_AIM_KLUDGE. */ 212 #define md_prepare_relax_scan(fragP, address, aim, this_state, this_type) \ 213 if (aim==0 && this_state== 4) { /* hard encoded from tc-m68k.c */ \ 214 aim=this_type->rlx_forward+1; /* Force relaxation into word mode */ \ 215 } 216 217 /* end of tc-m68k.h */ 218