Update copyright years
[deliverable/binutils-gdb.git] / gas / config / tc-i960.h
CommitLineData
252b5132 1/* tc-i960.h - Basic 80960 instruction formats.
4b95cf5c 2 Copyright (C) 1989-2014 Free Software Foundation, Inc.
252b5132
RH
3
4 This file is part of GAS, the GNU Assembler.
5
6 GAS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as
ec2655a6 8 published by the Free Software Foundation; either version 3,
252b5132
RH
9 or (at your option) any later version.
10
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.
15
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
4b4da160
NC
18 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
19 02110-1301, USA. */
252b5132
RH
20
21#ifndef TC_I960
22#define TC_I960 1
23
bedf545c
ILT
24#ifdef OBJ_ELF
25#define TARGET_FORMAT "elf32-i960"
26#define TARGET_ARCH bfd_arch_i960
27#endif
28
252b5132
RH
29#define TARGET_BYTES_BIG_ENDIAN 0
30
31#define WORKING_DOT_WORD
32
33/*
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.
38 *
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).
41 *
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).
45 *
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
49 * appropriate.
50 */
51
52/* tailor gas */
252b5132
RH
53#define LOCAL_LABELS_FB 1
54#define BITFIELD_CONS_EXPRESSIONS
55
56/* tailor the coff format */
252b5132 57#define COFF_MAGIC I960ROMAGIC
252b5132 58#define OBJ_COFF_MAX_AUXENTRIES (2)
252b5132
RH
59
60/* MEANING OF 'n_other' in the symbol record.
61 *
62 * If non-zero, the 'n_other' fields indicates either a leaf procedure or
63 * a system procedure, as follows:
64 *
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.
71 *
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).
78 *
79 *
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
84 * specified twice.
85 *
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.
88 */
89#define N_CALLNAME ((char)-1)
90#define N_BALNAME ((char)-2)
91
4a4f25cf 92/* i960 uses a custom relocation record. */
252b5132
RH
93
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
98struct relocation_info
99 {
100 int r_address; /* File address of item to be relocated */
101 unsigned
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.
106 */
107 r_length:2, /* Number of bytes to relocate:
108 * 0 => 1 byte
109 * 1 => 2 bytes
110 * 2 => 4 bytes -- only value used for i960
111 */
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 */
116 };
117
a161fe53
AM
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
121
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 ((FIX)->fx_tcbit \
ae6063d4
AM
126 || ! SEG_NORMAL (SEG) \
127 || TC_FORCE_RELOCATION (FIX))
a161fe53
AM
128
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. */
5a49b8ac 132extern int reloc_callj (struct fix *);
a161fe53
AM
133
134#define TC_FORCE_RELOCATION_ABS(FIX) \
135 (TC_FORCE_RELOCATION (FIX) \
136 || reloc_callj (FIX))
137
138#define TC_FORCE_RELOCATION_LOCAL(FIX) \
139 (!(FIX)->fx_pcrel \
a161fe53
AM
140 || TC_FORCE_RELOCATION (FIX) \
141 || reloc_callj (FIX))
142
252b5132
RH
143#ifdef OBJ_COFF
144
145/* We store the bal information in the sy_tc field. */
49309057 146#define TC_SYMFIELD_TYPE symbolS *
252b5132 147
252b5132
RH
148#endif
149
5a49b8ac 150extern int i960_validate_fix (struct fix *, segT);
a161fe53
AM
151#define TC_VALIDATE_FIX(FIX,SEGTYPE,LABEL) \
152 if (!i960_validate_fix (FIX, SEGTYPE)) goto LABEL
252b5132 153
a161fe53 154#define tc_fix_adjustable(FIX) ((FIX)->fx_bsr == 0)
bedf545c
ILT
155
156#ifndef OBJ_ELF
55cf6793 157/* Values passed to md_apply_fix sometimes include symbol values. */
a161fe53 158#define MD_APPLY_SYM_VALUE(FIX) tc_fix_adjustable (FIX)
bedf545c 159#else
55cf6793 160/* Values passed to md_apply_fix don't include the symbol value. */
a161fe53 161#define MD_APPLY_SYM_VALUE(FIX) 0
bedf545c 162#endif
252b5132 163
5a49b8ac 164extern void brtab_emit (void);
252b5132
RH
165#define md_end() brtab_emit ()
166
5a49b8ac 167extern void tc_set_bal_of_call (symbolS *, symbolS *);
252b5132 168
5a49b8ac 169extern struct symbol *tc_get_bal_of_call (symbolS *);
252b5132 170
5a49b8ac 171extern void i960_handle_align (struct frag *);
252b5132 172#define HANDLE_ALIGN(FRAG) i960_handle_align (FRAG)
252b5132
RH
173#define NO_RELOC -1
174
175#define md_operand(x)
176
177extern const struct relax_type md_relax_table[];
178#define TC_GENERIC_RELAX_TABLE md_relax_table
179
180#define LINKER_RELAXING_SHRINKS_ONLY
181
182#define TC_FIX_TYPE struct { unsigned bsr : 1; }
183#define fx_bsr tc_fix_data.bsr
184#define TC_INIT_FIX_DATA(F) ((F)->tc_fix_data.bsr = 0)
185
186#endif
This page took 0.684804 seconds and 4 git commands to generate.