gdb/
[deliverable/binutils-gdb.git] / gas / write.h
CommitLineData
252b5132 1/* write.h
2da5c037 2 Copyright 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001,
20ee54e8
AM
3 2002, 2003, 2005, 2006, 2007
4 Free Software Foundation, Inc.
252b5132
RH
5
6 This file is part of GAS, the GNU Assembler.
7
8 GAS is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
ec2655a6 10 the Free Software Foundation; either version 3, or (at your option)
252b5132
RH
11 any later version.
12
13 GAS is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
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
4b4da160
NC
20 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
21 02110-1301, USA. */
252b5132
RH
22
23#ifndef __write_h__
24#define __write_h__
25
252b5132
RH
26/* This is the name of a fake symbol which will never appear in the
27 assembler output. S_IS_LOCAL detects it because of the \001. */
7ff0565e 28#ifndef FAKE_LABEL_NAME
252b5132 29#define FAKE_LABEL_NAME "L0\001"
7ff0565e 30#endif
252b5132
RH
31
32#include "bit_fix.h"
33
34/*
35 * FixSs may be built up in any order.
36 */
37
38struct fix
39{
40 /* These small fields are grouped together for compactness of
41 this structure, and efficiency of access on some architectures. */
42
252b5132
RH
43 /* Is this a pc-relative relocation? */
44 unsigned fx_pcrel : 1;
45
252b5132 46 /* Is this value an immediate displacement? */
20ee54e8 47 /* Only used on ns32k; merge it into TC_FIX_TYPE sometime. */
252b5132
RH
48 unsigned fx_im_disp : 2;
49
20ee54e8 50 /* Some bits for the CPU specific code. */
252b5132 51 unsigned fx_tcbit : 1;
20ee54e8 52 unsigned fx_tcbit2 : 1;
252b5132
RH
53
54 /* Has this relocation already been applied? */
55 unsigned fx_done : 1;
56
57 /* Suppress overflow complaints on large addends. This is used
58 in the PowerPC ELF config to allow large addends on the
59 BFD_RELOC_{LO16,HI16,HI16_S} relocations.
60
61 @@ Can this be determined from BFD? */
62 unsigned fx_no_overflow : 1;
63
64 /* The value is signed when checking for overflow. */
65 unsigned fx_signed : 1;
66
552c607f
AM
67 /* pc-relative offset adjust (only used by some CPU specific code) */
68 signed char fx_pcrel_adjust;
20ee54e8
AM
69
70 /* How many bytes are involved? */
71 unsigned char fx_size;
72
252b5132
RH
73 /* Which frag does this fix apply to? */
74 fragS *fx_frag;
75
76 /* Where is the first byte to fix up? */
77 long fx_where;
78
a01b9fa4 79 /* NULL or Symbol whose value we add in. */
252b5132
RH
80 symbolS *fx_addsy;
81
a01b9fa4 82 /* NULL or Symbol whose value we subtract. */
252b5132
RH
83 symbolS *fx_subsy;
84
a01b9fa4 85 /* Absolute number we add in. */
252b5132
RH
86 valueT fx_offset;
87
26346241
AM
88 /* The value of dot when the fixup expression was parsed. */
89 addressT fx_dot_value;
90
8e723a10
CLT
91 /* The frag fx_dot_value is based on. */
92 fragS *fx_dot_frag;
93
252b5132
RH
94 /* Next fixS in linked list, or NULL. */
95 struct fix *fx_next;
96
97 /* If NULL, no bitfix's to do. */
98 /* Only i960-coff and ns32k use this, and i960-coff stores an
99 integer. This can probably be folded into tc_fix_data, below.
100 @@ Alpha also uses it, but only to disable certain relocation
101 processing. */
102 bit_fixS *fx_bit_fixP;
103
252b5132 104 bfd_reloc_code_real_type fx_r_type;
252b5132
RH
105
106 /* This field is sort of misnamed. It appears to be a sort of random
107 scratch field, for use by the back ends. The main gas code doesn't
108 do anything but initialize it to zero. The use of it does need to
109 be coordinated between the cpu and format files, though. E.g., some
110 coff targets pass the `addend' field from the cpu file via this
111 field. I don't know why the `fx_offset' field above can't be used
112 for that; investigate later and document. KR */
113 valueT fx_addnumber;
114
115 /* The location of the instruction which created the reloc, used
116 in error messages. */
117 char *fx_file;
118 unsigned fx_line;
119
120#ifdef USING_CGEN
121 struct {
122 /* CGEN_INSN entry for this instruction. */
123 const struct cgen_insn *insn;
124 /* Target specific data, usually reloc number. */
125 int opinfo;
280d71bf
DB
126 /* Which ifield this fixup applies to. */
127 struct cgen_maybe_multi_ifield * field;
128 /* is this field is the MSB field in a set? */
129 int msb_field_p;
252b5132
RH
130 } fx_cgen;
131#endif
132
133#ifdef TC_FIX_TYPE
134 /* Location where a backend can attach additional data
135 needed to perform fixups. */
136 TC_FIX_TYPE tc_fix_data;
137#endif
138};
139
140typedef struct fix fixS;
141
05e9452c
AM
142struct reloc_list
143{
144 struct reloc_list *next;
145 union
146 {
147 struct
148 {
149 symbolS *offset_sym;
150 reloc_howto_type *howto;
151 symbolS *sym;
152 bfd_vma addend;
153 } a;
154 struct
155 {
156 asection *sec;
157 asymbol *s;
158 arelent r;
159 } b;
160 } u;
161 char *file;
162 unsigned int line;
163};
164
e46d99eb 165extern int finalize_syms;
a161fe53 166extern symbolS *abs_section_sym;
26346241 167extern addressT dot_value;
8e723a10 168extern fragS *dot_frag;
05e9452c 169extern struct reloc_list* reloc_list;
252b5132 170
d7342424
KH
171extern void append (char **charPP, char *fromP, unsigned long length);
172extern void record_alignment (segT seg, int align);
173extern int get_recorded_alignment (segT seg);
174extern void subsegs_finish (void);
175extern void write_object_file (void);
176extern long relax_frag (segT, fragS *, long);
32638454 177extern int relax_segment (struct frag *, segT, int);
d7342424
KH
178extern void number_to_chars_littleendian (char *, valueT, int);
179extern void number_to_chars_bigendian (char *, valueT, int);
252b5132 180extern fixS *fix_new
d7342424
KH
181 (fragS * frag, int where, int size, symbolS * add_symbol,
182 offsetT offset, int pcrel, bfd_reloc_code_real_type r_type);
c865e45b
RS
183extern fixS *fix_at_start
184 (fragS * frag, int size, symbolS * add_symbol,
185 offsetT offset, int pcrel, bfd_reloc_code_real_type r_type);
252b5132 186extern fixS *fix_new_exp
d7342424
KH
187 (fragS * frag, int where, int size, expressionS *exp, int pcrel,
188 bfd_reloc_code_real_type r_type);
d7342424 189extern void write_print_statistics (FILE *);
252b5132
RH
190
191#endif /* __write_h__ */
This page took 0.57659 seconds and 4 git commands to generate.