[PATCH] change the condition preventing symbol replacement in snapshot_symbol()

H.J. Lu hjl.tools@gmail.com
Fri Jul 24 16:38:00 GMT 2009


On Fri, Jul 24, 2009 at 8:59 AM, Jan Beulich<JBeulich@novell.com> wrote:
>>>> "H.J. Lu" <hjl.tools@gmail.com> 24.07.09 17:45 >>>
>>>>I think it may be wrong. We can have
>>>>
>>>>.globl foo
>>>>bar = foo
>>>>
>>>>where foo is defined/global and bar is local. Will you replace foo with
>>>>bar?
>>>
>>> No, only the other way around: bar (non-global) can be replaced by foo.
>>>
>>
>>That is what I meant and it is wrong. You can't replace a local symbol with
>>a global one.
>
> Why? A non-global equate just serves as an alias. And remember, the
> change fixes a problem (you just didn't cover all of the possible cases with
> your ltoff22x tests) - how would you suggest addressing that otherwise?

Global symbol may be overridden by another definition. You
can't change relocation against a local symbol to a global
symbol.

> Also, the logic in resolve_symbol_values() does just that - replace
> relocations using non-global (and erroneously as I think also global ones
> at present) equates by their global underlying symbols.
>

A testcase?

-- 
H.J.



More information about the Binutils mailing list