* gas/mips/elf-rel23.d, gas/mips/elf-rel23a.d: Accept little-endian.
[binutils.git] / ld / ldexp.h
blob59a5627508636d2926e74bd25580197bc437ea1a
1 /* ldexp.h -
2 Copyright 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002,
3 2003, 2004 Free Software Foundation, Inc.
5 This file is part of GLD, the Gnu Linker.
7 GLD 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 GLD 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 GLD; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA. */
22 #ifndef LDEXP_H
23 #define LDEXP_H
25 /* The result of an expression tree */
26 typedef struct {
27 bfd_vma value;
28 char *str;
29 struct lang_output_section_statement_struct *section;
30 bfd_boolean valid_p;
31 } etree_value_type;
33 typedef struct {
34 int node_code;
35 enum {
36 etree_binary,
37 etree_trinary,
38 etree_unary,
39 etree_name,
40 etree_assign,
41 etree_provide,
42 etree_provided,
43 etree_undef,
44 etree_unspec,
45 etree_value,
46 etree_assert,
47 etree_rel
48 } node_class;
49 } node_type;
51 typedef union etree_union {
52 node_type type;
53 struct {
54 node_type type;
55 union etree_union *lhs;
56 union etree_union *rhs;
57 } binary;
58 struct {
59 node_type type;
60 union etree_union *cond;
61 union etree_union *lhs;
62 union etree_union *rhs;
63 } trinary;
64 struct {
65 node_type type;
66 const char *dst;
67 union etree_union *src;
68 } assign;
69 struct {
70 node_type type;
71 union etree_union *child;
72 } unary;
73 struct {
74 node_type type;
75 const char *name;
76 } name;
77 struct {
78 node_type type;
79 bfd_vma value;
80 char *str;
81 } value;
82 struct {
83 node_type type;
84 asection *section;
85 bfd_vma value;
86 } rel;
87 struct {
88 node_type type;
89 union etree_union *child;
90 const char *message;
91 } assert_s;
92 } etree_type;
94 extern struct exp_data_seg {
95 enum {
96 exp_dataseg_none,
97 exp_dataseg_align_seen,
98 exp_dataseg_relro_seen,
99 exp_dataseg_end_seen,
100 exp_dataseg_relro_adjust,
101 exp_dataseg_adjust
102 } phase;
103 bfd_vma base, min_base, relro_end, end, pagesize, maxpagesize;
104 } exp_data_seg;
106 /* A maps from a segment name to a base address. */
107 typedef struct segment_struct {
108 /* The next segment in the linked list. */
109 struct segment_struct *next;
110 /* The name of the sgement. */
111 const char *name;
112 /* The base address for the segment. */
113 bfd_vma value;
114 /* True if a SEGMENT_START directive corresponding to this segment
115 has been seen. */
116 bfd_boolean used;
117 } segment_type;
119 /* The segments specified by the user on the command-line. */
120 extern segment_type *segments;
122 typedef struct _fill_type fill_type;
124 etree_type *exp_intop
125 (bfd_vma);
126 etree_type *exp_bigintop
127 (bfd_vma, char *);
128 etree_type *exp_relop
129 (asection *, bfd_vma);
130 etree_value_type invalid
131 (void);
132 etree_value_type exp_fold_tree
133 (etree_type *, struct lang_output_section_statement_struct *,
134 lang_phase_type, bfd_vma, bfd_vma *);
135 etree_type *exp_binop
136 (int, etree_type *, etree_type *);
137 etree_type *exp_trinop
138 (int,etree_type *, etree_type *, etree_type *);
139 etree_type *exp_unop
140 (int, etree_type *);
141 etree_type *exp_nameop
142 (int, const char *);
143 etree_type *exp_assop
144 (int, const char *, etree_type *);
145 etree_type *exp_provide
146 (const char *, etree_type *);
147 etree_type *exp_assert
148 (etree_type *, const char *);
149 void exp_print_tree
150 (etree_type *);
151 bfd_vma exp_get_vma
152 (etree_type *, bfd_vma, char *, lang_phase_type);
153 int exp_get_value_int
154 (etree_type *, int, char *, lang_phase_type);
155 fill_type *exp_get_fill
156 (etree_type *, fill_type *, char *, lang_phase_type);
157 bfd_vma exp_get_abs_int
158 (etree_type *, int, char *, lang_phase_type);
160 #endif