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.
5 This file is part of GAS, the GNU Assembler.
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.
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.
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
26 #define TARGET_FORMAT "elf32-i960"
27 #define TARGET_ARCH bfd_arch_i960
30 #define TARGET_BYTES_BIG_ENDIAN 0
32 #define WORKING_DOT_WORD
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.
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).
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).
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
54 #define SYMBOLS_NEED_BACKPOINTERS
55 #define LOCAL_LABELS_FB 1
56 #define BITFIELD_CONS_EXPRESSIONS
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 ();
72 /* MEANING OF 'n_other' in the symbol record.
74 * If non-zero, the 'n_other' fields indicates either a leaf procedure or
75 * a system procedure, as follows:
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.
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).
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
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.
101 #define N_CALLNAME ((char)-1)
102 #define N_BALNAME ((char)-2)
104 /* i960 uses a custom relocation record. */
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
112 int r_address
; /* File address of item to be relocated */
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.
119 r_length
:2, /* Number of bytes to relocate:
122 * 2 => 4 bytes -- only value used for i960
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 */
132 /* We store the bal information in the sy_tc field. */
133 #define TC_SYMFIELD_TYPE symbolS *
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) \
143 extern int i960_validate_fix
PARAMS ((struct fix
*, segT
, symbolS
**));
144 #define TC_VALIDATE_FIX(FIXP,SEGTYPE,LABEL) \
145 if (i960_validate_fix (FIXP, SEGTYPE, &add_symbolP) != 0) goto LABEL
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)))
156 /* This arranges for gas/write.c to not apply a relocation if
157 tc_fix_adjustable() says it is not adjustable. */
158 #define TC_DONT_FIX_NON_ADJUSTABLE 1
161 #define tc_fix_adjustable(FIXP) ((FIXP)->fx_bsr == 0)
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))
169 extern void brtab_emit
PARAMS ((void));
170 #define md_end() brtab_emit ()
172 extern void reloc_callj ();
174 extern void tc_set_bal_of_call
PARAMS ((symbolS
*, symbolS
*));
176 extern struct symbol
*tc_get_bal_of_call
PARAMS ((symbolS
*));
178 extern void i960_handle_align ();
179 #define HANDLE_ALIGN(FRAG) i960_handle_align (FRAG)
180 #define NEED_FX_R_TYPE
183 #define md_operand(x)
185 extern const struct relax_type md_relax_table
[];
186 #define TC_GENERIC_RELAX_TABLE md_relax_table
188 #define LINKER_RELAXING_SHRINKS_ONLY
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)
196 /* end of tc-i960.h */