This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH 2.5/4 v2] GAS: Make new fake labels when cloning a symbol
On Fri, 3 Dec 2010, Richard Sandiford wrote:
> > Thanks for reducing the test case. Below I'm including a change that is
> > supposed to fix it. The original change indeed is what triggered the
> > problem, but from the code I have modified I infer it is more related to
> > the issue with equated symbols not being handled correctly that I have
> > fixed as well. This function counts as a symbol reference and as such
> > should resolve any equated symbols by making a clone. Chances are code
> > could have been crafted that would trigger a problem here even before my
> > fixes, but I found no justification to spend time investigating that.
> >
> > The change below fixes the problem with your test case as well as one
> > attached to PR gas/12282. I have regression-tested it with the
> > arm-none-eabi and mips-sde-elf targets.
> >
> > 2010-12-02 Maciej W. Rozycki <macro@codesourcery.com>
> >
> > PR gas/12282
> > * expr.c (make_expr_symbol): Make a clone if handling an
> > equated symbol.
>
> I'm not convinced this is correct when operand() calls make_expr_symbol()
> in expr_defer mode. Could you provide a bit more justification?
Hmm, good point, thanks, and expr() too. I'm not sure why I missed it.
I have given it some more thought and come to the conclusion it has to be
decided by the caller of make_expr_symbol() whether the symbol returned
should be equated or cloned. Assuming optimistically all the callers
other than operand(), expr() and expr_build_dot() considered here do the
right thing, i.e. either use make_expr_symbol() on a non-symbol or cope
with forward references I propose to fix expr_build_dot() only, like this.
If more places are eventually required, then a wrapper function or macro
can be created to combine make_expr_symbol() and
symbol_clone_if_forward_ref().
The change below fixes the problem with the two test cases mentioned
earlier. I have regression-tested it with the arm-none-eabi and
mips-sde-elf targets.
2010-12-03 Maciej W. Rozycki <macro@codesourcery.com>
PR gas/12282
* expr.c (expr_build_dot): Make a clone of the symbol to return if
needed.
OK to apply?
Maciej
binutils-gas-dot-fix.diff
Index: binutils-fsf-trunk-quilt/gas/expr.c
===================================================================
--- binutils-fsf-trunk-quilt.orig/gas/expr.c 2010-12-03 14:15:18.000000000 +0000
+++ binutils-fsf-trunk-quilt/gas/expr.c 2010-12-03 15:13:54.000000000 +0000
@@ -172,7 +172,7 @@ expr_build_dot (void)
expressionS e;
current_location (&e);
- return make_expr_symbol (&e);
+ return symbol_clone_if_forward_ref (make_expr_symbol (&e));
}
/* Build any floating-point literal here.