| 1 | /* tc-cris.h -- Header file for tc-cris.c, the CRIS GAS port. |
| 2 | Copyright 2000, 2001 Free Software Foundation, Inc. |
| 3 | |
| 4 | Contributed by Axis Communications AB, Lund, Sweden. |
| 5 | Originally written for GAS 1.38.1 by Mikael Asker. |
| 6 | Updates, BFDizing, GNUifying and ELF by Hans-Peter Nilsson. |
| 7 | |
| 8 | This file is part of GAS, the GNU Assembler. |
| 9 | |
| 10 | GAS is free software; you can redistribute it and/or modify |
| 11 | it under the terms of the GNU General Public License as published by |
| 12 | the Free Software Foundation; either version 2, or (at your option) |
| 13 | any later version. |
| 14 | |
| 15 | GAS is distributed in the hope that it will be useful, |
| 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | GNU General Public License for more details. |
| 19 | |
| 20 | You should have received a copy of the GNU General Public License |
| 21 | along with GAS; see the file COPYING. If not, write to the |
| 22 | Free Software Foundation, 59 Temple Place - Suite 330, Boston, |
| 23 | MA 02111-1307, USA. */ |
| 24 | |
| 25 | /* See the GAS "internal" document for general documentation on this. |
| 26 | It is called internals.texi (internals.info when makeinfo:d), but is |
| 27 | not installed or makeinfo:d by "make info". */ |
| 28 | |
| 29 | /* Functions and variables that aren't declared in tc.h are declared here, |
| 30 | with the type/prototype that is used in the local extern-declaration of |
| 31 | their usage. */ |
| 32 | |
| 33 | #ifndef TC_CRIS |
| 34 | #define TC_CRIS |
| 35 | |
| 36 | /* Multi-target support is always on. */ |
| 37 | extern const char *cris_target_format PARAMS ((void)); |
| 38 | #define TARGET_FORMAT cris_target_format () |
| 39 | |
| 40 | #define TARGET_ARCH bfd_arch_cris |
| 41 | |
| 42 | #define TARGET_BYTES_BIG_ENDIAN 0 |
| 43 | |
| 44 | extern const char *md_shortopts; |
| 45 | extern struct option md_longopts[]; |
| 46 | extern size_t md_longopts_size; |
| 47 | |
| 48 | extern const pseudo_typeS md_pseudo_table[]; |
| 49 | |
| 50 | #define tc_comment_chars cris_comment_chars |
| 51 | extern const char cris_comment_chars[]; |
| 52 | extern const char line_comment_chars[]; |
| 53 | extern const char line_separator_chars[]; |
| 54 | extern const char EXP_CHARS[]; |
| 55 | extern const char FLT_CHARS[]; |
| 56 | |
| 57 | /* This should be optional, since it is ignored as an escape (assumed to |
| 58 | be itself) if it is not recognized. */ |
| 59 | #define ONLY_STANDARD_ESCAPES |
| 60 | |
| 61 | /* Note that we do not define TC_EQUAL_IN_INSN, since its current use is |
| 62 | in the instruction rather than the operand, and thus does not come to |
| 63 | use for side-effect assignments such as "and.d [r0 = r1 + 42], r3". */ |
| 64 | #define md_operand(x) |
| 65 | |
| 66 | #define md_number_to_chars number_to_chars_littleendian |
| 67 | |
| 68 | extern const int md_short_jump_size; |
| 69 | extern const int md_long_jump_size; |
| 70 | |
| 71 | /* There's no use having different functions for this; the sizes are the |
| 72 | same. Note that we can't #define md_short_jump_size here. */ |
| 73 | #define md_create_short_jump md_create_long_jump |
| 74 | |
| 75 | extern const struct relax_type md_cris_relax_table[]; |
| 76 | #define TC_GENERIC_RELAX_TABLE md_cris_relax_table |
| 77 | |
| 78 | #define TC_HANDLES_FX_DONE |
| 79 | |
| 80 | #define TC_FORCE_RELOCATION(fixp) md_cris_force_relocation (fixp) |
| 81 | extern int md_cris_force_relocation PARAMS ((struct fix *)); |
| 82 | |
| 83 | #define MD_APPLY_FIX3 |
| 84 | |
| 85 | #define IS_CRIS_PIC_RELOC(X) \ |
| 86 | ((X) == BFD_RELOC_CRIS_16_GOT \ |
| 87 | || (X) == BFD_RELOC_CRIS_32_GOT \ |
| 88 | || (X) == BFD_RELOC_CRIS_16_GOTPLT \ |
| 89 | || (X) == BFD_RELOC_CRIS_32_GOTPLT \ |
| 90 | || (X) == BFD_RELOC_CRIS_32_GOTREL \ |
| 91 | || (X) == BFD_RELOC_CRIS_32_PLT_GOTREL \ |
| 92 | || (X) == BFD_RELOC_CRIS_32_PLT_PCREL) |
| 93 | |
| 94 | |
| 95 | /* FIXME: Undocumented macro. Make sure we don't resolve fixups for which |
| 96 | we want to emit dynamic relocations. */ |
| 97 | |
| 98 | #define TC_RELOC_RTSYM_LOC_FIXUP(FIX) \ |
| 99 | ((FIX)->fx_addsy == NULL \ |
| 100 | || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \ |
| 101 | && ! S_IS_WEAK ((FIX)->fx_addsy) \ |
| 102 | && S_IS_DEFINED ((FIX)->fx_addsy) \ |
| 103 | && ! S_IS_COMMON ((FIX)->fx_addsy) \ |
| 104 | /* FIXME: Set fx_plt instead of this check. */ \ |
| 105 | && ! IS_CRIS_PIC_RELOC ((FIX)->fx_r_type))) |
| 106 | |
| 107 | /* This is really a workaround for a bug in write.c that resolves relocs |
| 108 | for weak symbols - it should be postponed to the link stage or later. |
| 109 | Also don't adjust fixups for global symbols for ELF, and no relocs |
| 110 | where the original symbol name must be kept. */ |
| 111 | #define tc_fix_adjustable(X) \ |
| 112 | (((X)->fx_addsy == NULL \ |
| 113 | || (! S_IS_WEAK ((X)->fx_addsy) \ |
| 114 | && ! (OUTPUT_FLAVOR == bfd_target_elf_flavour \ |
| 115 | && S_IS_EXTERNAL ((X)->fx_addsy)))) \ |
| 116 | && (X)->fx_r_type != BFD_RELOC_VTABLE_INHERIT \ |
| 117 | && (X)->fx_r_type != BFD_RELOC_VTABLE_ENTRY \ |
| 118 | && (! IS_CRIS_PIC_RELOC ((X)->fx_r_type) \ |
| 119 | || (X)->fx_r_type == BFD_RELOC_CRIS_32_GOTREL)) |
| 120 | |
| 121 | /* When we have fixups against constant expressions, we get a GAS-specific |
| 122 | section symbol at no extra charge for obscure reasons in |
| 123 | adjust_reloc_syms. Since ELF outputs section symbols, it gladly |
| 124 | outputs this "*ABS*" symbol in every object. Avoid that. |
| 125 | Also, don't emit undefined symbols (that aren't used in relocations). |
| 126 | They pop up when tentatively parsing register names as symbols. */ |
| 127 | #define tc_frob_symbol(symp, punt) \ |
| 128 | do { \ |
| 129 | if ((OUTPUT_FLAVOR == bfd_target_elf_flavour \ |
| 130 | && (symp) == section_symbol (absolute_section)) \ |
| 131 | || ! S_IS_DEFINED (symp)) \ |
| 132 | (punt) = 1; \ |
| 133 | } while (0) |
| 134 | |
| 135 | #define LISTING_HEADER "GAS for CRIS" |
| 136 | |
| 137 | #if 0 |
| 138 | /* The testsuite does not let me define these, although they IMHO should |
| 139 | be preferred over the default. */ |
| 140 | #define LISTING_WORD_SIZE 2 |
| 141 | #define LISTING_LHS_WIDTH 4 |
| 142 | #define LISTING_LHS_WIDTH_SECOND 4 |
| 143 | #endif |
| 144 | |
| 145 | /* END of declaration and definitions described in the "internals" |
| 146 | document. */ |
| 147 | |
| 148 | /* Do this, or we will never know what hit us when the |
| 149 | broken-word-fixes break. Do _not_ use WARN_SIGNED_OVERFLOW_WORD, |
| 150 | it is only for use with WORKING_DOT_WORD and warns about most stuff. |
| 151 | (still in 2.9.1). */ |
| 152 | struct broken_word; |
| 153 | extern void tc_cris_check_adjusted_broken_word PARAMS ((offsetT, |
| 154 | struct |
| 155 | broken_word *)); |
| 156 | #define TC_CHECK_ADJUSTED_BROKEN_DOT_WORD(new_offset, brokw) \ |
| 157 | tc_cris_check_adjusted_broken_word ((offsetT) (new_offset), brokw) |
| 158 | |
| 159 | /* We don't want any implicit alignment, so we do nothing. */ |
| 160 | #define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR) |
| 161 | |
| 162 | /* CRIS instructions, with operands and prefixes included, are a multiple |
| 163 | of two bytes long. */ |
| 164 | #define DWARF2_LINE_MIN_INSN_LENGTH 2 |
| 165 | |
| 166 | #endif /* TC_CRIS */ |
| 167 | /* |
| 168 | * Local variables: |
| 169 | * eval: (c-set-style "gnu") |
| 170 | * indent-tabs-mode: t |
| 171 | * End: |
| 172 | */ |