This is the mail archive of the
mailing list for the binutils project.
Re: bogus test case expectations
On Wed, Jul 22, 2009 at 4:46 AM, Jan Beulich<JBeulich@novell.com> wrote:
>>>> "H.J. Lu" <firstname.lastname@example.org> 21.07.09 17:59 >>>
>>The code looks like
> Not exactly.
>>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.
Please take a look at
again. "foo = bar" just makes a new symbol, foo, with value
and type of symbol, bar. We should never replace relocations
against "foo" with relocations against "bar" since other properties
of "foo" and "bar" may be very different.