]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gas/write.h
daily update
[thirdparty/binutils-gdb.git] / gas / write.h
CommitLineData
252b5132 1/* write.h
f7e42eb4 2 Copyright 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001
a01b9fa4 3 Free Software Foundation, Inc.
252b5132
RH
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 published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GAS is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 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 __write_h__
23#define __write_h__
24
25#ifndef TC_I960
26#ifdef hpux
27#define EXEC_MACHINE_TYPE HP9000S200_ID
28#endif
29#endif /* TC_I960 */
30
31#ifndef BFD_ASSEMBLER
32
33#ifndef LOCAL_LABEL
34#define LOCAL_LABEL(name) (name [0] == 'L' )
35#endif
36
37#define S_LOCAL_NAME(s) (LOCAL_LABEL (S_GET_NAME (s)))
38
39#endif /* ! BFD_ASSEMBLER */
40
41/* This is the name of a fake symbol which will never appear in the
42 assembler output. S_IS_LOCAL detects it because of the \001. */
43#define FAKE_LABEL_NAME "L0\001"
44
45#include "bit_fix.h"
46
47/*
48 * FixSs may be built up in any order.
49 */
50
51struct fix
52{
53 /* These small fields are grouped together for compactness of
54 this structure, and efficiency of access on some architectures. */
55
56 /* pc-relative offset adjust (only used by m68k) */
57 char fx_pcrel_adjust;
58
59 /* How many bytes are involved? */
60 unsigned char fx_size;
61
62 /* Is this a pc-relative relocation? */
63 unsigned fx_pcrel : 1;
64
65 /* Is this a relocation to a procedure linkage table entry? If so,
66 some of the reductions we try to apply are invalid. A better way
67 might be to represent PLT entries with different kinds of
68 symbols, and use normal relocations (with undefined symbols);
69 look into it for version 2.6. */
70 unsigned fx_plt : 1;
71
72 /* Is this value an immediate displacement? */
73 /* Only used on i960 and ns32k; merge it into TC_FIX_TYPE sometime. */
74 unsigned fx_im_disp : 2;
75
76 /* A bit for the CPU specific code.
77 This probably can be folded into tc_fix_data, below. */
78 unsigned fx_tcbit : 1;
79
80 /* Has this relocation already been applied? */
81 unsigned fx_done : 1;
82
83 /* Suppress overflow complaints on large addends. This is used
84 in the PowerPC ELF config to allow large addends on the
85 BFD_RELOC_{LO16,HI16,HI16_S} relocations.
86
87 @@ Can this be determined from BFD? */
88 unsigned fx_no_overflow : 1;
89
90 /* The value is signed when checking for overflow. */
91 unsigned fx_signed : 1;
92
93 /* Which frag does this fix apply to? */
94 fragS *fx_frag;
95
96 /* Where is the first byte to fix up? */
97 long fx_where;
98
a01b9fa4 99 /* NULL or Symbol whose value we add in. */
252b5132
RH
100 symbolS *fx_addsy;
101
a01b9fa4 102 /* NULL or Symbol whose value we subtract. */
252b5132
RH
103 symbolS *fx_subsy;
104
a01b9fa4 105 /* Absolute number we add in. */
252b5132
RH
106 valueT fx_offset;
107
108 /* Next fixS in linked list, or NULL. */
109 struct fix *fx_next;
110
111 /* If NULL, no bitfix's to do. */
112 /* Only i960-coff and ns32k use this, and i960-coff stores an
113 integer. This can probably be folded into tc_fix_data, below.
114 @@ Alpha also uses it, but only to disable certain relocation
115 processing. */
116 bit_fixS *fx_bit_fixP;
117
118#ifdef BFD_ASSEMBLER
119 bfd_reloc_code_real_type fx_r_type;
120#else
121#ifdef NEED_FX_R_TYPE
122 /* Hack for machines where the type of reloc can't be
123 worked out by looking at how big it is. */
124 int fx_r_type;
125#endif
126#endif
127
128 /* This field is sort of misnamed. It appears to be a sort of random
129 scratch field, for use by the back ends. The main gas code doesn't
130 do anything but initialize it to zero. The use of it does need to
131 be coordinated between the cpu and format files, though. E.g., some
132 coff targets pass the `addend' field from the cpu file via this
133 field. I don't know why the `fx_offset' field above can't be used
134 for that; investigate later and document. KR */
135 valueT fx_addnumber;
136
137 /* The location of the instruction which created the reloc, used
138 in error messages. */
139 char *fx_file;
140 unsigned fx_line;
141
142#ifdef USING_CGEN
143 struct {
144 /* CGEN_INSN entry for this instruction. */
145 const struct cgen_insn *insn;
146 /* Target specific data, usually reloc number. */
147 int opinfo;
148 } fx_cgen;
149#endif
150
151#ifdef TC_FIX_TYPE
152 /* Location where a backend can attach additional data
153 needed to perform fixups. */
154 TC_FIX_TYPE tc_fix_data;
155#endif
156};
157
158typedef struct fix fixS;
159
e46d99eb
AM
160extern int finalize_syms;
161
252b5132
RH
162#ifndef BFD_ASSEMBLER
163extern char *next_object_file_charP;
164
165#ifndef MANY_SEGMENTS
a01b9fa4
KH
166COMMON fixS *text_fix_root, *text_fix_tail; /* Chains fixSs. */
167COMMON fixS *data_fix_root, *data_fix_tail; /* Chains fixSs. */
168COMMON fixS *bss_fix_root, *bss_fix_tail; /* Chains fixSs. */
169extern struct frag *text_last_frag; /* Last frag in segment. */
170extern struct frag *data_last_frag; /* Last frag in segment. */
252b5132 171#endif
a01b9fa4 172COMMON fixS **seg_fix_rootP, **seg_fix_tailP; /* -> one of above. */
252b5132
RH
173#endif
174
175extern long string_byte_count;
176extern int section_alignment[];
177
178extern bit_fixS *bit_fix_new
179 PARAMS ((int size, int offset, long base_type, long base_adj, long min,
180 long max, long add));
181extern void append PARAMS ((char **charPP, char *fromP, unsigned long length));
182extern void record_alignment PARAMS ((segT seg, int align));
0a9ef439 183extern int get_recorded_alignment PARAMS ((segT seg));
252b5132
RH
184extern void subsegs_finish PARAMS ((void));
185extern void write_object_file PARAMS ((void));
c842b53a 186extern long relax_frag PARAMS ((segT, fragS *, long));
e46d99eb 187extern int relax_segment
252b5132
RH
188 PARAMS ((struct frag * seg_frag_root, segT seg_type));
189
190extern void number_to_chars_littleendian PARAMS ((char *, valueT, int));
191extern void number_to_chars_bigendian PARAMS ((char *, valueT, int));
192
193#ifdef BFD_ASSEMBLER
194extern fixS *fix_new
195 PARAMS ((fragS * frag, int where, int size, symbolS * add_symbol,
196 offsetT offset, int pcrel, bfd_reloc_code_real_type r_type));
197extern fixS *fix_new_exp
198 PARAMS ((fragS * frag, int where, int size, expressionS *exp, int pcrel,
199 bfd_reloc_code_real_type r_type));
200#else
201extern fixS *fix_new
202 PARAMS ((fragS * frag, int where, int size, symbolS * add_symbol,
203 offsetT offset, int pcrel, int r_type));
204extern fixS *fix_new_exp
205 PARAMS ((fragS * frag, int where, int size, expressionS *exp, int pcrel,
206 int r_type));
207#endif
208
209extern void write_print_statistics PARAMS ((FILE *));
210
211#endif /* __write_h__ */