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