* elfcode.h (elf_object_p): Fail if e_shoff != 0, e_shnum == 0 and
[deliverable/binutils-gdb.git] / ld / ldexp.h
CommitLineData
252b5132 1/* ldexp.h -
e5caa5e0
AM
2 Copyright 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002,
3 2003, 2004 Free Software Foundation, Inc.
252b5132
RH
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
75be928b
NC
19 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
20 02110-1301, USA. */
252b5132
RH
21
22#ifndef LDEXP_H
23#define LDEXP_H
24
25/* The result of an expression tree */
89cdebba 26typedef struct {
252b5132 27 bfd_vma value;
2c382fb6 28 char *str;
252b5132 29 struct lang_output_section_statement_struct *section;
b34976b6 30 bfd_boolean valid_p;
252b5132
RH
31} etree_value_type;
32
89cdebba 33typedef struct {
252b5132 34 int node_code;
b34976b6
AM
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;
252b5132
RH
49} node_type;
50
89cdebba 51typedef union etree_union {
252b5132
RH
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;
2c382fb6 66 const char *dst;
252b5132
RH
67 union etree_union *src;
68 } assign;
252b5132
RH
69 struct {
70 node_type type;
89cdebba 71 union etree_union *child;
252b5132
RH
72 } unary;
73 struct {
74 node_type type;
2c382fb6 75 const char *name;
252b5132
RH
76 } name;
77 struct {
78 node_type type;
79 bfd_vma value;
2c382fb6 80 char *str;
252b5132
RH
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;
2d20f7bf
JJ
93
94extern struct exp_data_seg {
95 enum {
96 exp_dataseg_none,
97 exp_dataseg_align_seen,
8c37241b 98 exp_dataseg_relro_seen,
2d20f7bf 99 exp_dataseg_end_seen,
8c37241b 100 exp_dataseg_relro_adjust,
2d20f7bf
JJ
101 exp_dataseg_adjust
102 } phase;
e3070fef 103 bfd_vma base, min_base, relro_end, end, pagesize, maxpagesize;
2d20f7bf 104} exp_data_seg;
252b5132 105
ba916c8a
MM
106/* A maps from a segment name to a base address. */
107typedef 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;
118
119/* The segments specified by the user on the command-line. */
120extern segment_type *segments;
121
2c382fb6
AM
122typedef struct _fill_type fill_type;
123
b34976b6 124etree_type *exp_intop
1579bae1 125 (bfd_vma);
b34976b6 126etree_type *exp_bigintop
1579bae1 127 (bfd_vma, char *);
b34976b6 128etree_type *exp_relop
1579bae1 129 (asection *, bfd_vma);
b34976b6 130etree_value_type invalid
1579bae1 131 (void);
b34976b6 132etree_value_type exp_fold_tree
1579bae1
AM
133 (etree_type *, struct lang_output_section_statement_struct *,
134 lang_phase_type, bfd_vma, bfd_vma *);
b34976b6 135etree_type *exp_binop
1579bae1 136 (int, etree_type *, etree_type *);
b34976b6 137etree_type *exp_trinop
1579bae1 138 (int,etree_type *, etree_type *, etree_type *);
b34976b6 139etree_type *exp_unop
1579bae1 140 (int, etree_type *);
b34976b6 141etree_type *exp_nameop
1579bae1 142 (int, const char *);
b34976b6 143etree_type *exp_assop
1579bae1 144 (int, const char *, etree_type *);
b34976b6 145etree_type *exp_provide
1579bae1 146 (const char *, etree_type *);
b34976b6 147etree_type *exp_assert
1579bae1 148 (etree_type *, const char *);
b34976b6 149void exp_print_tree
1579bae1 150 (etree_type *);
b34976b6 151bfd_vma exp_get_vma
1579bae1 152 (etree_type *, bfd_vma, char *, lang_phase_type);
b34976b6 153int exp_get_value_int
1579bae1 154 (etree_type *, int, char *, lang_phase_type);
b34976b6 155fill_type *exp_get_fill
1579bae1 156 (etree_type *, fill_type *, char *, lang_phase_type);
b34976b6 157bfd_vma exp_get_abs_int
1579bae1 158 (etree_type *, int, char *, lang_phase_type);
75ff4589
L
159void exp_mark_used_section
160 (etree_type *, struct lang_output_section_statement_struct *);
252b5132
RH
161
162#endif
This page took 0.259456 seconds and 4 git commands to generate.