1#ifndef _FIXES_H_
2#define _FIXES_H_
3/* fixes.h (was write.h in the original GAS)
4   Copyright (C) 1987 Free Software Foundation, Inc.
5
6This file is part of GAS, the GNU Assembler.
7
8GAS is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 1, or (at your option)
11any later version.
12
13GAS is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with GAS; see the file COPYING.  If not, write to
20the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
21
22/*
23 * For machines with machine dependent relocation types (encoded in the r_type
24 * field of a relocation_info struct) they use NO_RELOC in assembling
25 * instructions which they want to indicate have no relocation.
26 */
27#define NO_RELOC        0x10 /* above the range of r_type:4 */
28
29/*
30 * FixSs may be built up in any order.
31 */
32struct fix {
33    fragS	*fx_frag;	/* which frag? */
34    int32_t	 fx_where;	/* where is the 1st byte to fix up? */
35    symbolS	*fx_addsy;	/* NULL or Symbol whose value we add in */
36    symbolS	*fx_subsy;	/* NULL or Symbol whose value we subtract */
37#if defined(I386) && defined(ARCH64)
38    symbolS *fx_localsy;	/* NULL or pseudo-symbol for this fixup */
39#endif
40    signed_expr_t
41		 fx_offset;	/* absolute number we add in */
42    struct fix	*fx_next;	/* NULL or -> next fixS */
43    char	 fx_size;	/* how many bytes are involved? */
44    char	 fx_pcrel;	/* TRUE: pc-relative. */
45    char	 fx_pcrel_reloc;/* force a pc-relative relocatation entry */
46    char	 fx_r_type;	/* relocation type */
47    int32_t	 fx_value;	/* the relocated value placed in the frag */
48    char	*file;		/* the file name this came from for errors */
49    unsigned int line;		/* the line number this came from for errors */
50
51  /* FROM write.h line 82 */
52  /* Has this relocation already been applied?  */
53  unsigned fx_done : 1,
54
55  /* Non-zero if we have the special assembly time constant expression
56     of the difference of two symbols defined in the same section then divided
57     by exactly 2. */
58           fx_sectdiff_divide_by_two : 1;
59
60  /* FROM write.h line 133 */
61  /* This field is sort of misnamed.  It appears to be a sort of random
62     scratch field, for use by the back ends.  The main gas code doesn't
63     do anything but initialize it to zero.  The use of it does need to
64     be coordinated between the cpu and format files, though.  E.g., some
65     coff targets pass the `addend' field from the cpu file via this
66     field.  I don't know why the `fx_offset' field above can't be used
67     for that; investigate later and document. KR  */
68  valueT fx_addnumber;
69
70  /* FROM write.h line 142 */
71  /* The location of the instruction which created the reloc, used
72     in error messages.  */
73#ifdef NOTYET
74  char *fx_file;
75  unsigned fx_line;
76#else
77  #define fx_file file
78  #define fx_line line
79  void *tc_fix_data;
80#endif
81};
82typedef struct fix fixS;
83
84extern fixS *fix_new(
85	fragS	*frag,		/* which frag? */
86	int	where,		/* where in that frag? */
87	int	size,		/* 1, 2 or 4 bytes */
88	symbolS *add_symbol,	/* X_add_symbol */
89	symbolS *sub_symbol,	/* X_subtract_symbol */
90	signed_target_addr_t
91	offset,		/* X_add_number */
92	int	pcrel,		/* TRUE if PC-relative */
93	int	pcrel_reloc,	/* TRUE if must have relocation entry */
94	int	r_type);	/* relocation type */
95
96/* FROM write.h line 210 */
97#include "expr.h"
98extern fixS *fix_new_exp
99  (fragS * frag, int where, int size, expressionS *exp, int pcrel,
100   int pcrel_reloc, int r_type);
101
102#endif /* _FIXES_H_ */
103