]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gas/write.h
2007-02-05 Dave Brolley <brolley@redhat.com>
[thirdparty/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
10 the Free Software Foundation; either version 2, or (at your option)
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
26#ifndef TC_I960
27#ifdef hpux
28#define EXEC_MACHINE_TYPE HP9000S200_ID
29#endif
30#endif /* TC_I960 */
31
252b5132
RH
32/* This is the name of a fake symbol which will never appear in the
33 assembler output. S_IS_LOCAL detects it because of the \001. */
7ff0565e 34#ifndef FAKE_LABEL_NAME
252b5132 35#define FAKE_LABEL_NAME "L0\001"
7ff0565e 36#endif
252b5132
RH
37
38#include "bit_fix.h"
39
40/*
41 * FixSs may be built up in any order.
42 */
43
44struct fix
45{
46 /* These small fields are grouped together for compactness of
47 this structure, and efficiency of access on some architectures. */
48
252b5132
RH
49 /* Is this a pc-relative relocation? */
50 unsigned fx_pcrel : 1;
51
252b5132 52 /* Is this value an immediate displacement? */
20ee54e8 53 /* Only used on ns32k; merge it into TC_FIX_TYPE sometime. */
252b5132
RH
54 unsigned fx_im_disp : 2;
55
20ee54e8 56 /* Some bits for the CPU specific code. */
252b5132 57 unsigned fx_tcbit : 1;
20ee54e8 58 unsigned fx_tcbit2 : 1;
252b5132
RH
59
60 /* Has this relocation already been applied? */
61 unsigned fx_done : 1;
62
63 /* Suppress overflow complaints on large addends. This is used
64 in the PowerPC ELF config to allow large addends on the
65 BFD_RELOC_{LO16,HI16,HI16_S} relocations.
66
67 @@ Can this be determined from BFD? */
68 unsigned fx_no_overflow : 1;
69
70 /* The value is signed when checking for overflow. */
71 unsigned fx_signed : 1;
72
20ee54e8
AM
73 /* pc-relative offset adjust (only used by m68k and m68hc11) */
74 char fx_pcrel_adjust;
75
76 /* How many bytes are involved? */
77 unsigned char fx_size;
78
252b5132
RH
79 /* Which frag does this fix apply to? */
80 fragS *fx_frag;
81
82 /* Where is the first byte to fix up? */
83 long fx_where;
84
a01b9fa4 85 /* NULL or Symbol whose value we add in. */
252b5132
RH
86 symbolS *fx_addsy;
87
a01b9fa4 88 /* NULL or Symbol whose value we subtract. */
252b5132
RH
89 symbolS *fx_subsy;
90
a01b9fa4 91 /* Absolute number we add in. */
252b5132
RH
92 valueT fx_offset;
93
26346241
AM
94 /* The value of dot when the fixup expression was parsed. */
95 addressT fx_dot_value;
96
252b5132
RH
97 /* Next fixS in linked list, or NULL. */
98 struct fix *fx_next;
99
100 /* If NULL, no bitfix's to do. */
101 /* Only i960-coff and ns32k use this, and i960-coff stores an
102 integer. This can probably be folded into tc_fix_data, below.
103 @@ Alpha also uses it, but only to disable certain relocation
104 processing. */
105 bit_fixS *fx_bit_fixP;
106
252b5132 107 bfd_reloc_code_real_type fx_r_type;
252b5132
RH
108
109 /* This field is sort of misnamed. It appears to be a sort of random
110 scratch field, for use by the back ends. The main gas code doesn't
111 do anything but initialize it to zero. The use of it does need to
112 be coordinated between the cpu and format files, though. E.g., some
113 coff targets pass the `addend' field from the cpu file via this
114 field. I don't know why the `fx_offset' field above can't be used
115 for that; investigate later and document. KR */
116 valueT fx_addnumber;
117
118 /* The location of the instruction which created the reloc, used
119 in error messages. */
120 char *fx_file;
121 unsigned fx_line;
122
123#ifdef USING_CGEN
124 struct {
125 /* CGEN_INSN entry for this instruction. */
126 const struct cgen_insn *insn;
127 /* Target specific data, usually reloc number. */
128 int opinfo;
129 } fx_cgen;
130#endif
131
132#ifdef TC_FIX_TYPE
133 /* Location where a backend can attach additional data
134 needed to perform fixups. */
135 TC_FIX_TYPE tc_fix_data;
136#endif
137};
138
139typedef struct fix fixS;
140
e46d99eb 141extern int finalize_syms;
a161fe53 142extern symbolS *abs_section_sym;
26346241 143extern addressT dot_value;
252b5132
RH
144extern long string_byte_count;
145extern int section_alignment[];
146
d7342424
KH
147extern void append (char **charPP, char *fromP, unsigned long length);
148extern void record_alignment (segT seg, int align);
149extern int get_recorded_alignment (segT seg);
150extern void subsegs_finish (void);
151extern void write_object_file (void);
152extern long relax_frag (segT, fragS *, long);
32638454 153extern int relax_segment (struct frag *, segT, int);
d7342424
KH
154extern void number_to_chars_littleendian (char *, valueT, int);
155extern void number_to_chars_bigendian (char *, valueT, int);
252b5132 156extern fixS *fix_new
d7342424
KH
157 (fragS * frag, int where, int size, symbolS * add_symbol,
158 offsetT offset, int pcrel, bfd_reloc_code_real_type r_type);
252b5132 159extern fixS *fix_new_exp
d7342424
KH
160 (fragS * frag, int where, int size, expressionS *exp, int pcrel,
161 bfd_reloc_code_real_type r_type);
d7342424 162extern void write_print_statistics (FILE *);
252b5132
RH
163
164#endif /* __write_h__ */