Update the address and phone number of the FSF
[binutils.git] / gas / config / tc-i960.h
blobac89b527fd80e5d18ea7941d1b1fdc6f10ef19cd
1 /* tc-i960.h - Basic 80960 instruction formats.
2 Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1998, 1999,
3 2000, 2001, 2002, 2003
4 Free Software Foundation, Inc.
6 This file is part of GAS, the GNU Assembler.
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.
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.
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. */
23 #ifndef TC_I960
24 #define TC_I960 1
26 #ifdef OBJ_ELF
27 #define TARGET_FORMAT "elf32-i960"
28 #define TARGET_ARCH bfd_arch_i960
29 #endif
31 #define TARGET_BYTES_BIG_ENDIAN 0
33 #define WORKING_DOT_WORD
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.
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).
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).
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.
54 /* tailor gas */
55 #define SYMBOLS_NEED_BACKPOINTERS
56 #define LOCAL_LABELS_FB 1
57 #define BITFIELD_CONS_EXPRESSIONS
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(FIX) (!(FIX)->fx_done)
66 #define TC_COFF_FIX2RTYPE(FIX) tc_coff_fix2rtype (FIX)
67 #define TC_COFF_SIZEMACHDEP(FRAGP) tc_coff_sizemachdep (FRAGP)
68 #define TC_COFF_SET_MACHINE(HDRS) tc_headers_hook (HDRS)
69 extern int tc_coff_sizemachdep PARAMS ((struct frag *));
71 /* MEANING OF 'n_other' in the symbol record.
73 * If non-zero, the 'n_other' fields indicates either a leaf procedure or
74 * a system procedure, as follows:
76 * 1 <= n_other <= 32 :
77 * The symbol is the entry point to a system procedure.
78 * 'n_value' is the address of the entry, as for any other
79 * procedure. The system procedure number (which can be used in
80 * a 'calls' instruction) is (n_other-1). These entries come from
81 * '.sysproc' directives.
83 * n_other == N_CALLNAME
84 * the symbol is the 'call' entry point to a leaf procedure.
85 * The *next* symbol in the symbol table must be the corresponding
86 * 'bal' entry point to the procedure (see following). These
87 * entries come from '.leafproc' directives in which two different
88 * symbols are specified (the first one is represented here).
91 * n_other == N_BALNAME
92 * the symbol is the 'bal' entry point to a leaf procedure.
93 * These entries result from '.leafproc' directives in which only
94 * one symbol is specified, or in which the same symbol is
95 * specified twice.
97 * Note that an N_CALLNAME entry *must* have a corresponding N_BALNAME entry,
98 * but not every N_BALNAME entry must have an N_CALLNAME entry.
100 #define N_CALLNAME ((char)-1)
101 #define N_BALNAME ((char)-2)
103 /* i960 uses a custom relocation record. */
105 /* let obj-aout.h know */
106 #define CUSTOM_RELOC_FORMAT 1
107 /* let aout_gnu.h know */
108 #define N_RELOCATION_INFO_DECLARED 1
109 struct relocation_info
111 int r_address; /* File address of item to be relocated */
112 unsigned
113 r_index:24, /* Index of symbol on which relocation is based*/
114 r_pcrel:1, /* 1 => relocate PC-relative; else absolute
115 * On i960, pc-relative implies 24-bit
116 * address, absolute implies 32-bit.
118 r_length:2, /* Number of bytes to relocate:
119 * 0 => 1 byte
120 * 1 => 2 bytes
121 * 2 => 4 bytes -- only value used for i960
123 r_extern:1, r_bsr:1, /* Something for the GNU NS32K assembler */
124 r_disp:1, /* Something for the GNU NS32K assembler */
125 r_callj:1, /* 1 if relocation target is an i960 'callj' */
126 nuthin:1; /* Unused */
129 /* No shared lib support, so we don't need to ensure externally
130 visible symbols can be overridden. */
131 #define EXTERN_FORCE_RELOC 0
133 /* Makes no sense to use the difference of 2 arbitrary symbols
134 as the target of a call instruction. */
135 #define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \
136 ((FIX)->fx_tcbit \
137 || ! SEG_NORMAL (SEG) \
138 || TC_FORCE_RELOCATION (FIX))
140 /* reloc_callj() may replace a 'call' with a 'calls' or a
141 'bal', in which cases it modifies *fixP as appropriate.
142 In the case of a 'calls', no further work is required. */
143 extern int reloc_callj PARAMS ((struct fix *));
145 #define TC_FORCE_RELOCATION_ABS(FIX) \
146 (TC_FORCE_RELOCATION (FIX) \
147 || reloc_callj (FIX))
149 #define TC_FORCE_RELOCATION_LOCAL(FIX) \
150 (!(FIX)->fx_pcrel \
151 || (FIX)->fx_plt \
152 || TC_FORCE_RELOCATION (FIX) \
153 || reloc_callj (FIX))
155 #ifdef OBJ_COFF
157 /* We store the bal information in the sy_tc field. */
158 #define TC_SYMFIELD_TYPE symbolS *
160 #define TC_ADJUST_RELOC_COUNT(FIX,COUNT) \
161 { fixS *tcfixp = (FIX); \
162 for (;tcfixp;tcfixp=tcfixp->fx_next) \
163 if (tcfixp->fx_tcbit && tcfixp->fx_addsy != 0) \
164 ++(COUNT); \
166 #endif
168 extern int i960_validate_fix PARAMS ((struct fix *, segT));
169 #define TC_VALIDATE_FIX(FIX,SEGTYPE,LABEL) \
170 if (!i960_validate_fix (FIX, SEGTYPE)) goto LABEL
172 #define tc_fix_adjustable(FIX) ((FIX)->fx_bsr == 0)
174 #ifndef OBJ_ELF
175 /* Values passed to md_apply_fix3 sometimes include symbol values. */
176 #define MD_APPLY_SYM_VALUE(FIX) tc_fix_adjustable (FIX)
177 #else
178 /* Values passed to md_apply_fix3 don't include the symbol value. */
179 #define MD_APPLY_SYM_VALUE(FIX) 0
180 #endif
182 extern void brtab_emit PARAMS ((void));
183 #define md_end() brtab_emit ()
185 extern void tc_set_bal_of_call PARAMS ((symbolS *, symbolS *));
187 extern struct symbol *tc_get_bal_of_call PARAMS ((symbolS *));
189 extern void i960_handle_align PARAMS ((struct frag *));
190 #define HANDLE_ALIGN(FRAG) i960_handle_align (FRAG)
191 #define NEED_FX_R_TYPE
192 #define NO_RELOC -1
194 #define md_operand(x)
196 extern const struct relax_type md_relax_table[];
197 #define TC_GENERIC_RELAX_TABLE md_relax_table
199 #define LINKER_RELAXING_SHRINKS_ONLY
201 #define TC_FIX_TYPE struct { unsigned bsr : 1; }
202 #define fx_bsr tc_fix_data.bsr
203 #define TC_INIT_FIX_DATA(F) ((F)->tc_fix_data.bsr = 0)
205 #endif