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