* config/tc-cris.c (md_estimate_size_before_relax) <case
[deliverable/binutils-gdb.git] / gas / config / tc-i960.h
1 /* tc-i960.h - Basic 80960 instruction formats.
2 Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1998, 1999,
3 2000
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 2,
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, 59 Temple Place - Suite 330, Boston, MA
21 02111-1307, 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 SYMBOLS_NEED_BACKPOINTERS
56 #define LOCAL_LABELS_FB 1
57 #define BITFIELD_CONS_EXPRESSIONS
58
59 /* tailor the coff format */
60 #define BFD_ARCH bfd_arch_i960
61 #define COFF_FLAGS F_AR32WR
62 #define COFF_MAGIC I960ROMAGIC
63 #define OBJ_COFF_SECTION_HEADER_HAS_ALIGNMENT
64 #define OBJ_COFF_MAX_AUXENTRIES (2)
65 #define TC_COUNT_RELOC(FIXP) (!(FIXP)->fx_done)
66 #define TC_COFF_FIX2RTYPE(FIXP) tc_coff_fix2rtype(FIXP)
67 #define TC_COFF_SIZEMACHDEP(FRAGP) tc_coff_sizemachdep(FRAGP)
68 #define TC_COFF_SET_MACHINE(HDRS) tc_headers_hook (HDRS)
69 extern void tc_headers_hook ();
70 extern short tc_coff_fix2rtype ();
71 extern int tc_coff_sizemachdep ();
72
73 /* MEANING OF 'n_other' in the symbol record.
74 *
75 * If non-zero, the 'n_other' fields indicates either a leaf procedure or
76 * a system procedure, as follows:
77 *
78 * 1 <= n_other <= 32 :
79 * The symbol is the entry point to a system procedure.
80 * 'n_value' is the address of the entry, as for any other
81 * procedure. The system procedure number (which can be used in
82 * a 'calls' instruction) is (n_other-1). These entries come from
83 * '.sysproc' directives.
84 *
85 * n_other == N_CALLNAME
86 * the symbol is the 'call' entry point to a leaf procedure.
87 * The *next* symbol in the symbol table must be the corresponding
88 * 'bal' entry point to the procedure (see following). These
89 * entries come from '.leafproc' directives in which two different
90 * symbols are specified (the first one is represented here).
91 *
92 *
93 * n_other == N_BALNAME
94 * the symbol is the 'bal' entry point to a leaf procedure.
95 * These entries result from '.leafproc' directives in which only
96 * one symbol is specified, or in which the same symbol is
97 * specified twice.
98 *
99 * Note that an N_CALLNAME entry *must* have a corresponding N_BALNAME entry,
100 * but not every N_BALNAME entry must have an N_CALLNAME entry.
101 */
102 #define N_CALLNAME ((char)-1)
103 #define N_BALNAME ((char)-2)
104
105 /* i960 uses a custom relocation record. */
106
107 /* let obj-aout.h know */
108 #define CUSTOM_RELOC_FORMAT 1
109 /* let aout_gnu.h know */
110 #define N_RELOCATION_INFO_DECLARED 1
111 struct relocation_info
112 {
113 int r_address; /* File address of item to be relocated */
114 unsigned
115 r_index:24, /* Index of symbol on which relocation is based*/
116 r_pcrel:1, /* 1 => relocate PC-relative; else absolute
117 * On i960, pc-relative implies 24-bit
118 * address, absolute implies 32-bit.
119 */
120 r_length:2, /* Number of bytes to relocate:
121 * 0 => 1 byte
122 * 1 => 2 bytes
123 * 2 => 4 bytes -- only value used for i960
124 */
125 r_extern:1, r_bsr:1, /* Something for the GNU NS32K assembler */
126 r_disp:1, /* Something for the GNU NS32K assembler */
127 r_callj:1, /* 1 if relocation target is an i960 'callj' */
128 nuthin:1; /* Unused */
129 };
130
131 #ifdef OBJ_COFF
132
133 /* We store the bal information in the sy_tc field. */
134 #define TC_SYMFIELD_TYPE symbolS *
135
136 #define TC_ADJUST_RELOC_COUNT(FIXP,COUNT) \
137 { fixS *tcfixp = (FIXP); \
138 for (;tcfixp;tcfixp=tcfixp->fx_next) \
139 if (tcfixp->fx_tcbit && tcfixp->fx_addsy != 0) \
140 ++(COUNT); \
141 }
142 #endif
143
144 extern int i960_validate_fix PARAMS ((struct fix *, segT, symbolS **));
145 #define TC_VALIDATE_FIX(FIXP,SEGTYPE,LABEL) \
146 if (i960_validate_fix (FIXP, SEGTYPE, &add_symbolP) != 0) goto LABEL
147
148 #ifdef OBJ_ELF
149 #define TC_RELOC_RTSYM_LOC_FIXUP(FIX) \
150 ((FIX)->fx_addsy == NULL \
151 || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
152 && ! S_IS_WEAK ((FIX)->fx_addsy) \
153 && S_IS_DEFINED ((FIX)->fx_addsy) \
154 && ! S_IS_COMMON ((FIX)->fx_addsy)))
155 #endif
156
157 #ifndef OBJ_ELF
158 #define tc_fix_adjustable(FIXP) ((FIXP)->fx_bsr == 0)
159 /* This arranges for gas/write.c to not apply a relocation if
160 tc_fix_adjustable() says it is not adjustable. */
161 #define TC_FIX_ADJUSTABLE(fixP) tc_fix_adjustable (fixP)
162 #else
163 #define tc_fix_adjustable(FIXP) \
164 ((FIXP)->fx_bsr == 0 \
165 && ! S_IS_EXTERNAL ((FIXP)->fx_addsy) \
166 && ! S_IS_WEAK ((FIXP)->fx_addsy))
167 #endif
168
169 extern void brtab_emit PARAMS ((void));
170 #define md_end() brtab_emit ()
171
172 extern void reloc_callj ();
173
174 extern void tc_set_bal_of_call PARAMS ((symbolS *, symbolS *));
175
176 extern struct symbol *tc_get_bal_of_call PARAMS ((symbolS *));
177
178 extern void i960_handle_align ();
179 #define HANDLE_ALIGN(FRAG) i960_handle_align (FRAG)
180 #define NEED_FX_R_TYPE
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
This page took 0.042676 seconds and 4 git commands to generate.