* ld-elf/header.d: Allow arbitrary lines between "Program Header"
[binutils.git] / gas / write.h
blob1f9b72dbf265d3abbabb2d7b2a162c6cabc42363
1 /* write.h
2 Copyright 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001,
3 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
5 This file is part of GAS, the GNU Assembler.
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.
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.
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, 51 Franklin Street - Fifth Floor, Boston, MA
20 02110-1301, USA. */
22 #ifndef __write_h__
23 #define __write_h__
25 #ifndef TC_I960
26 #ifdef hpux
27 #define EXEC_MACHINE_TYPE HP9000S200_ID
28 #endif
29 #endif /* TC_I960 */
31 /* This is the name of a fake symbol which will never appear in the
32 assembler output. S_IS_LOCAL detects it because of the \001. */
33 #ifndef FAKE_LABEL_NAME
34 #define FAKE_LABEL_NAME "L0\001"
35 #endif
37 #include "bit_fix.h"
40 * FixSs may be built up in any order.
43 struct fix
45 /* These small fields are grouped together for compactness of
46 this structure, and efficiency of access on some architectures. */
48 /* pc-relative offset adjust (only used by m68k) */
49 char fx_pcrel_adjust;
51 /* How many bytes are involved? */
52 unsigned char fx_size;
54 /* Is this a pc-relative relocation? */
55 unsigned fx_pcrel : 1;
57 /* Is this a relocation to a procedure linkage table entry? If so,
58 some of the reductions we try to apply are invalid. A better way
59 might be to represent PLT entries with different kinds of
60 symbols, and use normal relocations (with undefined symbols);
61 look into it for version 2.6. */
62 unsigned fx_plt : 1;
64 /* Is this value an immediate displacement? */
65 /* Only used on i960 and ns32k; merge it into TC_FIX_TYPE sometime. */
66 unsigned fx_im_disp : 2;
68 /* A bit for the CPU specific code.
69 This probably can be folded into tc_fix_data, below. */
70 unsigned fx_tcbit : 1;
72 /* Has this relocation already been applied? */
73 unsigned fx_done : 1;
75 /* Suppress overflow complaints on large addends. This is used
76 in the PowerPC ELF config to allow large addends on the
77 BFD_RELOC_{LO16,HI16,HI16_S} relocations.
79 @@ Can this be determined from BFD? */
80 unsigned fx_no_overflow : 1;
82 /* The value is signed when checking for overflow. */
83 unsigned fx_signed : 1;
85 /* Which frag does this fix apply to? */
86 fragS *fx_frag;
88 /* Where is the first byte to fix up? */
89 long fx_where;
91 /* NULL or Symbol whose value we add in. */
92 symbolS *fx_addsy;
94 /* NULL or Symbol whose value we subtract. */
95 symbolS *fx_subsy;
97 /* Absolute number we add in. */
98 valueT fx_offset;
100 /* The value of dot when the fixup expression was parsed. */
101 addressT fx_dot_value;
103 /* Next fixS in linked list, or NULL. */
104 struct fix *fx_next;
106 /* If NULL, no bitfix's to do. */
107 /* Only i960-coff and ns32k use this, and i960-coff stores an
108 integer. This can probably be folded into tc_fix_data, below.
109 @@ Alpha also uses it, but only to disable certain relocation
110 processing. */
111 bit_fixS *fx_bit_fixP;
113 bfd_reloc_code_real_type fx_r_type;
115 /* This field is sort of misnamed. It appears to be a sort of random
116 scratch field, for use by the back ends. The main gas code doesn't
117 do anything but initialize it to zero. The use of it does need to
118 be coordinated between the cpu and format files, though. E.g., some
119 coff targets pass the `addend' field from the cpu file via this
120 field. I don't know why the `fx_offset' field above can't be used
121 for that; investigate later and document. KR */
122 valueT fx_addnumber;
124 /* The location of the instruction which created the reloc, used
125 in error messages. */
126 char *fx_file;
127 unsigned fx_line;
129 #ifdef USING_CGEN
130 struct {
131 /* CGEN_INSN entry for this instruction. */
132 const struct cgen_insn *insn;
133 /* Target specific data, usually reloc number. */
134 int opinfo;
135 } fx_cgen;
136 #endif
138 #ifdef TC_FIX_TYPE
139 /* Location where a backend can attach additional data
140 needed to perform fixups. */
141 TC_FIX_TYPE tc_fix_data;
142 #endif
145 typedef struct fix fixS;
147 extern int finalize_syms;
148 extern symbolS *abs_section_sym;
149 extern addressT dot_value;
150 extern long string_byte_count;
151 extern int section_alignment[];
153 extern void append (char **charPP, char *fromP, unsigned long length);
154 extern void record_alignment (segT seg, int align);
155 extern int get_recorded_alignment (segT seg);
156 extern void subsegs_finish (void);
157 extern void write_object_file (void);
158 extern long relax_frag (segT, fragS *, long);
159 extern int relax_segment (struct frag *, segT, int);
160 extern void number_to_chars_littleendian (char *, valueT, int);
161 extern void number_to_chars_bigendian (char *, valueT, int);
162 extern fixS *fix_new
163 (fragS * frag, int where, int size, symbolS * add_symbol,
164 offsetT offset, int pcrel, bfd_reloc_code_real_type r_type);
165 extern fixS *fix_new_exp
166 (fragS * frag, int where, int size, expressionS *exp, int pcrel,
167 bfd_reloc_code_real_type r_type);
168 extern void write_print_statistics (FILE *);
170 #endif /* __write_h__ */