| 1 | /* This file is tc-arm.h |
| 2 | Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. |
| 3 | Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) |
| 4 | Modified by David Taylor (dtaylor@armltd.co.uk) |
| 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 |
| 20 | Software Foundation, 59 Temple Place - Suite 330, Boston, MA |
| 21 | 02111-1307, USA. */ |
| 22 | |
| 23 | #define TC_ARM 1 |
| 24 | |
| 25 | #ifndef TARGET_BYTES_BIG_ENDIAN |
| 26 | #define TARGET_BYTES_BIG_ENDIAN 0 |
| 27 | #endif |
| 28 | |
| 29 | #define WORKING_DOT_WORD |
| 30 | |
| 31 | #define COFF_MAGIC ARMMAGIC |
| 32 | #define TARGET_ARCH bfd_arch_arm |
| 33 | |
| 34 | #define AOUT_MACHTYPE 0 |
| 35 | |
| 36 | #define DIFF_EXPR_OK |
| 37 | |
| 38 | #ifdef LITTLE_ENDIAN |
| 39 | #undef LITTLE_ENDIAN |
| 40 | #endif |
| 41 | #ifdef BIG_ENDIAN |
| 42 | #undef BIG_ENDIAN |
| 43 | #endif |
| 44 | |
| 45 | #define LITTLE_ENDIAN 1234 |
| 46 | #define BIG_ENDIAN 4321 |
| 47 | |
| 48 | #ifdef OBJ_AOUT |
| 49 | #ifdef TE_RISCIX |
| 50 | #define TARGET_FORMAT "a.out-riscix" |
| 51 | #else |
| 52 | #define ARM_BI_ENDIAN |
| 53 | #define TARGET_FORMAT \ |
| 54 | (target_big_endian ? "a.out-arm-big" : "a.out-arm-little") |
| 55 | #endif |
| 56 | #endif |
| 57 | |
| 58 | #ifdef OBJ_AIF |
| 59 | #define TARGET_FORMAT "aif" |
| 60 | #endif |
| 61 | |
| 62 | #ifdef OBJ_COFF |
| 63 | # define ARM_BI_ENDIAN |
| 64 | extern boolean arm_validate_fix (); |
| 65 | # define TC_VALIDATE_FIX(fixP,segType,Label) if (arm_validate_fix (fixP)) add_symbolP = fixP->fx_addsy |
| 66 | # ifdef TE_PE |
| 67 | # define TC_FORCE_RELOCATION(x) ((x)->fx_r_type==BFD_RELOC_RVA) |
| 68 | # define TARGET_FORMAT (target_big_endian ? "pe-arm-big" : "pe-arm-little") |
| 69 | # else |
| 70 | # define TARGET_FORMAT (target_big_endian ? "coff-arm-big" : "coff-arm-little") |
| 71 | /* Tell tc-arm.c to support runtime endian selection. */ |
| 72 | # endif |
| 73 | #endif |
| 74 | |
| 75 | /* start-sanitize-armelf */ |
| 76 | #ifdef OBJ_ELF |
| 77 | extern boolean arm_validate_fix (); |
| 78 | #define TC_VALIDATE_FIX(fixP,segType,Label) if (arm_validate_fix (fixP)) add_symbolP = fixP->fx_addsy |
| 79 | #define ARM_BI_ENDIAN |
| 80 | #define TARGET_FORMAT (target_big_endian ? "elf32-bigarm" : "elf32-littlearm") |
| 81 | #endif |
| 82 | /* end-sanitize-armelf */ |
| 83 | |
| 84 | #define md_convert_frag(b,s,f) {as_fatal (_("arm convert_frag\n"));} |
| 85 | |
| 86 | extern void arm_cleanup PARAMS ((void)); |
| 87 | extern void arm_start_line_hook PARAMS ((void)); |
| 88 | extern void arm_frob_label PARAMS ((struct symbol *)); |
| 89 | #define md_cleanup() arm_cleanup () |
| 90 | #define md_start_line_hook() arm_start_line_hook () |
| 91 | #define tc_frob_label(S) arm_frob_label (S) |
| 92 | /* We also need to mark assembler created symbols: */ |
| 93 | #define tc_frob_fake_label(S) arm_frob_label (S) |
| 94 | /* NOTE: The fake label creation in stabs.c:s_stab_generic() has |
| 95 | deliberately not been updated to mark assembler created stabs |
| 96 | symbols as Thumb. */ |
| 97 | |
| 98 | /* start-sanitize-armelf */ |
| 99 | #ifdef OBJ_ELF |
| 100 | #define obj_fix_adjustable(fixP) arm_fix_adjustable(fixP) |
| 101 | #else |
| 102 | /* end-sanitize-armelf */ |
| 103 | #define obj_fix_adjustable(fixP) 0 |
| 104 | /* start-sanitize-armelf */ |
| 105 | #endif |
| 106 | /* end-sanitize-armelf */ |
| 107 | |
| 108 | /* We need to keep some local information on symbols. */ |
| 109 | |
| 110 | #define TC_SYMFIELD_TYPE unsigned int |
| 111 | #define ARM_GET_FLAG(s) ((s)->sy_tc) |
| 112 | #define ARM_SET_FLAG(s,v) ((s)->sy_tc |= (v)) |
| 113 | #define ARM_RESET_FLAG(s,v) ((s)->sy_tc &= ~(v)) |
| 114 | |
| 115 | #define ARM_FLAG_THUMB (1 << 0) /* The symbol is a Thumb symbol rather than an Arm symbol. */ |
| 116 | #define ARM_FLAG_INTERWORK (1 << 1) /* The symbol is attached to code that suppports interworking. */ |
| 117 | #define THUMB_FLAG_FUNC (1 << 2) /* The symbol is attached to the start of a Thumb function. */ |
| 118 | |
| 119 | #define ARM_IS_THUMB(s) (ARM_GET_FLAG (s) & ARM_FLAG_THUMB) |
| 120 | #define ARM_IS_INTERWORK(s) (ARM_GET_FLAG (s) & ARM_FLAG_INTERWORK) |
| 121 | #define THUMB_IS_FUNC(s) (ARM_GET_FLAG (s) & THUMB_FLAG_FUNC) |
| 122 | |
| 123 | #define ARM_SET_THUMB(s,t) ((t) ? ARM_SET_FLAG (s, ARM_FLAG_THUMB) : ARM_RESET_FLAG (s, ARM_FLAG_THUMB)) |
| 124 | #define ARM_SET_INTERWORK(s,t) ((t) ? ARM_SET_FLAG (s, ARM_FLAG_INTERWORK) : ARM_RESET_FLAG (s, ARM_FLAG_INTERWORK)) |
| 125 | #define THUMB_SET_FUNC(s,t) ((t) ? ARM_SET_FLAG (s, THUMB_FLAG_FUNC) : ARM_RESET_FLAG (s, THUMB_FLAG_FUNC)) |
| 126 | |
| 127 | |
| 128 | #define TC_FIX_TYPE PTR |
| 129 | #define TC_INIT_FIX_DATA(FIXP) ((FIXP)->tc_fix_data = NULL) |
| 130 | |
| 131 | #define TC_START_LABEL(C,STR) \ |
| 132 | (c == ':' || (c == '/' && arm_data_in_code ())) |
| 133 | int arm_data_in_code PARAMS ((void)); |
| 134 | |
| 135 | #define tc_canonicalize_symbol_name(str) \ |
| 136 | arm_canonicalize_symbol_name (str); |
| 137 | char *arm_canonicalize_symbol_name PARAMS ((char *)); |
| 138 | |
| 139 | #if 0 /* It isn't as simple as this */ |
| 140 | #define tc_frob_symbol(sym,punt) \ |
| 141 | { if (S_IS_LOCAL (sym)) \ |
| 142 | { \ |
| 143 | punt = 1; \ |
| 144 | sym->sy_used_in_reloc = 0; \ |
| 145 | }} |
| 146 | #endif |
| 147 | |
| 148 | #ifdef OBJ_ELF |
| 149 | #define obj_frob_symbol(sym, punt) armelf_frob_symbol (sym, punt) |
| 150 | #endif |
| 151 | |
| 152 | /* Finish processing the entire symbol table: */ |
| 153 | #define tc_adjust_symtab() arm_adjust_symtab () |
| 154 | extern void arm_adjust_symtab PARAMS ((void)); |
| 155 | |
| 156 | #if 0 |
| 157 | #define tc_crawl_symbol_chain(a) {;} /* not used */ |
| 158 | #define tc_headers_hook(a) {;} /* not used */ |
| 159 | #endif |
| 160 | |
| 161 | #define tc_aout_pre_write_hook(x) {;} /* not used */ |
| 162 | |
| 163 | #define LISTING_HEADER "ARM GAS " |
| 164 | |
| 165 | #define OPTIONAL_REGISTER_PREFIX '%' |
| 166 | |
| 167 | #define md_operand(x) |
| 168 | |
| 169 | #define TC_HANDLES_FX_DONE |
| 170 | |
| 171 | #define MD_APPLY_FIX3 |
| 172 | |
| 173 | #define LOCAL_LABEL(name) (name[0] == '.' \ |
| 174 | && (name[1] == 'L')) |
| 175 | #define LOCAL_LABELS_FB 1 |
| 176 | |
| 177 | /* end of tc-arm.h */ |