00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef LDEXP_H
00027 #define LDEXP_H
00028
00029
00030 typedef struct {
00031 bfd_vma value;
00032 char *str;
00033 struct lang_output_section_statement_struct *section;
00034 bfd_boolean valid_p;
00035 } etree_value_type;
00036
00037 typedef struct {
00038 int node_code;
00039 enum {
00040 etree_binary,
00041 etree_trinary,
00042 etree_unary,
00043 etree_name,
00044 etree_assign,
00045 etree_provide,
00046 etree_provided,
00047 etree_undef,
00048 etree_unspec,
00049 etree_value,
00050 etree_assert,
00051 etree_rel
00052 } node_class;
00053 } node_type;
00054
00055 typedef union etree_union {
00056 node_type type;
00057 struct {
00058 node_type type;
00059 union etree_union *lhs;
00060 union etree_union *rhs;
00061 } binary;
00062 struct {
00063 node_type type;
00064 union etree_union *cond;
00065 union etree_union *lhs;
00066 union etree_union *rhs;
00067 } trinary;
00068 struct {
00069 node_type type;
00070 const char *dst;
00071 union etree_union *src;
00072 } assign;
00073 struct {
00074 node_type type;
00075 union etree_union *child;
00076 } unary;
00077 struct {
00078 node_type type;
00079 const char *name;
00080 } name;
00081 struct {
00082 node_type type;
00083 bfd_vma value;
00084 char *str;
00085 } value;
00086 struct {
00087 node_type type;
00088 asection *section;
00089 bfd_vma value;
00090 } rel;
00091 struct {
00092 node_type type;
00093 union etree_union *child;
00094 const char *message;
00095 } assert_s;
00096 } etree_type;
00097
00098 extern struct exp_data_seg {
00099 enum {
00100 exp_dataseg_none,
00101 exp_dataseg_align_seen,
00102 exp_dataseg_relro_seen,
00103 exp_dataseg_end_seen,
00104 exp_dataseg_relro_adjust,
00105 exp_dataseg_adjust
00106 } phase;
00107 bfd_vma base, min_base, relro_end, end, pagesize, maxpagesize;
00108 } exp_data_seg;
00109
00110
00111 typedef struct segment_struct {
00112
00113 struct segment_struct *next;
00114
00115 const char *name;
00116
00117 bfd_vma value;
00118
00119
00120 bfd_boolean used;
00121 } segment_type;
00122
00123
00124 extern segment_type *segments;
00125
00126 typedef struct _fill_type fill_type;
00127
00128 etree_type *exp_intop
00129 (bfd_vma);
00130 etree_type *exp_bigintop
00131 (bfd_vma, char *);
00132 etree_type *exp_relop
00133 (asection *, bfd_vma);
00134 etree_value_type invalid
00135 (void);
00136 etree_value_type exp_fold_tree
00137 (etree_type *, struct lang_output_section_statement_struct *,
00138 lang_phase_type, bfd_vma, bfd_vma *);
00139 etree_type *exp_binop
00140 (int, etree_type *, etree_type *);
00141 etree_type *exp_trinop
00142 (int,etree_type *, etree_type *, etree_type *);
00143 etree_type *exp_unop
00144 (int, etree_type *);
00145 etree_type *exp_nameop
00146 (int, const char *);
00147 etree_type *exp_assop
00148 (int, const char *, etree_type *);
00149 etree_type *exp_provide
00150 (const char *, etree_type *);
00151 etree_type *exp_assert
00152 (etree_type *, const char *);
00153 void exp_print_tree
00154 (etree_type *);
00155 bfd_vma exp_get_vma
00156 (etree_type *, bfd_vma, char *, lang_phase_type);
00157 int exp_get_value_int
00158 (etree_type *, int, char *, lang_phase_type);
00159 fill_type *exp_get_fill
00160 (etree_type *, fill_type *, char *, lang_phase_type);
00161 bfd_vma exp_get_abs_int
00162 (etree_type *, int, char *, lang_phase_type);
00163
00164 #endif