| 1 | /* ldexp.h - | 
|---|
| 2 | Copyright 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001 | 
|---|
| 3 | Free Software Foundation, Inc. | 
|---|
| 4 |  | 
|---|
| 5 | This file is part of GLD, the Gnu Linker. | 
|---|
| 6 |  | 
|---|
| 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. | 
|---|
| 11 |  | 
|---|
| 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. | 
|---|
| 16 |  | 
|---|
| 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.  */ | 
|---|
| 21 |  | 
|---|
| 22 | #ifndef LDEXP_H | 
|---|
| 23 | #define LDEXP_H | 
|---|
| 24 |  | 
|---|
| 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; | 
|---|
| 31 |  | 
|---|
| 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_provided, | 
|---|
| 41 | etree_undef, | 
|---|
| 42 | etree_unspec, | 
|---|
| 43 | etree_value, | 
|---|
| 44 | etree_assert, | 
|---|
| 45 | etree_rel } node_class; | 
|---|
| 46 | } node_type; | 
|---|
| 47 |  | 
|---|
| 48 | typedef union etree_union { | 
|---|
| 49 | node_type type; | 
|---|
| 50 | struct { | 
|---|
| 51 | node_type type; | 
|---|
| 52 | union etree_union *lhs; | 
|---|
| 53 | union etree_union *rhs; | 
|---|
| 54 | } binary; | 
|---|
| 55 | struct { | 
|---|
| 56 | node_type type; | 
|---|
| 57 | union etree_union *cond; | 
|---|
| 58 | union etree_union *lhs; | 
|---|
| 59 | union etree_union *rhs; | 
|---|
| 60 | } trinary; | 
|---|
| 61 | struct { | 
|---|
| 62 | node_type type; | 
|---|
| 63 | CONST char *dst; | 
|---|
| 64 | union etree_union *src; | 
|---|
| 65 | } assign; | 
|---|
| 66 |  | 
|---|
| 67 | struct { | 
|---|
| 68 | node_type type; | 
|---|
| 69 | union etree_union *child; | 
|---|
| 70 | } unary; | 
|---|
| 71 | struct { | 
|---|
| 72 | node_type type; | 
|---|
| 73 | CONST char *name; | 
|---|
| 74 | } name; | 
|---|
| 75 | struct { | 
|---|
| 76 | node_type type; | 
|---|
| 77 | bfd_vma value; | 
|---|
| 78 | } value; | 
|---|
| 79 | struct { | 
|---|
| 80 | node_type type; | 
|---|
| 81 | asection *section; | 
|---|
| 82 | bfd_vma value; | 
|---|
| 83 | } rel; | 
|---|
| 84 | struct { | 
|---|
| 85 | node_type type; | 
|---|
| 86 | union etree_union *child; | 
|---|
| 87 | const char *message; | 
|---|
| 88 | } assert_s; | 
|---|
| 89 | } etree_type; | 
|---|
| 90 |  | 
|---|
| 91 | etree_type *exp_intop PARAMS ((bfd_vma)); | 
|---|
| 92 | etree_type *exp_relop PARAMS ((asection *, bfd_vma)); | 
|---|
| 93 | etree_value_type invalid PARAMS ((void)); | 
|---|
| 94 | etree_value_type exp_fold_tree PARAMS ((etree_type *, struct | 
|---|
| 95 | lang_output_section_statement_struct *, | 
|---|
| 96 | lang_phase_type, | 
|---|
| 97 | bfd_vma, bfd_vma *)); | 
|---|
| 98 | etree_type *exp_binop PARAMS ((int, etree_type *, etree_type *)); | 
|---|
| 99 | etree_type *exp_trinop PARAMS ((int,etree_type *, etree_type *, etree_type *)); | 
|---|
| 100 | etree_type *exp_unop PARAMS ((int, etree_type *)); | 
|---|
| 101 | etree_type *exp_nameop PARAMS ((int, CONST char *)); | 
|---|
| 102 | etree_type *exp_assop PARAMS ((int, CONST char *, etree_type *)); | 
|---|
| 103 | etree_type *exp_provide PARAMS ((const char *, etree_type *)); | 
|---|
| 104 | etree_type *exp_assert PARAMS ((etree_type *, const char *)); | 
|---|
| 105 | void exp_print_tree PARAMS ((etree_type *)); | 
|---|
| 106 | bfd_vma exp_get_vma PARAMS ((etree_type *, bfd_vma, char *, lang_phase_type)); | 
|---|
| 107 | int exp_get_value_int PARAMS ((etree_type *, int, char *, lang_phase_type)); | 
|---|
| 108 | bfd_vma exp_get_abs_int PARAMS ((etree_type *, int, char *, lang_phase_type)); | 
|---|
| 109 |  | 
|---|
| 110 | #endif | 
|---|