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