2001-01-03 Philip Blundell <pb@futuretv.com>
[binutils.git] / ld / ldexp.h
blob4c507bd4c3ace8630bb6969b765611915e1bb054
1 /* ldexp.h -
2 Copyright 1991, 92, 93, 94, 95, 98, 2000
3 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 struct lang_output_section_statement_struct *section;
29 boolean valid_p;
30 } etree_value_type;
32 typedef struct {
33 int node_code;
34 enum { etree_binary,
35 etree_trinary,
36 etree_unary,
37 etree_name,
38 etree_assign,
39 etree_provide,
40 etree_undef,
41 etree_unspec,
42 etree_value,
43 etree_assert,
44 etree_rel } node_class;
45 } node_type;
47 typedef union etree_union {
48 node_type type;
49 struct {
50 node_type type;
51 union etree_union *lhs;
52 union etree_union *rhs;
53 } binary;
54 struct {
55 node_type type;
56 union etree_union *cond;
57 union etree_union *lhs;
58 union etree_union *rhs;
59 } trinary;
60 struct {
61 node_type type;
62 CONST char *dst;
63 union etree_union *src;
64 } assign;
66 struct {
67 node_type type;
68 union etree_union *child;
69 } unary;
70 struct {
71 node_type type;
72 CONST char *name;
73 } name;
74 struct {
75 node_type type;
76 bfd_vma value;
77 } value;
78 struct {
79 node_type type;
80 asection *section;
81 bfd_vma value;
82 } rel;
83 struct {
84 node_type type;
85 union etree_union *child;
86 const char *message;
87 } assert_s;
88 } etree_type;
90 etree_type *exp_intop PARAMS ((bfd_vma));
91 etree_type *exp_relop PARAMS ((asection *, bfd_vma));
92 etree_value_type invalid PARAMS ((void));
93 etree_value_type exp_fold_tree PARAMS ((etree_type *, struct
94 lang_output_section_statement_struct *,
95 lang_phase_type,
96 bfd_vma, bfd_vma *));
97 etree_type *exp_binop PARAMS ((int, etree_type *, etree_type *));
98 etree_type *exp_trinop PARAMS ((int,etree_type *, etree_type *, etree_type *));
99 etree_type *exp_unop PARAMS ((int, etree_type *));
100 etree_type *exp_nameop PARAMS ((int, CONST char *));
101 etree_type *exp_assop PARAMS ((int, CONST char *, etree_type *));
102 etree_type *exp_provide PARAMS ((const char *, etree_type *));
103 etree_type *exp_assert PARAMS ((etree_type *, const char *));
104 void exp_print_tree PARAMS ((etree_type *));
105 bfd_vma exp_get_vma PARAMS ((etree_type *, bfd_vma, char *, lang_phase_type));
106 int exp_get_value_int PARAMS ((etree_type *, int, char *, lang_phase_type));
107 bfd_vma exp_get_abs_int PARAMS ((etree_type *, int, char *, lang_phase_type));
109 #endif