Specify how undefined weak symbol should be resolved in executable

H.J. Lu hjl.tools@gmail.com
Fri Jan 1 00:00:00 GMT 2016


On Tue, Feb 23, 2016 at 9:01 AM, Michael Matz <matz@suse.de> wrote:
> Hi,
>
> On Tue, 23 Feb 2016, H.J. Lu wrote:
>
>> >> Not only we need to change defined weak symbol behavior, we also need
>> >> to change undefined non-weak symbol behavior when taking its address.
>> >
>> > Why?  An undefined non-weak symbol reference leads to a linker error,
>> > done.  Why change that?
>>
>> Make it "external non-weak symbol", which is a symbol defined in a
>> shared object.
>
> What would you like to change in behaviour for them (and why must it be
> done at the same time as changing something for weak symbols)?  A
> reference to the address of such a function symbol from an executable
> resolves to the plt slot currently (which in turn is exported, so that
> address references from other modules resolve to the same).  A reference
> to a non-function symbol is loaded from the got.  In all cases must this
> symbol be defined somewhere (otherwise linker error), so I don't see what
> we need to change, nor why that would force DT_TEXTREL (or the compiler to
> emit PIC like code).
>

At run-time, there is no difference between weak defined and non-weak
defined symbols.  If we change defined weak symbol behavior, we also
need to change defined non-weak symbol behavior.

-- 
H.J.



More information about the Gnu-gabi mailing list