1 |
16 |
khays |
/* tc-i960.h - Basic 80960 instruction formats.
|
2 |
|
|
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1998, 1999,
|
3 |
|
|
2000, 2001, 2002, 2003, 2005, 2007, 2008
|
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
|
10 |
|
|
published by the Free Software Foundation; either version 3,
|
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
|
20 |
|
|
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
|
21 |
|
|
02110-1301, USA. */
|
22 |
|
|
|
23 |
|
|
#ifndef TC_I960
|
24 |
|
|
#define TC_I960 1
|
25 |
|
|
|
26 |
|
|
#ifdef OBJ_ELF
|
27 |
|
|
#define TARGET_FORMAT "elf32-i960"
|
28 |
|
|
#define TARGET_ARCH bfd_arch_i960
|
29 |
|
|
#endif
|
30 |
|
|
|
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 */
|
55 |
|
|
#define LOCAL_LABELS_FB 1
|
56 |
|
|
#define BITFIELD_CONS_EXPRESSIONS
|
57 |
|
|
|
58 |
|
|
/* tailor the coff format */
|
59 |
|
|
#define COFF_MAGIC I960ROMAGIC
|
60 |
|
|
#define OBJ_COFF_MAX_AUXENTRIES (2)
|
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 |
|
|
|
94 |
|
|
/* i960 uses a custom relocation record. */
|
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
|
100 |
|
|
struct 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 |
|
|
|
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 \
|
128 |
|
|
|| ! SEG_NORMAL (SEG) \
|
129 |
|
|
|| TC_FORCE_RELOCATION (FIX))
|
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. */
|
134 |
|
|
extern int reloc_callj (struct fix *);
|
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 \
|
142 |
|
|
|| TC_FORCE_RELOCATION (FIX) \
|
143 |
|
|
|| reloc_callj (FIX))
|
144 |
|
|
|
145 |
|
|
#ifdef OBJ_COFF
|
146 |
|
|
|
147 |
|
|
/* We store the bal information in the sy_tc field. */
|
148 |
|
|
#define TC_SYMFIELD_TYPE symbolS *
|
149 |
|
|
|
150 |
|
|
#define TC_ADJUST_RELOC_COUNT(FIX,COUNT) \
|
151 |
|
|
{ fixS *tcfixp = (FIX); \
|
152 |
|
|
for (;tcfixp;tcfixp=tcfixp->fx_next) \
|
153 |
|
|
if (tcfixp->fx_tcbit && tcfixp->fx_addsy != 0) \
|
154 |
|
|
++(COUNT); \
|
155 |
|
|
}
|
156 |
|
|
#endif
|
157 |
|
|
|
158 |
|
|
extern int i960_validate_fix (struct fix *, segT);
|
159 |
|
|
#define TC_VALIDATE_FIX(FIX,SEGTYPE,LABEL) \
|
160 |
|
|
if (!i960_validate_fix (FIX, SEGTYPE)) goto LABEL
|
161 |
|
|
|
162 |
|
|
#define tc_fix_adjustable(FIX) ((FIX)->fx_bsr == 0)
|
163 |
|
|
|
164 |
|
|
#ifndef OBJ_ELF
|
165 |
|
|
/* Values passed to md_apply_fix sometimes include symbol values. */
|
166 |
|
|
#define MD_APPLY_SYM_VALUE(FIX) tc_fix_adjustable (FIX)
|
167 |
|
|
#else
|
168 |
|
|
/* Values passed to md_apply_fix don't include the symbol value. */
|
169 |
|
|
#define MD_APPLY_SYM_VALUE(FIX) 0
|
170 |
|
|
#endif
|
171 |
|
|
|
172 |
|
|
extern void brtab_emit (void);
|
173 |
|
|
#define md_end() brtab_emit ()
|
174 |
|
|
|
175 |
|
|
extern void tc_set_bal_of_call (symbolS *, symbolS *);
|
176 |
|
|
|
177 |
|
|
extern struct symbol *tc_get_bal_of_call (symbolS *);
|
178 |
|
|
|
179 |
|
|
extern void i960_handle_align (struct frag *);
|
180 |
|
|
#define HANDLE_ALIGN(FRAG) i960_handle_align (FRAG)
|
181 |
|
|
#define NO_RELOC -1
|
182 |
|
|
|
183 |
|
|
#define md_operand(x)
|
184 |
|
|
|
185 |
|
|
extern const struct relax_type md_relax_table[];
|
186 |
|
|
#define TC_GENERIC_RELAX_TABLE md_relax_table
|
187 |
|
|
|
188 |
|
|
#define LINKER_RELAXING_SHRINKS_ONLY
|
189 |
|
|
|
190 |
|
|
#define TC_FIX_TYPE struct { unsigned bsr : 1; }
|
191 |
|
|
#define fx_bsr tc_fix_data.bsr
|
192 |
|
|
#define TC_INIT_FIX_DATA(F) ((F)->tc_fix_data.bsr = 0)
|
193 |
|
|
|
194 |
|
|
#endif
|