PR ld/12356
* ldexp.h (exp_assop): Delete. (exp_assign, exp_defsym): Declare. * ldexp.c (exp_assop): Make static, handle all assignment variations. (exp_assign, exp_defsym): New functions. (exp_provide): Use exp_assop. * ldgram.y (defsym_expr): Use exp_defsym. * ldctor.c, * ldgram.y, * ldlang.c, * mri.c, * emultempl/beos.em, * emultempl/pe.em, * emultempl/pep.em, * emultempl/spuelf.em, * emultempl/xtensaelf.em: Update exp_assop -> exp_assign.
This commit is contained in:
parent
15b8ba7693
commit
2e57b2afce
13
ld/ChangeLog
13
ld/ChangeLog
@ -1,3 +1,16 @@
|
||||
2011-01-13 Alan Modra <amodra@gmail.com>
|
||||
|
||||
PR ld/12356
|
||||
* ldexp.h (exp_assop): Delete.
|
||||
(exp_assign, exp_defsym): Declare.
|
||||
* ldexp.c (exp_assop): Make static, handle all assignment variations.
|
||||
(exp_assign, exp_defsym): New functions.
|
||||
(exp_provide): Use exp_assop.
|
||||
* ldgram.y (defsym_expr): Use exp_defsym.
|
||||
* ldctor.c, * ldgram.y, * ldlang.c, * mri.c, * emultempl/beos.em,
|
||||
* emultempl/pe.em, * emultempl/pep.em, * emultempl/spuelf.em,
|
||||
* emultempl/xtensaelf.em: Update exp_assop -> exp_assign.
|
||||
|
||||
2011-01-12 Alan Modra <amodra@gmail.com>
|
||||
|
||||
PR ld/12380
|
||||
|
@ -8,7 +8,7 @@ fi
|
||||
fragment <<EOF
|
||||
/* This file is part of GLD, the Gnu Linker.
|
||||
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Binutils.
|
||||
|
||||
@ -351,7 +351,7 @@ gld_${EMULATION_NAME}_set_symbols (void)
|
||||
for (j = 0; init[j].ptr; j++)
|
||||
{
|
||||
long val = init[j].value;
|
||||
lang_add_assignment (exp_assop ('=', init[j].symbol, exp_intop (val)));
|
||||
lang_add_assignment (exp_assign (init[j].symbol, exp_intop (val)));
|
||||
if (init[j].size == sizeof(short))
|
||||
*(short *)init[j].ptr = val;
|
||||
else if (init[j].size == sizeof(int))
|
||||
|
@ -9,7 +9,7 @@ rm -f e${EMULATION_NAME}.c
|
||||
(echo;echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-)
|
||||
fragment <<EOF
|
||||
/* Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Binutils.
|
||||
|
||||
@ -946,8 +946,8 @@ gld_${EMULATION_NAME}_set_symbols (void)
|
||||
long val = init[j].value;
|
||||
lang_assignment_statement_type *rv;
|
||||
|
||||
rv = lang_add_assignment (exp_assop ('=', GET_INIT_SYMBOL_NAME (j),
|
||||
exp_intop (val)));
|
||||
rv = lang_add_assignment (exp_assign (GET_INIT_SYMBOL_NAME (j),
|
||||
exp_intop (val)));
|
||||
if (init[j].size == sizeof (short))
|
||||
*(short *) init[j].ptr = val;
|
||||
else if (init[j].size == sizeof (int))
|
||||
@ -1722,8 +1722,8 @@ gld_${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIB
|
||||
= pe_def_file->base_address;
|
||||
init[IMAGEBASEOFF].inited = 1;
|
||||
if (image_base_statement)
|
||||
image_base_statement->exp = exp_assop ('=', "__image_base__",
|
||||
exp_intop (pe.ImageBase));
|
||||
image_base_statement->exp = exp_assign ("__image_base__",
|
||||
exp_intop (pe.ImageBase));
|
||||
}
|
||||
|
||||
if (pe_def_file->stack_reserve != -1
|
||||
|
@ -8,7 +8,8 @@ fi
|
||||
rm -f e${EMULATION_NAME}.c
|
||||
(echo;echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-)
|
||||
fragment <<EOF
|
||||
/* Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
/* Copyright 2006, 2007, 2008, 2009, 2010, 2011
|
||||
Free Software Foundation, Inc.
|
||||
Written by Kai Tietz, OneVision Software GmbH&CoKg.
|
||||
|
||||
This file is part of the GNU Binutils.
|
||||
@ -858,8 +859,8 @@ gld_${EMULATION_NAME}_set_symbols (void)
|
||||
bfd_vma val = init[j].value;
|
||||
lang_assignment_statement_type *rv;
|
||||
|
||||
rv = lang_add_assignment (exp_assop ('=', GET_INIT_SYMBOL_NAME (j),
|
||||
exp_intop (val)));
|
||||
rv = lang_add_assignment (exp_assign (GET_INIT_SYMBOL_NAME (j),
|
||||
exp_intop (val)));
|
||||
if (init[j].size == sizeof (short))
|
||||
*(short *) init[j].ptr = (short) val;
|
||||
else if (init[j].size == sizeof (int))
|
||||
@ -1525,8 +1526,8 @@ gld_${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIB
|
||||
= pep_def_file->base_address;
|
||||
init[IMAGEBASEOFF].inited = 1;
|
||||
if (image_base_statement)
|
||||
image_base_statement->exp = exp_assop ('=', "__image_base__",
|
||||
exp_intop (pep.ImageBase));
|
||||
image_base_statement->exp = exp_assign ("__image_base__",
|
||||
exp_intop (pep.ImageBase));
|
||||
}
|
||||
|
||||
if (pep_def_file->stack_reserve != -1
|
||||
|
@ -1,5 +1,6 @@
|
||||
# This shell script emits a C file. -*- C -*-
|
||||
# Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
# Copyright 2006, 2007, 2008, 2009, 2010, 2011
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of the GNU Binutils.
|
||||
#
|
||||
@ -164,7 +165,7 @@ spu_place_special_section (asection *s, asection *o, const char *output_name)
|
||||
|
||||
push_stat_ptr (&os->children);
|
||||
e_size = exp_intop (params.line_size - s->size);
|
||||
lang_add_assignment (exp_assop ('=', ".", e_size));
|
||||
lang_add_assignment (exp_assign (".", e_size));
|
||||
pop_stat_ptr ();
|
||||
}
|
||||
lang_add_section (&os->children, s, os);
|
||||
|
@ -1,5 +1,5 @@
|
||||
# This shell script emits a C file. -*- C -*-
|
||||
# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||
# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of the GNU Binutils.
|
||||
@ -1885,7 +1885,7 @@ ld_xtensa_insert_page_offsets (bfd_vma dot,
|
||||
etree_type *name_op = exp_nameop (NAME, ".");
|
||||
etree_type *addend_op = exp_intop (1 << xtensa_page_power);
|
||||
etree_type *add_op = exp_binop ('+', name_op, addend_op);
|
||||
etree_type *assign_op = exp_assop ('=', ".", add_op);
|
||||
etree_type *assign_op = exp_assign (".", add_op);
|
||||
|
||||
lang_assignment_statement_type *assign_stmt;
|
||||
lang_statement_union_type *assign_union;
|
||||
|
12
ld/ldctor.c
12
ld/ldctor.c
@ -1,6 +1,6 @@
|
||||
/* ldctor.c -- constructor support routines
|
||||
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
||||
2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
||||
2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011
|
||||
Free Software Foundation, Inc.
|
||||
By Steve Chamberlain <sac@cygnus.com>
|
||||
|
||||
@ -319,11 +319,11 @@ ldctor_build_sets (void)
|
||||
break;
|
||||
}
|
||||
|
||||
lang_add_assignment (exp_assop ('=', ".",
|
||||
exp_unop (ALIGN_K,
|
||||
exp_intop (reloc_size))));
|
||||
lang_add_assignment (exp_assop ('=', p->h->root.string,
|
||||
exp_nameop (NAME, ".")));
|
||||
lang_add_assignment (exp_assign (".",
|
||||
exp_unop (ALIGN_K,
|
||||
exp_intop (reloc_size))));
|
||||
lang_add_assignment (exp_assign (p->h->root.string,
|
||||
exp_nameop (NAME, ".")));
|
||||
lang_add_data (size, exp_intop (p->count));
|
||||
|
||||
for (e = p->elements; e != NULL; e = e->next)
|
||||
|
47
ld/ldexp.c
47
ld/ldexp.c
@ -974,18 +974,34 @@ exp_nameop (int code, const char *name)
|
||||
|
||||
}
|
||||
|
||||
etree_type *
|
||||
exp_assop (int code, const char *dst, etree_type *src)
|
||||
static etree_type *
|
||||
exp_assop (const char *dst,
|
||||
etree_type *src,
|
||||
enum node_tree_enum class,
|
||||
bfd_boolean hidden)
|
||||
{
|
||||
etree_type *new_e;
|
||||
etree_type *n;
|
||||
|
||||
new_e = (etree_type *) stat_alloc (sizeof (new_e->assign));
|
||||
new_e->type.node_code = code;
|
||||
new_e->type.lineno = src->type.lineno;
|
||||
new_e->type.node_class = etree_assign;
|
||||
new_e->assign.src = src;
|
||||
new_e->assign.dst = dst;
|
||||
return new_e;
|
||||
n = (etree_type *) stat_alloc (sizeof (n->assign));
|
||||
n->assign.type.node_code = '=';
|
||||
n->assign.type.lineno = src->type.lineno;
|
||||
n->assign.type.node_class = class;
|
||||
n->assign.src = src;
|
||||
n->assign.dst = dst;
|
||||
n->assign.hidden = hidden;
|
||||
return n;
|
||||
}
|
||||
|
||||
etree_type *
|
||||
exp_assign (const char *dst, etree_type *src)
|
||||
{
|
||||
return exp_assop (dst, src, etree_assign, FALSE);
|
||||
}
|
||||
|
||||
etree_type *
|
||||
exp_defsym (const char *dst, etree_type *src)
|
||||
{
|
||||
return exp_assop (dst, src, etree_assign, TRUE);
|
||||
}
|
||||
|
||||
/* Handle PROVIDE. */
|
||||
@ -993,16 +1009,7 @@ exp_assop (int code, const char *dst, etree_type *src)
|
||||
etree_type *
|
||||
exp_provide (const char *dst, etree_type *src, bfd_boolean hidden)
|
||||
{
|
||||
etree_type *n;
|
||||
|
||||
n = (etree_type *) stat_alloc (sizeof (n->assign));
|
||||
n->assign.type.node_code = '=';
|
||||
n->assign.type.lineno = src->type.lineno;
|
||||
n->assign.type.node_class = etree_provide;
|
||||
n->assign.src = src;
|
||||
n->assign.dst = dst;
|
||||
n->assign.hidden = hidden;
|
||||
return n;
|
||||
return exp_assop (dst, src, etree_provide, hidden);
|
||||
}
|
||||
|
||||
/* Handle ASSERT. */
|
||||
|
@ -46,7 +46,7 @@ enum node_tree_enum {
|
||||
typedef struct {
|
||||
int node_code;
|
||||
unsigned int lineno;
|
||||
enum node_tree_enum node_class;
|
||||
enum node_tree_enum node_class;
|
||||
} node_type;
|
||||
|
||||
typedef union etree_union {
|
||||
@ -190,8 +190,10 @@ etree_type *exp_unop
|
||||
(int, etree_type *);
|
||||
etree_type *exp_nameop
|
||||
(int, const char *);
|
||||
etree_type *exp_assop
|
||||
(int, const char *, etree_type *);
|
||||
etree_type *exp_assign
|
||||
(const char *, etree_type *);
|
||||
etree_type *exp_defsym
|
||||
(const char *, etree_type *);
|
||||
etree_type *exp_provide
|
||||
(const char *, etree_type *, bfd_boolean);
|
||||
etree_type *exp_assert
|
||||
|
18
ld/ldgram.y
18
ld/ldgram.y
@ -1,6 +1,6 @@
|
||||
/* A YACC grammar to parse a superset of the AT&T linker scripting language.
|
||||
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
|
||||
Free Software Foundation, Inc.
|
||||
Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
|
||||
|
||||
@ -176,7 +176,7 @@ defsym_expr:
|
||||
NAME '=' exp
|
||||
{
|
||||
ldlex_popstate();
|
||||
lang_add_assignment(exp_assop($3,$2,$4));
|
||||
lang_add_assignment (exp_defsym ($2, $4));
|
||||
}
|
||||
;
|
||||
|
||||
@ -657,15 +657,15 @@ end: ';' | ','
|
||||
assignment:
|
||||
NAME '=' mustbe_exp
|
||||
{
|
||||
lang_add_assignment (exp_assop ($2, $1, $3));
|
||||
lang_add_assignment (exp_assign ($1, $3));
|
||||
}
|
||||
| NAME assign_op mustbe_exp
|
||||
{
|
||||
lang_add_assignment (exp_assop ('=', $1,
|
||||
exp_binop ($2,
|
||||
exp_nameop (NAME,
|
||||
$1),
|
||||
$3)));
|
||||
lang_add_assignment (exp_assign ($1,
|
||||
exp_binop ($2,
|
||||
exp_nameop (NAME,
|
||||
$1),
|
||||
$3)));
|
||||
}
|
||||
| PROVIDE '(' NAME '=' mustbe_exp ')'
|
||||
{
|
||||
@ -983,7 +983,7 @@ section: NAME { ldlex_expression(); }
|
||||
opt_exp_with_type
|
||||
{
|
||||
ldlex_popstate ();
|
||||
lang_add_assignment (exp_assop ('=', ".", $3));
|
||||
lang_add_assignment (exp_assign (".", $3));
|
||||
}
|
||||
'{' sec_or_group_p1 '}'
|
||||
| INCLUDE filename
|
||||
|
@ -1809,7 +1809,7 @@ lang_insert_orphan (asection *s,
|
||||
sprintf (symname + (symname[0] != 0), "__start_%s", secname);
|
||||
e_align = exp_unop (ALIGN_K,
|
||||
exp_intop ((bfd_vma) 1 << s->alignment_power));
|
||||
lang_add_assignment (exp_assop ('=', ".", e_align));
|
||||
lang_add_assignment (exp_assign (".", e_align));
|
||||
lang_add_assignment (exp_provide (symname,
|
||||
exp_unop (ABSOLUTE,
|
||||
exp_nameop (NAME, ".")),
|
||||
@ -7229,7 +7229,7 @@ lang_leave_overlay (etree_type *lma_expr,
|
||||
overlay region. */
|
||||
if (overlay_list != NULL)
|
||||
overlay_list->os->update_dot_tree
|
||||
= exp_assop ('=', ".", exp_binop ('+', overlay_vma, overlay_max));
|
||||
= exp_assign (".", exp_binop ('+', overlay_vma, overlay_max));
|
||||
|
||||
l = overlay_list;
|
||||
while (l != NULL)
|
||||
|
4
ld/mri.c
4
ld/mri.c
@ -1,6 +1,6 @@
|
||||
/* mri.c -- handle MRI style linker scripts
|
||||
Copyright 1991, 1992, 1993, 1994, 1996, 1997, 1998, 1999, 2000, 2001,
|
||||
2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
|
||||
2002, 2003, 2004, 2005, 2007, 2011 Free Software Foundation, Inc.
|
||||
Contributed by Steve Chamberlain <sac@cygnus.com>.
|
||||
|
||||
This file is part of the GNU Binutils.
|
||||
@ -295,7 +295,7 @@ mri_format (const char *name)
|
||||
void
|
||||
mri_public (const char *name, etree_type *exp)
|
||||
{
|
||||
lang_add_assignment (exp_assop ('=', name, exp));
|
||||
lang_add_assignment (exp_assign (name, exp));
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user