| 1 | /* This file is tc-mcore.h |
| 2 | |
| 3 | Copyright 1999, 2000, 2001, 2002, 2003 |
| 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 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 |
| 20 | Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA |
| 21 | 02111-1307, USA. */ |
| 22 | |
| 23 | #ifndef TC_MCORE |
| 24 | #define TC_MCORE 1 |
| 25 | |
| 26 | #ifndef BFD_ASSEMBLER |
| 27 | #error MCORE support requires BFD_ASSEMBLER |
| 28 | #endif |
| 29 | |
| 30 | #define TARGET_ARCH bfd_arch_mcore |
| 31 | /* Used to initialise target_big_endian. */ |
| 32 | #define TARGET_BYTES_BIG_ENDIAN 0 |
| 33 | |
| 34 | /* Don't write out relocs for pcrel stuff. */ |
| 35 | #define TC_COUNT_RELOC(x) (((x)->fx_addsy || (x)->fx_subsy) && \ |
| 36 | (x)->fx_r_type < BFD_RELOC_MCORE_PCREL_IMM8BY4) |
| 37 | |
| 38 | #define IGNORE_NONSTANDARD_ESCAPES |
| 39 | |
| 40 | #define TC_RELOC_MANGLE(a,b,c) tc_reloc_mangle (a, b, c) |
| 41 | |
| 42 | /* Some pseudo-op semantic extensions. */ |
| 43 | #define PSEUDO_LCOMM_OPTIONAL_ALIGN |
| 44 | |
| 45 | #define LISTING_HEADER "M.CORE GAS Version 2.9.4" |
| 46 | #define LISTING_LHS_CONT_LINES 4 |
| 47 | |
| 48 | #define NEED_FX_R_TYPE 1 |
| 49 | #define COFF_FLAGS 1 |
| 50 | |
| 51 | /* We want local label support. */ |
| 52 | #define LOCAL_LABELS_FB 1 |
| 53 | |
| 54 | #define TC_COFF_SIZEMACHDEP(frag) tc_coff_sizemachdep (frag) |
| 55 | int tc_coff_sizemachdep PARAMS ((struct frag *)); |
| 56 | |
| 57 | extern const struct relax_type md_relax_table[]; |
| 58 | #define TC_GENERIC_RELAX_TABLE md_relax_table |
| 59 | #define md_end md_mcore_end |
| 60 | |
| 61 | /* Want the section information too... */ |
| 62 | #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC) |
| 63 | |
| 64 | #ifdef OBJ_COFF |
| 65 | |
| 66 | #define TARGET_FORMAT (target_big_endian ? "pe-mcore-big" : "pe-mcore-little") |
| 67 | |
| 68 | struct mcore_tc_sy |
| 69 | { |
| 70 | int sy_flags; |
| 71 | }; |
| 72 | |
| 73 | #define TC_SYMFIELD_TYPE struct mcore_tc_sy |
| 74 | |
| 75 | # if defined TE_PE |
| 76 | # define TC_FORCE_RELOCATION(x) \ |
| 77 | ((x)->fx_r_type == BFD_RELOC_RVA || generic_force_reloc (x)) |
| 78 | # endif |
| 79 | |
| 80 | #endif /* OBJ_COFF */ |
| 81 | |
| 82 | #ifdef OBJ_ELF |
| 83 | |
| 84 | #define TARGET_FORMAT (target_big_endian ? "elf32-mcore-big" : "elf32-mcore-little") |
| 85 | |
| 86 | #define ELF_TC_SPECIAL_SECTIONS \ |
| 87 | { ".ctors", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, \ |
| 88 | { ".dtors", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, \ |
| 89 | /* Other special sections not generated by the assembler: .reginfo, |
| 90 | .liblist, .conflict, .gptab, .got, .dynamic, .rel.dyn. */ |
| 91 | |
| 92 | /* No shared lib support, so we don't need to ensure externally |
| 93 | visible symbols can be overridden. */ |
| 94 | #define EXTERN_FORCE_RELOC 0 |
| 95 | |
| 96 | /* When relaxing, we need to emit various relocs we otherwise wouldn't. */ |
| 97 | #define TC_FORCE_RELOCATION(fix) mcore_force_relocation (fix) |
| 98 | extern int mcore_force_relocation PARAMS ((struct fix *)); |
| 99 | |
| 100 | #define tc_fix_adjustable(FIX) mcore_fix_adjustable (FIX) |
| 101 | extern bfd_boolean mcore_fix_adjustable PARAMS ((struct fix *)); |
| 102 | |
| 103 | /* Values passed to md_apply_fix3 don't include the symbol value. */ |
| 104 | #define MD_APPLY_SYM_VALUE(FIX) 0 |
| 105 | |
| 106 | #endif /* OBJ_ELF */ |
| 107 | |
| 108 | #ifndef TARGET_FORMAT |
| 109 | # error No target format specified. |
| 110 | #endif |
| 111 | |
| 112 | #include "write.h" /* For definition of fixS */ |
| 113 | |
| 114 | extern void md_begin PARAMS ((void)); |
| 115 | extern void md_assemble PARAMS ((char *)); |
| 116 | extern symbolS * md_undefined_symbol PARAMS ((char *)); |
| 117 | extern void md_mcore_end PARAMS ((void)); |
| 118 | extern char * md_atof PARAMS ((int, char *, int *)); |
| 119 | extern int md_parse_option PARAMS ((int, char *)); |
| 120 | extern void md_show_usage PARAMS ((FILE *)); |
| 121 | extern void md_create_short_jump |
| 122 | PARAMS ((char *, addressT, addressT, fragS *, symbolS *)); |
| 123 | extern void md_create_long_jump |
| 124 | PARAMS ((char *, addressT, addressT, fragS *, symbolS *)); |
| 125 | extern void md_convert_frag PARAMS ((bfd *, segT, fragS *)); |
| 126 | extern void md_operand PARAMS ((expressionS *)); |
| 127 | extern int md_estimate_size_before_relax PARAMS ((fragS *, segT)); |
| 128 | extern void md_number_to_chars PARAMS ((char *, valueT, int)); |
| 129 | extern valueT md_section_align PARAMS ((segT, valueT)); |
| 130 | extern long md_pcrel_from_section PARAMS ((fixS *, segT)); |
| 131 | extern arelent * tc_gen_reloc PARAMS ((asection *, fixS *)); |
| 132 | |
| 133 | #endif /* TC_MCORE */ |