1  /* tc-cr16.h -- Header file for tc-cr16.c, the CR16 GAS port.
       2     Copyright (C) 2007-2023 Free Software Foundation, Inc.
       3  
       4     Contributed by M R Swami Reddy <MR.Swami.Reddy@nsc.com>
       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 3, 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, 51 Franklin Street - Fifth Floor, Boston,
      21     MA 02110-1301, USA.  */
      22  
      23  #ifndef TC_CR16_H
      24  #define TC_CR16_H
      25  
      26  #define TC_CR16 1
      27  
      28  #define TARGET_BYTES_BIG_ENDIAN 0
      29  
      30  #define GLOBAL_OFFSET_TABLE_NAME "_GLOBAL_OFFSET_TABLE_"
      31  
      32  #define TARGET_FORMAT "elf32-cr16"
      33  #define TARGET_ARCH   bfd_arch_cr16
      34  
      35  #define WORKING_DOT_WORD
      36  #define LOCAL_LABEL_PREFIX '.'
      37  
      38  #define md_number_to_chars      number_to_chars_littleendian
      39  
      40  /* We do relaxing in the assembler as well as the linker.  */
      41  extern const struct relax_type md_relax_table[];
      42  #define TC_GENERIC_RELAX_TABLE md_relax_table
      43  
      44  /* We do not want to adjust any relocations to make implementation of
      45     linker relaxations easier.  */
      46  #define tc_fix_adjustable(fixP)  0
      47  
      48  /* We need to force out some relocations when relaxing.  */
      49  #define TC_FORCE_RELOCATION(FIXP) cr16_force_relocation (FIXP)
      50  extern int cr16_force_relocation (struct fix *);
      51  
      52  /* Fixup non-code sections since we will never relax them.  */
      53  #define TC_LINKRELAX_FIXUP(seg) \
      54    ((seg->flags & (SEC_ALLOC | SEC_CODE)) == (SEC_ALLOC | SEC_CODE))
      55  
      56  /* CR16 instructions, with operands included, are a multiple
      57     of two bytes long.  */
      58  #define DWARF2_LINE_MIN_INSN_LENGTH 2
      59  
      60  extern void cr16_cons_fix_new (struct frag *, int, int, struct expressionS *,
      61  			       bfd_reloc_code_real_type);
      62  /* This is called by emit_expr when creating a reloc for a cons.
      63     We could use the definition there, except that we want to handle
      64     the CR16 reloc type specially, rather than the BFD_RELOC type.  */
      65  #define TC_CONS_FIX_NEW(FRAG, OFF, LEN, EXP, RELOC)	\
      66    cr16_cons_fix_new (FRAG, OFF, LEN, EXP, RELOC)
      67  
      68  /* Give an error if a frag containing code is not aligned to a 2-byte
      69     boundary.  */
      70  #define md_frag_check(FRAGP) \
      71    if ((FRAGP)->has_code                                                \
      72        && (((FRAGP)->fr_address + (FRAGP)->insn_addr) & 1) != 0)        \
      73       as_bad_where ((FRAGP)->fr_file, (FRAGP)->fr_line,                 \
      74                    _("instruction address is not a multiple of 2"));
      75  
      76  #endif /* TC_CR16_H */