aboutsummaryrefslogtreecommitdiff
path: root/ld/ldexp.c
diff options
context:
space:
mode:
authorSteve Chamberlain <sac@cygnus>1992-05-04 23:38:42 +0000
committerSteve Chamberlain <sac@cygnus>1992-05-04 23:38:42 +0000
commitbfbdc80f0adfc6000accbc468ed1764f5aeb8aae (patch)
tree5a9f6bdd80f730a1019bf33ed93fde37b1c20cad /ld/ldexp.c
parentf7ebd77dba70ddecdf1588f384666f9f5e4de535 (diff)
downloadgdb-bfbdc80f0adfc6000accbc468ed1764f5aeb8aae.zip
gdb-bfbdc80f0adfc6000accbc468ed1764f5aeb8aae.tar.gz
gdb-bfbdc80f0adfc6000accbc468ed1764f5aeb8aae.tar.bz2
* ldver.c: Bumped version to 1.96 - new release, resync with the
bfd too #. * ldexp.c, ldlang.c: now build memory shape tree in obstacks rather than with raw malloc, makes it easier to track where memory is going. * ldsym.h, ldsym.c: create obstack for all global symbols too. * ldwrite.c (ldwrite): moved malloc so only used when needed. * sa29200-sc.sh: added support for .lit, data1 and data2 sections.
Diffstat (limited to 'ld/ldexp.c')
-rw-r--r--ld/ldexp.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/ld/ldexp.c b/ld/ldexp.c
index e107110..7fcdb65 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -157,7 +157,7 @@ etree_type *
DEFUN(exp_intop,(value),
bfd_vma value)
{
- etree_type *new = (etree_type *)ldmalloc((bfd_size_type)(sizeof(new->value)));
+ etree_type *new = (etree_type *)stat_alloc((bfd_size_type)(sizeof(new->value)));
new->type.node_code = INT;
new->value.value = value;
new->type.node_class = etree_value;
@@ -520,7 +520,7 @@ DEFUN(exp_fold_tree,(tree, current_section, allocation_done,
}
else
{
- def_ptr = (asymbol **)ldmalloc((bfd_size_type)(sizeof(asymbol **)));
+ def_ptr = (asymbol **)stat_alloc((bfd_size_type)(sizeof(asymbol **)));
def = (asymbol *)bfd_make_empty_symbol(script_file->the_bfd);
@@ -589,7 +589,7 @@ DEFUN(exp_binop,(code, lhs, rhs),
{
return exp_intop(r.value);
}
- new = (etree_type *)ldmalloc((bfd_size_type)(sizeof(new->binary)));
+ new = (etree_type *)stat_alloc((bfd_size_type)(sizeof(new->binary)));
memcpy((char *)new, (char *)&value, sizeof(new->binary));
return new;
}
@@ -613,7 +613,7 @@ DEFUN(exp_trinop,(code, cond, lhs, rhs),
if (r.valid) {
return exp_intop(r.value);
}
- new = (etree_type *)ldmalloc((bfd_size_type)(sizeof(new->trinary)));
+ new = (etree_type *)stat_alloc((bfd_size_type)(sizeof(new->trinary)));
memcpy((char *)new,(char *) &value, sizeof(new->trinary));
return new;
}
@@ -635,7 +635,7 @@ DEFUN(exp_unop,(code, child),
if (r.valid) {
return exp_intop(r.value);
}
- new = (etree_type *)ldmalloc((bfd_size_type)(sizeof(new->unary)));
+ new = (etree_type *)stat_alloc((bfd_size_type)(sizeof(new->unary)));
memcpy((char *)new, (char *)&value, sizeof(new->unary));
return new;
}
@@ -648,7 +648,6 @@ DEFUN(exp_nameop,(code, name),
{
etree_type value, *new;
-
etree_value_type r;
value.name.type.node_code = code;
value.name.name = name;
@@ -661,7 +660,7 @@ DEFUN(exp_nameop,(code, name),
if (r.valid) {
return exp_intop(r.value);
}
- new = (etree_type *)ldmalloc((bfd_size_type)(sizeof(new->name)));
+ new = (etree_type *)stat_alloc((bfd_size_type)(sizeof(new->name)));
memcpy((char *)new, (char *)&value, sizeof(new->name));
return new;
@@ -690,7 +689,7 @@ DEFUN(exp_assop,(code, dst, src),
return exp_intop(result);
}
#endif
- new = (etree_type*)ldmalloc((bfd_size_type)(sizeof(new->assign)));
+ new = (etree_type*)stat_alloc((bfd_size_type)(sizeof(new->assign)));
memcpy((char *)new, (char *)&value, sizeof(new->assign));
return new;
}
@@ -719,9 +718,11 @@ DEFUN(exp_print_tree,(tree),
exp_print_tree(tree->assign.src);
break;
case etree_binary:
+ fprintf(config.map_file,"(");
exp_print_tree(tree->binary.lhs);
exp_print_token(tree->type.node_code);
exp_print_tree(tree->binary.rhs);
+ fprintf(config.map_file,")");
break;
case etree_trinary:
exp_print_tree(tree->trinary.cond);
@@ -732,9 +733,14 @@ DEFUN(exp_print_tree,(tree),
break;
case etree_unary:
exp_print_token(tree->unary.type.node_code);
+ if (tree->unary.child)
+ {
+
fprintf(config.map_file,"(");
exp_print_tree(tree->unary.child);
fprintf(config.map_file,")");
+ }
+
break;
case etree_undef:
fprintf(config.map_file,"????????");
@@ -745,6 +751,7 @@ DEFUN(exp_print_tree,(tree),
}
else {
exp_print_token(tree->type.node_code);
+ if (tree->name.name)
fprintf(config.map_file,"(%s)", tree->name.name);
}
break;
@@ -768,7 +775,7 @@ DEFUN(exp_get_vma,(tree, def, name, allocation_done),
if (tree != (etree_type *)NULL) {
r = exp_fold_tree_no_dot(tree,
- (lang_output_section_statement_type *)NULL,
+ abs_output_section,
allocation_done);
if (r.valid == false && name) {
einfo("%F%S Nonconstant expression for %s\n",name);