1*56bb7041Schristos /* tc-crx.h -- Header file for tc-crx.c, the CRX GAS port. 2*56bb7041Schristos Copyright (C) 2004-2020 Free Software Foundation, Inc. 3*56bb7041Schristos 4*56bb7041Schristos Contributed by Tomer Levi, NSC, Israel. 5*56bb7041Schristos Originally written for GAS 2.12 by Tomer Levi, NSC, Israel. 6*56bb7041Schristos Updates, BFDizing, GNUifying and ELF support by Tomer Levi. 7*56bb7041Schristos 8*56bb7041Schristos This file is part of GAS, the GNU Assembler. 9*56bb7041Schristos 10*56bb7041Schristos GAS is free software; you can redistribute it and/or modify 11*56bb7041Schristos it under the terms of the GNU General Public License as published by 12*56bb7041Schristos the Free Software Foundation; either version 3, or (at your option) 13*56bb7041Schristos any later version. 14*56bb7041Schristos 15*56bb7041Schristos GAS is distributed in the hope that it will be useful, 16*56bb7041Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 17*56bb7041Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*56bb7041Schristos GNU General Public License for more details. 19*56bb7041Schristos 20*56bb7041Schristos You should have received a copy of the GNU General Public License 21*56bb7041Schristos along with GAS; see the file COPYING. If not, write to the 22*56bb7041Schristos Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, 23*56bb7041Schristos MA 02110-1301, USA. */ 24*56bb7041Schristos 25*56bb7041Schristos #ifndef TC_CRX_H 26*56bb7041Schristos #define TC_CRX_H 27*56bb7041Schristos 28*56bb7041Schristos #define TC_CRX 1 29*56bb7041Schristos 30*56bb7041Schristos #define TARGET_BYTES_BIG_ENDIAN 0 31*56bb7041Schristos 32*56bb7041Schristos #define TARGET_FORMAT "elf32-crx" 33*56bb7041Schristos #define TARGET_ARCH bfd_arch_crx 34*56bb7041Schristos 35*56bb7041Schristos #define WORKING_DOT_WORD 36*56bb7041Schristos #define LOCAL_LABEL_PREFIX '.' 37*56bb7041Schristos 38*56bb7041Schristos #define md_undefined_symbol(s) 0 39*56bb7041Schristos #define md_number_to_chars number_to_chars_littleendian 40*56bb7041Schristos 41*56bb7041Schristos /* We do relaxing in the assembler as well as the linker. */ 42*56bb7041Schristos extern const struct relax_type md_relax_table[]; 43*56bb7041Schristos #define TC_GENERIC_RELAX_TABLE md_relax_table 44*56bb7041Schristos 45*56bb7041Schristos /* We do not want to adjust any relocations to make implementation of 46*56bb7041Schristos linker relaxations easier. */ 47*56bb7041Schristos #define tc_fix_adjustable(fixP) 0 48*56bb7041Schristos 49*56bb7041Schristos /* We need to force out some relocations when relaxing. */ 50*56bb7041Schristos #define TC_FORCE_RELOCATION(FIXP) crx_force_relocation (FIXP) 51*56bb7041Schristos extern int crx_force_relocation (struct fix *); 52*56bb7041Schristos 53*56bb7041Schristos /* Fixup debug sections since we will never relax them. */ 54*56bb7041Schristos #define TC_LINKRELAX_FIXUP(seg) (seg->flags & SEC_ALLOC) 55*56bb7041Schristos 56*56bb7041Schristos /* CRX instructions, with operands included, are a multiple 57*56bb7041Schristos of two bytes long. */ 58*56bb7041Schristos #define DWARF2_LINE_MIN_INSN_LENGTH 2 59*56bb7041Schristos 60*56bb7041Schristos /* This is called by emit_expr when creating a reloc for a cons. 61*56bb7041Schristos We could use the definition there, except that we want to handle 62*56bb7041Schristos the CRX reloc type specially, rather than the BFD_RELOC type. */ 63*56bb7041Schristos #define TC_CONS_FIX_NEW(FRAG, OFF, LEN, EXP, RELOC) \ 64*56bb7041Schristos (void) RELOC, \ 65*56bb7041Schristos fix_new_exp (FRAG, OFF, (int) LEN, EXP, 0, \ 66*56bb7041Schristos LEN == 1 ? BFD_RELOC_CRX_NUM8 \ 67*56bb7041Schristos : LEN == 2 ? BFD_RELOC_CRX_NUM16 \ 68*56bb7041Schristos : LEN == 4 ? BFD_RELOC_CRX_NUM32 \ 69*56bb7041Schristos : BFD_RELOC_NONE); 70*56bb7041Schristos 71*56bb7041Schristos /* Give an error if a frag containing code is not aligned to a 2-byte 72*56bb7041Schristos boundary. */ 73*56bb7041Schristos #define md_frag_check(FRAGP) \ 74*56bb7041Schristos if ((FRAGP)->has_code \ 75*56bb7041Schristos && (((FRAGP)->fr_address + (FRAGP)->insn_addr) & 1) != 0) \ 76*56bb7041Schristos as_bad_where ((FRAGP)->fr_file, (FRAGP)->fr_line, \ 77*56bb7041Schristos _("instruction address is not a multiple of 2")); 78*56bb7041Schristos 79*56bb7041Schristos #endif /* TC_CRX_H */ 80