This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On Fri, Jul 24, 2009 at 7:59 AM, Jan Beulich<JBeulich@novell.com> wrote:
>>>> "H.J. Lu" <hjl.tools@gmail.com> 24.07.09 16:56 >>>
>>On Fri, Jul 24, 2009 at 7:35 AM, Jan Beulich<JBeulich@novell.com> wrote:
>>> As the new ltoff22x-6 test shows, using the defined-ness of a symbol to
>>> decide whether to replace it is not correct - whether the symbol gets
>>> defined before or after the use shouldn't matter. What does matter is
>>> whether the symbol is global (and hence can, e.g. with ELF, be
>>> overridden) - it's that case where replacement should be avoided in
>>> order to not screw up the resulting relocations.
>>>
>>> ltoff22x-7 exposes another issue (mailed about yesterday) in that for
>>> equates of undefined global symbols resolve_symbol_value() will still
>>> cause the referenced symbol to be used rather than the original one,
>>> regardless of whether the original symbol is externally visible. The
>>> test therefore is an xfail for the time being, until I hear back on
>>> that issue.
>>>
>>> gas/
>>> 2009-07-24 ?Jan Beulich ?<jbeulich@novell.com>
>>>
>>> ? ? ? ?* symbols.c (snapshot_symbol): Check whether the to be replaced
>>> ? ? ? ?symbol is global, rather than whether the replacement symbol is
>>> ? ? ? ?defined.
>>>
>>
>>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.

-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]