12a6b7db3Sskrll /* tc-cr16.h -- Header file for tc-cr16.c, the CR16 GAS port. 2*f22f0ef4Schristos Copyright (C) 2007-2022 Free Software Foundation, Inc. 32a6b7db3Sskrll 42a6b7db3Sskrll Contributed by M R Swami Reddy <MR.Swami.Reddy@nsc.com> 52a6b7db3Sskrll 62a6b7db3Sskrll This file is part of GAS, the GNU Assembler. 72a6b7db3Sskrll 82a6b7db3Sskrll GAS is free software; you can redistribute it and/or modify 92a6b7db3Sskrll it under the terms of the GNU General Public License as published by 102a6b7db3Sskrll the Free Software Foundation; either version 3, or (at your option) 112a6b7db3Sskrll any later version. 122a6b7db3Sskrll 132a6b7db3Sskrll GAS is distributed in the hope that it will be useful, 142a6b7db3Sskrll but WITHOUT ANY WARRANTY; without even the implied warranty of 152a6b7db3Sskrll MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 162a6b7db3Sskrll GNU General Public License for more details. 172a6b7db3Sskrll 182a6b7db3Sskrll You should have received a copy of the GNU General Public License 192a6b7db3Sskrll along with GAS; see the file COPYING. If not, write to the 202a6b7db3Sskrll Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, 212a6b7db3Sskrll MA 02110-1301, USA. */ 222a6b7db3Sskrll 232a6b7db3Sskrll #ifndef TC_CR16_H 242a6b7db3Sskrll #define TC_CR16_H 252a6b7db3Sskrll 262a6b7db3Sskrll #define TC_CR16 1 272a6b7db3Sskrll 282a6b7db3Sskrll #define TARGET_BYTES_BIG_ENDIAN 0 292a6b7db3Sskrll 30b578a859Schristos #define GLOBAL_OFFSET_TABLE_NAME "_GLOBAL_OFFSET_TABLE_" 31b578a859Schristos 322a6b7db3Sskrll #define TARGET_FORMAT "elf32-cr16" 332a6b7db3Sskrll #define TARGET_ARCH bfd_arch_cr16 342a6b7db3Sskrll 352a6b7db3Sskrll #define WORKING_DOT_WORD 362a6b7db3Sskrll #define LOCAL_LABEL_PREFIX '.' 372a6b7db3Sskrll 382a6b7db3Sskrll #define md_number_to_chars number_to_chars_littleendian 392a6b7db3Sskrll 402a6b7db3Sskrll /* We do relaxing in the assembler as well as the linker. */ 412a6b7db3Sskrll extern const struct relax_type md_relax_table[]; 422a6b7db3Sskrll #define TC_GENERIC_RELAX_TABLE md_relax_table 432a6b7db3Sskrll 442a6b7db3Sskrll /* We do not want to adjust any relocations to make implementation of 452a6b7db3Sskrll linker relaxations easier. */ 462a6b7db3Sskrll #define tc_fix_adjustable(fixP) 0 472a6b7db3Sskrll 482a6b7db3Sskrll /* We need to force out some relocations when relaxing. */ 492a6b7db3Sskrll #define TC_FORCE_RELOCATION(FIXP) cr16_force_relocation (FIXP) 502a6b7db3Sskrll extern int cr16_force_relocation (struct fix *); 512a6b7db3Sskrll 52b578a859Schristos /* Fixup non-code sections since we will never relax them. */ 53b578a859Schristos #define TC_LINKRELAX_FIXUP(seg) \ 54b578a859Schristos ((seg->flags & (SEC_ALLOC | SEC_CODE)) == (SEC_ALLOC | SEC_CODE)) 552a6b7db3Sskrll 562a6b7db3Sskrll /* CR16 instructions, with operands included, are a multiple 572a6b7db3Sskrll of two bytes long. */ 582a6b7db3Sskrll #define DWARF2_LINE_MIN_INSN_LENGTH 2 592a6b7db3Sskrll 605ba6b03cSchristos extern void cr16_cons_fix_new (struct frag *, int, int, struct expressionS *, 615ba6b03cSchristos bfd_reloc_code_real_type); 622a6b7db3Sskrll /* This is called by emit_expr when creating a reloc for a cons. 632a6b7db3Sskrll We could use the definition there, except that we want to handle 642a6b7db3Sskrll the CR16 reloc type specially, rather than the BFD_RELOC type. */ 655ba6b03cSchristos #define TC_CONS_FIX_NEW(FRAG, OFF, LEN, EXP, RELOC) \ 665ba6b03cSchristos cr16_cons_fix_new (FRAG, OFF, LEN, EXP, RELOC) 672a6b7db3Sskrll 682a6b7db3Sskrll /* Give an error if a frag containing code is not aligned to a 2-byte 692a6b7db3Sskrll boundary. */ 702a6b7db3Sskrll #define md_frag_check(FRAGP) \ 712a6b7db3Sskrll if ((FRAGP)->has_code \ 722a6b7db3Sskrll && (((FRAGP)->fr_address + (FRAGP)->insn_addr) & 1) != 0) \ 732a6b7db3Sskrll as_bad_where ((FRAGP)->fr_file, (FRAGP)->fr_line, \ 742a6b7db3Sskrll _("instruction address is not a multiple of 2")); 752a6b7db3Sskrll 762a6b7db3Sskrll #endif /* TC_CR16_H */ 77