gas/
[deliverable/binutils-gdb.git] / gas / config / tc-i960.h
CommitLineData
252b5132 1/* tc-i960.h - Basic 80960 instruction formats.
f7e42eb4 2 Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1998, 1999,
aa820537 3 2000, 2001, 2002, 2003, 2005, 2007, 2008
252b5132
RH
4 Free Software Foundation, Inc.
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
ec2655a6 10 published by the Free Software Foundation; either version 3,
252b5132
RH
11 or (at your option) any later version.
12
13 GAS is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
16 the 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 Free
4b4da160
NC
20 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
21 02110-1301, USA. */
252b5132
RH
22
23#ifndef TC_I960
24#define TC_I960 1
25
bedf545c
ILT
26#ifdef OBJ_ELF
27#define TARGET_FORMAT "elf32-i960"
28#define TARGET_ARCH bfd_arch_i960
29#endif
30
252b5132
RH
31#define TARGET_BYTES_BIG_ENDIAN 0
32
33#define WORKING_DOT_WORD
34
35/*
36 * The 'COJ' instructions are actually COBR instructions with the 'b' in
37 * the mnemonic replaced by a 'j'; they are ALWAYS "de-optimized" if necessary:
38 * if the displacement will not fit in 13 bits, the assembler will replace them
39 * with the corresponding compare and branch instructions.
40 *
41 * All of the 'MEMn' instructions are the same format; the 'n' in the name
42 * indicates the default index scale factor (the size of the datum operated on).
43 *
44 * The FBRA formats are not actually an instruction format. They are the
45 * "convenience directives" for branching on floating-point comparisons,
46 * each of which generates 2 instructions (a 'bno' and one other branch).
47 *
48 * The CALLJ format is not actually an instruction format. It indicates that
49 * the instruction generated (a CTRL-format 'call') should have its relocation
50 * specially flagged for link-time replacement with a 'bal' or 'calls' if
51 * appropriate.
52 */
53
54/* tailor gas */
252b5132
RH
55#define LOCAL_LABELS_FB 1
56#define BITFIELD_CONS_EXPRESSIONS
57
58/* tailor the coff format */
252b5132 59#define COFF_MAGIC I960ROMAGIC
252b5132 60#define OBJ_COFF_MAX_AUXENTRIES (2)
252b5132
RH
61
62/* MEANING OF 'n_other' in the symbol record.
63 *
64 * If non-zero, the 'n_other' fields indicates either a leaf procedure or
65 * a system procedure, as follows:
66 *
67 * 1 <= n_other <= 32 :
68 * The symbol is the entry point to a system procedure.
69 * 'n_value' is the address of the entry, as for any other
70 * procedure. The system procedure number (which can be used in
71 * a 'calls' instruction) is (n_other-1). These entries come from
72 * '.sysproc' directives.
73 *
74 * n_other == N_CALLNAME
75 * the symbol is the 'call' entry point to a leaf procedure.
76 * The *next* symbol in the symbol table must be the corresponding
77 * 'bal' entry point to the procedure (see following). These
78 * entries come from '.leafproc' directives in which two different
79 * symbols are specified (the first one is represented here).
80 *
81 *
82 * n_other == N_BALNAME
83 * the symbol is the 'bal' entry point to a leaf procedure.
84 * These entries result from '.leafproc' directives in which only
85 * one symbol is specified, or in which the same symbol is
86 * specified twice.
87 *
88 * Note that an N_CALLNAME entry *must* have a corresponding N_BALNAME entry,
89 * but not every N_BALNAME entry must have an N_CALLNAME entry.
90 */
91#define N_CALLNAME ((char)-1)
92#define N_BALNAME ((char)-2)
93
4a4f25cf 94/* i960 uses a custom relocation record. */
252b5132
RH
95
96/* let obj-aout.h know */
97#define CUSTOM_RELOC_FORMAT 1
98/* let aout_gnu.h know */
99#define N_RELOCATION_INFO_DECLARED 1
100struct relocation_info
101 {
102 int r_address; /* File address of item to be relocated */
103 unsigned
104 r_index:24, /* Index of symbol on which relocation is based*/
105 r_pcrel:1, /* 1 => relocate PC-relative; else absolute
106 * On i960, pc-relative implies 24-bit
107 * address, absolute implies 32-bit.
108 */
109 r_length:2, /* Number of bytes to relocate:
110 * 0 => 1 byte
111 * 1 => 2 bytes
112 * 2 => 4 bytes -- only value used for i960
113 */
114 r_extern:1, r_bsr:1, /* Something for the GNU NS32K assembler */
115 r_disp:1, /* Something for the GNU NS32K assembler */
116 r_callj:1, /* 1 if relocation target is an i960 'callj' */
117 nuthin:1; /* Unused */
118 };
119
a161fe53
AM
120/* No shared lib support, so we don't need to ensure externally
121 visible symbols can be overridden. */
122#define EXTERN_FORCE_RELOC 0
123
124/* Makes no sense to use the difference of 2 arbitrary symbols
125 as the target of a call instruction. */
126#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \
127 ((FIX)->fx_tcbit \
ae6063d4
AM
128 || ! SEG_NORMAL (SEG) \
129 || TC_FORCE_RELOCATION (FIX))
a161fe53
AM
130
131/* reloc_callj() may replace a 'call' with a 'calls' or a
132 'bal', in which cases it modifies *fixP as appropriate.
133 In the case of a 'calls', no further work is required. */
5a49b8ac 134extern int reloc_callj (struct fix *);
a161fe53
AM
135
136#define TC_FORCE_RELOCATION_ABS(FIX) \
137 (TC_FORCE_RELOCATION (FIX) \
138 || reloc_callj (FIX))
139
140#define TC_FORCE_RELOCATION_LOCAL(FIX) \
141 (!(FIX)->fx_pcrel \
a161fe53
AM
142 || TC_FORCE_RELOCATION (FIX) \
143 || reloc_callj (FIX))
144
252b5132
RH
145#ifdef OBJ_COFF
146
147/* We store the bal information in the sy_tc field. */
49309057 148#define TC_SYMFIELD_TYPE symbolS *
252b5132 149
252b5132
RH
150#endif
151
5a49b8ac 152extern int i960_validate_fix (struct fix *, segT);
a161fe53
AM
153#define TC_VALIDATE_FIX(FIX,SEGTYPE,LABEL) \
154 if (!i960_validate_fix (FIX, SEGTYPE)) goto LABEL
252b5132 155
a161fe53 156#define tc_fix_adjustable(FIX) ((FIX)->fx_bsr == 0)
bedf545c
ILT
157
158#ifndef OBJ_ELF
55cf6793 159/* Values passed to md_apply_fix sometimes include symbol values. */
a161fe53 160#define MD_APPLY_SYM_VALUE(FIX) tc_fix_adjustable (FIX)
bedf545c 161#else
55cf6793 162/* Values passed to md_apply_fix don't include the symbol value. */
a161fe53 163#define MD_APPLY_SYM_VALUE(FIX) 0
bedf545c 164#endif
252b5132 165
5a49b8ac 166extern void brtab_emit (void);
252b5132
RH
167#define md_end() brtab_emit ()
168
5a49b8ac 169extern void tc_set_bal_of_call (symbolS *, symbolS *);
252b5132 170
5a49b8ac 171extern struct symbol *tc_get_bal_of_call (symbolS *);
252b5132 172
5a49b8ac 173extern void i960_handle_align (struct frag *);
252b5132 174#define HANDLE_ALIGN(FRAG) i960_handle_align (FRAG)
252b5132
RH
175#define NO_RELOC -1
176
177#define md_operand(x)
178
179extern const struct relax_type md_relax_table[];
180#define TC_GENERIC_RELAX_TABLE md_relax_table
181
182#define LINKER_RELAXING_SHRINKS_ONLY
183
184#define TC_FIX_TYPE struct { unsigned bsr : 1; }
185#define fx_bsr tc_fix_data.bsr
186#define TC_INIT_FIX_DATA(F) ((F)->tc_fix_data.bsr = 0)
187
188#endif
This page took 0.689507 seconds and 4 git commands to generate.