Fri Jun 5 23:27:04 1998 Alan Modra <alan@spri.levels.unisa.edu.au>
[deliverable/binutils-gdb.git] / gas / write.h
CommitLineData
3340f7e5 1/* write.h
66a6a381 2 Copyright (C) 1987, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
6efd877d 3
a39116f1 4 This file is part of GAS, the GNU Assembler.
6efd877d 5
a39116f1
RP
6 GAS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
6efd877d 10
a39116f1
RP
11 GAS is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
6efd877d 15
a39116f1 16 You should have received a copy of the GNU General Public License
66a6a381
ILT
17 along with GAS; see the file COPYING. If not, write to the Free
18 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19 02111-1307, USA. */
fecd2382
RP
20
21#ifndef TC_I960
22#ifdef hpux
23#define EXEC_MACHINE_TYPE HP9000S200_ID
24#endif
25#endif /* TC_I960 */
26
66a6a381
ILT
27#ifndef BFD_ASSEMBLER
28
fecd2382 29#ifndef LOCAL_LABEL
fecd2382 30#define LOCAL_LABEL(name) (name [0] == 'L' )
66a6a381 31#endif
fecd2382 32
66a6a381
ILT
33#define S_LOCAL_NAME(s) (LOCAL_LABEL (S_GET_NAME (s)))
34
35#endif /* ! BFD_ASSEMBLER */
36
37/* This is the name of a fake symbol which will never appear in the
38 assembler output. S_IS_LOCAL detects it because of the \001. */
39#define FAKE_LABEL_NAME "L0\001"
fecd2382 40
c593cf41
SC
41#include "bit_fix.h"
42
fecd2382
RP
43/*
44 * FixSs may be built up in any order.
45 */
46
6efd877d 47struct fix
66a6a381
ILT
48{
49 /* These small fields are grouped together for compactness of
50 this structure, and efficiency of access on some architectures. */
51
52 /* pc-relative offset adjust */
53 char fx_pcrel_adjust;
54
55 /* How many bytes are involved? */
56 unsigned char fx_size;
57
58 /* Is this a pc-relative relocation? */
59 unsigned fx_pcrel : 1;
60
61 /* Is this a relocation to a procedure linkage table entry? If so,
62 some of the reductions we try to apply are invalid. A better way
63 might be to represent PLT entries with different kinds of
64 symbols, and use normal relocations (with undefined symbols);
65 look into it for version 2.6. */
66 unsigned fx_plt : 1;
67
68 /* Is this value an immediate displacement? */
69 /* Only used on i960 and ns32k; merge it into TC_FIX_TYPE sometime. */
70 unsigned fx_im_disp : 2;
71
72 /* A bit for the CPU specific code.
73 This probably can be folded into tc_fix_data, below. */
74 unsigned fx_tcbit : 1;
75
76 /* Has this relocation already been applied? */
77 unsigned fx_done : 1;
78
79 /* Suppress overflow complaints on large addends. This is used
80 in the PowerPC ELF config to allow large addends on the
81 BFD_RELOC_{LO16,HI16,HI16_S} relocations.
82
83 @@ Can this be determined from BFD? */
84 unsigned fx_no_overflow : 1;
85
86 /* The value is signed when checking for overflow. */
87 unsigned fx_signed : 1;
88
89 /* Which frag does this fix apply to? */
90 fragS *fx_frag;
91
92 /* Where is the first byte to fix up? */
93 long fx_where;
94
95 /* NULL or Symbol whose value we add in. */
96 symbolS *fx_addsy;
97
98 /* NULL or Symbol whose value we subtract. */
99 symbolS *fx_subsy;
100
101 /* Absolute number we add in. */
102 valueT fx_offset;
103
104 /* Next fixS in linked list, or NULL. */
105 struct fix *fx_next;
106
107 /* If NULL, no bitfix's to do. */
108 /* Only i960-coff and ns32k use this, and i960-coff stores an
109 integer. This can probably be folded into tc_fix_data, below.
110 @@ Alpha also uses it, but only to disable certain relocation
111 processing. */
112 bit_fixS *fx_bit_fixP;
113
039d8f73 114#ifdef BFD_ASSEMBLER
66a6a381 115 bfd_reloc_code_real_type fx_r_type;
039d8f73
KR
116#else
117#ifdef NEED_FX_R_TYPE
66a6a381
ILT
118 /* Hack for machines where the type of reloc can't be
119 worked out by looking at how big it is. */
120 int fx_r_type;
c593cf41 121#endif
039d8f73
KR
122#endif
123
66a6a381
ILT
124 /* This field is sort of misnamed. It appears to be a sort of random
125 scratch field, for use by the back ends. The main gas code doesn't
126 do anything but initialize it to zero. The use of it does need to
127 be coordinated between the cpu and format files, though. E.g., some
128 coff targets pass the `addend' field from the cpu file via this
129 field. I don't know why the `fx_offset' field above can't be used
130 for that; investigate later and document. KR */
131 valueT fx_addnumber;
132
133 /* The location of the instruction which created the reloc, used
134 in error messages. */
135 char *fx_file;
136 unsigned fx_line;
137
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
143};
fecd2382 144
a39116f1 145typedef struct fix fixS;
fecd2382 146
039d8f73
KR
147#ifndef BFD_ASSEMBLER
148extern char *next_object_file_charP;
fecd2382 149
a39116f1 150#ifndef MANY_SEGMENTS
fecd2382
RP
151COMMON fixS *text_fix_root, *text_fix_tail; /* Chains fixSs. */
152COMMON fixS *data_fix_root, *data_fix_tail; /* Chains fixSs. */
6efd877d 153COMMON fixS *bss_fix_root, *bss_fix_tail; /* Chains fixSs. */
66a6a381
ILT
154extern struct frag *text_last_frag; /* Last frag in segment. */
155extern struct frag *data_last_frag; /* Last frag in segment. */
a39116f1 156#endif
fecd2382 157COMMON fixS **seg_fix_rootP, **seg_fix_tailP; /* -> one of above. */
039d8f73
KR
158#endif
159
fecd2382
RP
160extern long string_byte_count;
161extern int section_alignment[];
162
66a6a381
ILT
163extern bit_fixS *bit_fix_new
164 PARAMS ((int size, int offset, long base_type, long base_adj, long min,
165 long max, long add));
166extern void append PARAMS ((char **charPP, char *fromP, unsigned long length));
167extern void record_alignment PARAMS ((segT seg, int align));
168extern void subsegs_finish PARAMS ((void));
169extern void write_object_file PARAMS ((void));
170extern long relax_frag PARAMS ((fragS *, long));
171extern void relax_segment
172 PARAMS ((struct frag * seg_frag_root, segT seg_type));
173
174extern void number_to_chars_littleendian PARAMS ((char *, valueT, int));
175extern void number_to_chars_bigendian PARAMS ((char *, valueT, int));
039d8f73
KR
176
177#ifdef BFD_ASSEMBLER
66a6a381
ILT
178extern fixS *fix_new
179 PARAMS ((fragS * frag, int where, int size, symbolS * add_symbol,
180 offsetT offset, int pcrel, bfd_reloc_code_real_type r_type));
181extern fixS *fix_new_exp
182 PARAMS ((fragS * frag, int where, int size, expressionS *exp, int pcrel,
183 bfd_reloc_code_real_type r_type));
039d8f73 184#else
66a6a381
ILT
185extern fixS *fix_new
186 PARAMS ((fragS * frag, int where, int size, symbolS * add_symbol,
187 offsetT offset, int pcrel, int r_type));
188extern fixS *fix_new_exp
189 PARAMS ((fragS * frag, int where, int size, expressionS *exp, int pcrel,
190 int r_type));
039d8f73 191#endif
fecd2382 192
66a6a381
ILT
193extern void write_print_statistics PARAMS ((FILE *));
194
fecd2382 195/* end of write.h */
This page took 0.23519 seconds and 4 git commands to generate.