This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] change the condition preventing symbol replacement in snapshot_symbol()
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Jan Beulich <JBeulich at novell dot com>
- Cc: binutils at sourceware dot org
- Date: Fri, 24 Jul 2009 07:56:14 -0700
- Subject: Re: [PATCH] change the condition preventing symbol replacement in snapshot_symbol()
- References: <4A69E2B8020000780000C28A@vpn.id2.novell.com>
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?
--
H.J.