1999-05-28 Martin Dorey <mdorey@madge.com>
[deliverable/binutils-gdb.git] / gas / config / tc-i960.h
1 /* tc-i960.h - Basic 80960 instruction formats.
2 Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999
3 Free Software Foundation, Inc.
4
5 This file is part of GAS, the GNU Assembler.
6
7 GAS is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2,
10 or (at your option) any later version.
11
12 GAS is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
15 the GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GAS; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA. */
21
22 #ifndef TC_I960
23 #define TC_I960 1
24
25 #ifdef OBJ_ELF
26 #define TARGET_FORMAT "elf32-i960"
27 #define TARGET_ARCH bfd_arch_i960
28 #endif
29
30 #define TARGET_BYTES_BIG_ENDIAN 0
31
32 #define WORKING_DOT_WORD
33
34 /*
35 * The 'COJ' instructions are actually COBR instructions with the 'b' in
36 * the mnemonic replaced by a 'j'; they are ALWAYS "de-optimized" if necessary:
37 * if the displacement will not fit in 13 bits, the assembler will replace them
38 * with the corresponding compare and branch instructions.
39 *
40 * All of the 'MEMn' instructions are the same format; the 'n' in the name
41 * indicates the default index scale factor (the size of the datum operated on).
42 *
43 * The FBRA formats are not actually an instruction format. They are the
44 * "convenience directives" for branching on floating-point comparisons,
45 * each of which generates 2 instructions (a 'bno' and one other branch).
46 *
47 * The CALLJ format is not actually an instruction format. It indicates that
48 * the instruction generated (a CTRL-format 'call') should have its relocation
49 * specially flagged for link-time replacement with a 'bal' or 'calls' if
50 * appropriate.
51 */
52
53 /* tailor gas */
54 #define SYMBOLS_NEED_BACKPOINTERS
55 #define LOCAL_LABELS_FB 1
56 #define BITFIELD_CONS_EXPRESSIONS
57
58 /* tailor the coff format */
59 #define BFD_ARCH bfd_arch_i960
60 #define COFF_FLAGS F_AR32WR
61 #define COFF_MAGIC I960ROMAGIC
62 #define OBJ_COFF_SECTION_HEADER_HAS_ALIGNMENT
63 #define OBJ_COFF_MAX_AUXENTRIES (2)
64 #define TC_COUNT_RELOC(FIXP) (!(FIXP)->fx_done)
65 #define TC_COFF_FIX2RTYPE(FIXP) tc_coff_fix2rtype(FIXP)
66 #define TC_COFF_SIZEMACHDEP(FRAGP) tc_coff_sizemachdep(FRAGP)
67 #define TC_COFF_SET_MACHINE(HDRS) tc_headers_hook (HDRS)
68 extern void tc_headers_hook ();
69 extern short tc_coff_fix2rtype ();
70 extern int tc_coff_sizemachdep ();
71
72 /* MEANING OF 'n_other' in the symbol record.
73 *
74 * If non-zero, the 'n_other' fields indicates either a leaf procedure or
75 * a system procedure, as follows:
76 *
77 * 1 <= n_other <= 32 :
78 * The symbol is the entry point to a system procedure.
79 * 'n_value' is the address of the entry, as for any other
80 * procedure. The system procedure number (which can be used in
81 * a 'calls' instruction) is (n_other-1). These entries come from
82 * '.sysproc' directives.
83 *
84 * n_other == N_CALLNAME
85 * the symbol is the 'call' entry point to a leaf procedure.
86 * The *next* symbol in the symbol table must be the corresponding
87 * 'bal' entry point to the procedure (see following). These
88 * entries come from '.leafproc' directives in which two different
89 * symbols are specified (the first one is represented here).
90 *
91 *
92 * n_other == N_BALNAME
93 * the symbol is the 'bal' entry point to a leaf procedure.
94 * These entries result from '.leafproc' directives in which only
95 * one symbol is specified, or in which the same symbol is
96 * specified twice.
97 *
98 * Note that an N_CALLNAME entry *must* have a corresponding N_BALNAME entry,
99 * but not every N_BALNAME entry must have an N_CALLNAME entry.
100 */
101 #define N_CALLNAME ((char)-1)
102 #define N_BALNAME ((char)-2)
103
104 /* i960 uses a custom relocation record. */
105
106 /* let obj-aout.h know */
107 #define CUSTOM_RELOC_FORMAT 1
108 /* let aout_gnu.h know */
109 #define N_RELOCATION_INFO_DECLARED 1
110 struct relocation_info
111 {
112 int r_address; /* File address of item to be relocated */
113 unsigned
114 r_index:24, /* Index of symbol on which relocation is based*/
115 r_pcrel:1, /* 1 => relocate PC-relative; else absolute
116 * On i960, pc-relative implies 24-bit
117 * address, absolute implies 32-bit.
118 */
119 r_length:2, /* Number of bytes to relocate:
120 * 0 => 1 byte
121 * 1 => 2 bytes
122 * 2 => 4 bytes -- only value used for i960
123 */
124 r_extern:1, r_bsr:1, /* Something for the GNU NS32K assembler */
125 r_disp:1, /* Something for the GNU NS32K assembler */
126 r_callj:1, /* 1 if relocation target is an i960 'callj' */
127 nuthin:1; /* Unused */
128 };
129
130 #ifdef OBJ_COFF
131
132 /* We store the bal information in the sy_tc field. */
133 #define TC_SYMFIELD_TYPE struct symbol *
134
135 #define TC_ADJUST_RELOC_COUNT(FIXP,COUNT) \
136 { fixS *tcfixp = (FIXP); \
137 for (;tcfixp;tcfixp=tcfixp->fx_next) \
138 if (tcfixp->fx_tcbit && tcfixp->fx_addsy != 0) \
139 ++(COUNT); \
140 }
141 #endif
142
143 extern int i960_validate_fix PARAMS ((struct fix *, segT, struct symbol **));
144 #define TC_VALIDATE_FIX(FIXP,SEGTYPE,LABEL) \
145 if (i960_validate_fix (FIXP, SEGTYPE, &add_symbolP) != 0) goto LABEL
146
147 #ifdef OBJ_ELF
148 #define TC_RELOC_RTSYM_LOC_FIXUP(FIX) \
149 ((FIX)->fx_addsy == NULL \
150 || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
151 && ! S_IS_WEAK ((FIX)->fx_addsy) \
152 && S_IS_DEFINED ((FIX)->fx_addsy) \
153 && ! S_IS_COMMON ((FIX)->fx_addsy)))
154 #endif
155
156 #ifndef OBJ_ELF
157 #define tc_fix_adjustable(FIXP) ((FIXP)->fx_bsr == 0)
158 #else
159 #define tc_fix_adjustable(FIXP) \
160 ((FIXP)->fx_bsr == 0 \
161 && ! S_IS_EXTERNAL ((FIXP)->fx_addsy) \
162 && ! S_IS_WEAK ((FIXP)->fx_addsy))
163 #endif
164
165 extern void brtab_emit PARAMS ((void));
166 #define md_end() brtab_emit ()
167
168 extern void reloc_callj ();
169
170 extern void tc_set_bal_of_call PARAMS ((struct symbol *, struct symbol *));
171
172 extern struct symbol *tc_get_bal_of_call PARAMS ((struct symbol *));
173
174 extern void i960_handle_align ();
175 #define HANDLE_ALIGN(FRAG) i960_handle_align (FRAG)
176 #define NEED_FX_R_TYPE
177 #define NO_RELOC -1
178
179 #define md_operand(x)
180
181 extern const struct relax_type md_relax_table[];
182 #define TC_GENERIC_RELAX_TABLE md_relax_table
183
184 #define LINKER_RELAXING_SHRINKS_ONLY
185
186 #define TC_FIX_TYPE struct { unsigned bsr : 1; }
187 #define fx_bsr tc_fix_data.bsr
188 #define TC_INIT_FIX_DATA(F) ((F)->tc_fix_data.bsr = 0)
189
190 #endif
191
192 /* end of tc-i960.h */
This page took 0.035133 seconds and 4 git commands to generate.