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