1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22: #ifndef LDEXP_H
23: #define LDEXP_H
24:
25:
26: typedef struct {
27: bfd_vma value;
28: char *str;
29: asection *section;
30: bfd_boolean valid_p;
31: } etree_value_type;
32:
33: typedef struct {
34: int node_code;
35: unsigned int lineno;
36: enum {
37: etree_binary,
38: etree_trinary,
39: etree_unary,
40: etree_name,
41: etree_assign,
42: etree_provide,
43: etree_provided,
44: etree_value,
45: etree_assert,
46: etree_rel
47: } node_class;
48: } node_type;
49:
50: typedef union etree_union {
51: node_type type;
52: struct {
53: node_type type;
54: union etree_union *lhs;
55: union etree_union *rhs;
56: } binary;
57: struct {
58: node_type type;
59: union etree_union *cond;
60: union etree_union *lhs;
61: union etree_union *rhs;
62: } trinary;
63: struct {
64: node_type type;
65: const char *dst;
66: union etree_union *src;
67: bfd_boolean hidden;
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;
93:
94: typedef enum {
95: lang_first_phase_enum,
96: lang_mark_phase_enum,
97: lang_allocating_phase_enum,
98: lang_final_phase_enum
99: } lang_phase_type;
100:
101: struct ldexp_control {
102:
103: lang_phase_type phase;
104:
105:
106: bfd_boolean assigning_to_dot;
107:
108:
109: etree_value_type result;
110: bfd_vma dot;
111:
112:
113: bfd_vma *dotp;
114: asection *section;
115:
116:
117: struct {
118: enum {
119: exp_dataseg_none,
120: exp_dataseg_align_seen,
121: exp_dataseg_relro_seen,
122: exp_dataseg_end_seen,
123: exp_dataseg_relro_adjust,
124: exp_dataseg_adjust
125: } phase;
126:
127: bfd_vma base, min_base, relro_end, end, pagesize, maxpagesize;
128: } dataseg;
129: };
130:
131: extern struct ldexp_control expld;
132:
133:
134: typedef struct segment_struct {
135:
136: struct segment_struct *next;
137:
138: const char *name;
139:
140: bfd_vma value;
141:
142:
143: bfd_boolean used;
144: } segment_type;
145:
146:
147: extern segment_type *segments;
148:
149: typedef struct _fill_type fill_type;
150:
151: etree_type *exp_intop
152: (bfd_vma);
153: etree_type *exp_bigintop
154: (bfd_vma, char *);
155: etree_type *exp_relop
156: (asection *, bfd_vma);
157: void exp_fold_tree
158: (etree_type *, asection *, bfd_vma *);
159: etree_type *exp_binop
160: (int, etree_type *, etree_type *);
161: etree_type *exp_trinop
162: (int,etree_type *, etree_type *, etree_type *);
163: etree_type *exp_unop
164: (int, etree_type *);
165: etree_type *exp_nameop
166: (int, const char *);
167: etree_type *exp_assop
168: (int, const char *, etree_type *);
169: etree_type *exp_provide
170: (const char *, etree_type *, bfd_boolean);
171: etree_type *exp_assert
172: (etree_type *, const char *);
173: void exp_print_tree
174: (etree_type *);
175: bfd_vma exp_get_vma
176: (etree_type *, bfd_vma, char *);
177: int exp_get_value_int
178: (etree_type *, int, char *);
179: fill_type *exp_get_fill
180: (etree_type *, fill_type *, char *);
181: bfd_vma exp_get_abs_int
182: (etree_type *, int, char *);
183:
184: #endif