1214571Sdim/* tc-cr16.h -- Header file for tc-cr16.c, the CR16 GAS port.
2214571Sdim   Copyright 2007 Free Software Foundation, Inc.
3214571Sdim
4214571Sdim   Contributed by M R Swami Reddy <MR.Swami.Reddy@nsc.com>
5214571Sdim
6214571Sdim   This file is part of GAS, the GNU Assembler.
7214571Sdim
8214571Sdim   GAS is free software; you can redistribute it and/or modify
9214571Sdim   it under the terms of the GNU General Public License as published by
10214571Sdim   the Free Software Foundation; either version 2, or (at your option)
11214571Sdim   any later version.
12214571Sdim
13214571Sdim   GAS is distributed in the hope that it will be useful,
14214571Sdim   but WITHOUT ANY WARRANTY; without even the implied warranty of
15214571Sdim   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16214571Sdim   GNU General Public License for more details.
17214571Sdim
18214571Sdim   You should have received a copy of the GNU General Public License
19214571Sdim   along with GAS; see the file COPYING.  If not, write to the
20214571Sdim   Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
21214571Sdim   MA 02110-1301, USA.  */
22214571Sdim
23214571Sdim#ifndef TC_CR16_H
24214571Sdim#define TC_CR16_H
25214571Sdim
26214571Sdim#define TC_CR16 1
27214571Sdim
28214571Sdim#define TARGET_BYTES_BIG_ENDIAN 0
29214571Sdim
30214571Sdim#define TARGET_FORMAT "elf32-cr16"
31214571Sdim#define TARGET_ARCH   bfd_arch_cr16
32214571Sdim
33214571Sdim#define WORKING_DOT_WORD
34214571Sdim#define LOCAL_LABEL_PREFIX '.'
35214571Sdim
36214571Sdim#define md_undefined_symbol(s)  0
37214571Sdim#define md_number_to_chars      number_to_chars_littleendian
38214571Sdim
39214571Sdim/* We do relaxing in the assembler as well as the linker.  */
40214571Sdimextern const struct relax_type md_relax_table[];
41214571Sdim#define TC_GENERIC_RELAX_TABLE md_relax_table
42214571Sdim
43214571Sdim/* We do not want to adjust any relocations to make implementation of
44214571Sdim   linker relaxations easier.  */
45214571Sdim#define tc_fix_adjustable(fixP)  0
46214571Sdim
47214571Sdim/* We need to force out some relocations when relaxing.  */
48214571Sdim#define TC_FORCE_RELOCATION(FIXP) cr16_force_relocation (FIXP)
49214571Sdimextern int cr16_force_relocation (struct fix *);
50214571Sdim
51214571Sdim/* Fixup debug sections since we will never relax them.  */
52214571Sdim#define TC_LINKRELAX_FIXUP(seg) (seg->flags & SEC_ALLOC)
53214571Sdim
54214571Sdim/* CR16 instructions, with operands included, are a multiple
55214571Sdim   of two bytes long.  */
56214571Sdim#define DWARF2_LINE_MIN_INSN_LENGTH 2
57214571Sdim
58214571Sdimextern void cr16_cons_fix_new (struct frag *, int, int, struct expressionS *);
59214571Sdim/* This is called by emit_expr when creating a reloc for a cons.
60214571Sdim   We could use the definition there, except that we want to handle
61214571Sdim   the CR16 reloc type specially, rather than the BFD_RELOC type.  */
62214571Sdim#define TC_CONS_FIX_NEW(FRAG, OFF, LEN, EXP) \
63214571Sdim  cr16_cons_fix_new (FRAG, OFF, LEN, EXP)
64214571Sdim
65214571Sdim/* Give an error if a frag containing code is not aligned to a 2-byte
66214571Sdim   boundary.  */
67214571Sdim#define md_frag_check(FRAGP) \
68214571Sdim  if ((FRAGP)->has_code                                                \
69214571Sdim      && (((FRAGP)->fr_address + (FRAGP)->insn_addr) & 1) != 0)        \
70214571Sdim     as_bad_where ((FRAGP)->fr_file, (FRAGP)->fr_line,                 \
71214571Sdim                  _("instruction address is not a multiple of 2"));
72214571Sdim
73214571Sdim#endif /* TC_CR16_H */
74