[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Specify how undefined weak symbol should be resolved in executable



On Wed, Feb 24, 2016 at 9:08 AM, Michael Matz <matz@suse.de> wrote:
> Hi,
>
> On Wed, 24 Feb 2016, H.J. Lu wrote:
>
>> >> I was saying as far as ld was concerned, weak defined and non-weak
>> >> defined dynamic symbols would be treated equally at run-time.  Do you
>> >> agree with me?
>> >
>> > I at least don't.  The difference is that a defined weak symbol (at
>> > link edit time) might become undefined at runtime.  A defined non-weak
>> > symbol can't.  So they have to be handled differently.
>> >
>>
>> How?
>
> Like right now (mostly)?  Resolution of weak symbols needs to be deferred
> to the dynamic linker, in particular they mustn't be resolved (to either
> zero or an address) at link edit time.  There's one case where weak
> symbols can be resolved early: if at link edit time the executable itself
> provides a definition of 'foo' then weak references can be directly
> resolved to that one (because at runtime of that exectuable there's no
> possibility to not have this symbol defined).
>
> To not do that (i.e. resolve them always at link edit time) breaks various
> current uses of weak symbols.  We could do that of course, but I don't
> think that would be useful to users.

I suggest you raise this issue at

https://groups.google.com/forum/#!forum/generic-abi

-- 
H.J.