/* This module handles expression trees.
-Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
-Written by Steve Chamberlain of Cygnus Support (sac@cygnus.com).
+ Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 1999
+ Free Software Foundation, Inc.
+ Written by Steve Chamberlain of Cygnus Support (sac@cygnus.com).
This file is part of GLD, the Gnu Linker.
*/
-
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
fprintf(config.map_file, "%c",code);
}
-static void
+static void
make_abs (ptr)
etree_value_type *ptr;
{
return new;
}
-static void
+static void
check (os, name, op)
lang_output_section_statement_type *os;
const char *name;
return new;
}
-static etree_value_type
+static etree_value_type
fold_binary (tree, current_section, allocation_done, dot, dotp)
etree_type *tree;
lang_output_section_statement_type *current_section;
make_abs(&other);
}
- switch (tree->type.node_code)
+ switch (tree->type.node_code)
{
case '%':
if (other.value == 0)
return result;
}
-etree_value_type
+etree_value_type
invalid ()
{
etree_value_type new;
return new;
}
-static etree_value_type
+static etree_value_type
fold_name (tree, current_section, allocation_done, dot)
etree_type *tree;
lang_output_section_statement_type *current_section;
bfd_vma dot;
{
etree_value_type result;
- switch (tree->type.node_code)
+ switch (tree->type.node_code)
{
case SIZEOF_HEADERS:
- if (allocation_done != lang_first_phase_enum)
+ if (allocation_done != lang_first_phase_enum)
{
result = new_abs ((bfd_vma)
bfd_sizeof_headers (output_bfd,
case SIZEOF:
if (allocation_done != lang_first_phase_enum)
{
+ int opb = bfd_octets_per_byte (output_bfd);
lang_output_section_statement_type *os;
os = lang_output_section_find (tree->name.name);
check (os, tree->name.name, "SIZEOF");
- result = new_abs (os->bfd_section->_raw_size);
+ result = new_abs (os->bfd_section->_raw_size / opb);
}
else
result = invalid ();
return result;
}
-etree_value_type
+etree_value_type
exp_fold_tree (tree, current_section, allocation_done, dot, dotp)
etree_type *tree;
lang_output_section_statement_type *current_section;
return result;
}
- switch (tree->type.node_class)
+ switch (tree->type.node_class)
{
case etree_value:
result = new_rel (tree->value.value, current_section);
allocation_done, dot, dotp);
if (result.valid_p)
{
- switch (tree->type.node_code)
+ switch (tree->type.node_code)
{
case ALIGN_K:
if (allocation_done != lang_first_phase_enum)
result.value += result.section->bfd_section->vma;
result.section = abs_output_section;
}
- else
+ else
result.valid_p = false;
break;
dot, nextdot);
}
else
- *dotp = nextdot;
+ *dotp = nextdot;
}
}
}
return result;
}
-static etree_value_type
+static etree_value_type
exp_fold_tree_no_dot (tree, current_section, allocation_done)
etree_type *tree;
lang_output_section_statement_type *current_section;
return new;
}
-
etree_type *
exp_unop (code, child)
int code;
return new;
}
-
etree_type *
exp_nameop (code, name)
int code;
value.name.name = name;
value.name.type.node_class = etree_name;
-
r = exp_fold_tree_no_dot(&value,
(lang_output_section_statement_type *)NULL,
lang_first_phase_enum);
}
-
-
-
etree_type *
exp_assop (code, dst, src)
int code;
value.assign.type.node_code = code;
-
value.assign.src = src;
value.assign.dst = dst;
value.assign.type.node_class = etree_assign;
return n;
}
-void
+void
exp_print_tree (tree)
etree_type *tree;
{
break;
case etree_unary:
exp_print_token(tree->unary.type.node_code);
- if (tree->unary.child)
+ if (tree->unary.child)
{
fprintf(config.map_file,"(");
exp_print_tree(tree->unary.child);
fprintf(config.map_file,")");
}
-
+
break;
case etree_assert:
return def;
}
-int
+int
exp_get_value_int (tree,def,name, allocation_done)
etree_type *tree;
int def;
return (int)exp_get_vma(tree,(bfd_vma)def,name, allocation_done);
}
-
bfd_vma
exp_get_abs_int (tree, def, name, allocation_done)
etree_type *tree;
- int def;
+ int def ATTRIBUTE_UNUSED;
char *name;
lang_phase_type allocation_done;
{