This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: bogus test case expectations
>>> "H.J. Lu" <hjl.tools@gmail.com> 21.07.09 17:59 >>>
>The code looks like
Not exactly.
>int
>snapshot_symbol (symbolS **symbolPP, valueT *valueP, segT *segP, fragS **fragPP)
>{
> symbolS *symbolP = *symbolPP;
>...
> /* Resolve symbolP. */
This part is crucial: symbolP may get changed here (in the switch() following
the code that resolves it), so what gets evaluated below may no longer
be (*symbolPP)->bsym (or its equivalent after LOCAL_SYMBOL_CHECK()). It
was the purpose of the patch presented to actually make the code behave
like you describe, but as explained that breaks one of the test cases you
added (of which I think that it tests undefined behavior).
> /* Never change a defined symbol. */
> if (symbolP->bsym->section == undefined_section
> || symbolP->bsym->section == expr_section)
> *symbolPP = symbolP;
>
>We don't change *symbolPP to its resolved value if it is defined.
As it stands we don't change *symbolPP if the supposed replacement symbol
is defined, which looks wrong even outside of the use that I encountered
the problem with.
Jan