1 /* tc-i960.h - Basic 80960 instruction formats.
2 Copyright (C) 1989-2017 Free Software Foundation, Inc.
4 This file is part of GAS, the GNU Assembler.
6 GAS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as
8 published by the Free Software Foundation; either version 3,
9 or (at your option) any later version.
11 GAS is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
14 the GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GAS; see the file COPYING. If not, write to the Free
18 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
25 #define TARGET_FORMAT "elf32-i960"
26 #define TARGET_ARCH bfd_arch_i960
29 #define TARGET_BYTES_BIG_ENDIAN 0
31 #define WORKING_DOT_WORD
34 * The 'COJ' instructions are actually COBR instructions with the 'b' in
35 * the mnemonic replaced by a 'j'; they are ALWAYS "de-optimized" if necessary:
36 * if the displacement will not fit in 13 bits, the assembler will replace them
37 * with the corresponding compare and branch instructions.
39 * All of the 'MEMn' instructions are the same format; the 'n' in the name
40 * indicates the default index scale factor (the size of the datum operated on).
42 * The FBRA formats are not actually an instruction format. They are the
43 * "convenience directives" for branching on floating-point comparisons,
44 * each of which generates 2 instructions (a 'bno' and one other branch).
46 * The CALLJ format is not actually an instruction format. It indicates that
47 * the instruction generated (a CTRL-format 'call') should have its relocation
48 * specially flagged for link-time replacement with a 'bal' or 'calls' if
53 #define LOCAL_LABELS_FB 1
54 #define BITFIELD_CONS_EXPRESSIONS
56 /* tailor the coff format */
57 #define COFF_MAGIC I960ROMAGIC
58 #define OBJ_COFF_MAX_AUXENTRIES (2)
60 /* MEANING OF 'n_other' in the symbol record.
62 * If non-zero, the 'n_other' fields indicates either a leaf procedure or
63 * a system procedure, as follows:
65 * 1 <= n_other <= 32 :
66 * The symbol is the entry point to a system procedure.
67 * 'n_value' is the address of the entry, as for any other
68 * procedure. The system procedure number (which can be used in
69 * a 'calls' instruction) is (n_other-1). These entries come from
70 * '.sysproc' directives.
72 * n_other == N_CALLNAME
73 * the symbol is the 'call' entry point to a leaf procedure.
74 * The *next* symbol in the symbol table must be the corresponding
75 * 'bal' entry point to the procedure (see following). These
76 * entries come from '.leafproc' directives in which two different
77 * symbols are specified (the first one is represented here).
80 * n_other == N_BALNAME
81 * the symbol is the 'bal' entry point to a leaf procedure.
82 * These entries result from '.leafproc' directives in which only
83 * one symbol is specified, or in which the same symbol is
86 * Note that an N_CALLNAME entry *must* have a corresponding N_BALNAME entry,
87 * but not every N_BALNAME entry must have an N_CALLNAME entry.
89 #define N_CALLNAME ((char)-1)
90 #define N_BALNAME ((char)-2)
92 /* i960 uses a custom relocation record. */
94 /* let obj-aout.h know */
95 #define CUSTOM_RELOC_FORMAT 1
96 /* let aout_gnu.h know */
97 #define N_RELOCATION_INFO_DECLARED 1
98 struct relocation_info
100 int r_address
; /* File address of item to be relocated */
102 r_index
:24, /* Index of symbol on which relocation is based*/
103 r_pcrel
:1, /* 1 => relocate PC-relative; else absolute
104 * On i960, pc-relative implies 24-bit
105 * address, absolute implies 32-bit.
107 r_length
:2, /* Number of bytes to relocate:
110 * 2 => 4 bytes -- only value used for i960
112 r_extern
:1, r_bsr
:1, /* Something for the GNU NS32K assembler */
113 r_disp
:1, /* Something for the GNU NS32K assembler */
114 r_callj
:1, /* 1 if relocation target is an i960 'callj' */
115 nuthin
:1; /* Unused */
118 /* No shared lib support, so we don't need to ensure externally
119 visible symbols can be overridden. */
120 #define EXTERN_FORCE_RELOC 0
122 /* Makes no sense to use the difference of 2 arbitrary symbols
123 as the target of a call instruction. */
124 #define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \
125 (GENERIC_FORCE_RELOCATION_SUB_SAME (FIX, SEG) \
127 || TC_FORCE_RELOCATION (FIX))
129 /* reloc_callj() may replace a 'call' with a 'calls' or a
130 'bal', in which cases it modifies *fixP as appropriate.
131 In the case of a 'calls', no further work is required. */
132 extern int reloc_callj (struct fix
*);
134 #define TC_FORCE_RELOCATION_ABS(FIX) \
135 (TC_FORCE_RELOCATION (FIX) \
136 || reloc_callj (FIX))
138 #define TC_FORCE_RELOCATION_LOCAL(FIX) \
139 (GENERIC_FORCE_RELOCATION_LOCAL (FIX) \
140 || reloc_callj (FIX))
144 /* We store the bal information in the sy_tc field. */
145 #define TC_SYMFIELD_TYPE symbolS *
149 extern int i960_validate_fix (struct fix
*, segT
);
150 #define TC_VALIDATE_FIX(FIX,SEGTYPE,LABEL) \
151 if (!i960_validate_fix (FIX, SEGTYPE)) goto LABEL
153 #define tc_fix_adjustable(FIX) ((FIX)->fx_bsr == 0)
156 /* Values passed to md_apply_fix sometimes include symbol values. */
157 #define MD_APPLY_SYM_VALUE(FIX) tc_fix_adjustable (FIX)
159 /* Values passed to md_apply_fix don't include the symbol value. */
160 #define MD_APPLY_SYM_VALUE(FIX) 0
163 extern void brtab_emit (void);
164 #define md_end() brtab_emit ()
166 extern void tc_set_bal_of_call (symbolS
*, symbolS
*);
168 extern struct symbol
*tc_get_bal_of_call (symbolS
*);
170 extern void i960_handle_align (struct frag
*);
171 #define HANDLE_ALIGN(FRAG) i960_handle_align (FRAG)
174 #define md_operand(x)
176 extern const struct relax_type md_relax_table
[];
177 #define TC_GENERIC_RELAX_TABLE md_relax_table
179 #define LINKER_RELAXING_SHRINKS_ONLY
181 #define TC_FIX_TYPE struct { unsigned bsr : 1; }
182 #define fx_bsr tc_fix_data.bsr
183 #define TC_INIT_FIX_DATA(F) ((F)->tc_fix_data.bsr = 0)