[IFUNC] PATCH: Add an ifunc attribute

H.J. Lu hjl.tools@gmail.com
Sat Jul 25 21:52:00 GMT 2009


On Fri, Jul 24, 2009 at 7:04 PM, Alan Modra<amodra@bigpond.net.au> wrote:
> On Fri, Jul 24, 2009 at 07:43:42AM -0700, H.J. Lu wrote:
>> ld.so can call a function if its dependencies have been resolved.
>> You have to change ld and ld.so to make sure that. It took me a
>> while to get it right in ld and ld.so for x86.
>>
>> Which GOT entry is uninitialized? Why hasn't it been initialized?
>> What is this GOT entry used for?
>
> The GOT entry for "global", used by foo_ifunc or bar_ifunc (I didn't
> bother finding out which one).  The whole point of the testcase was to
> demonstrate that you can't write an ifunc that reads a global var,
> unless you perform ifunc relocations last, globally.  Even on x86.
> Please run the testcase against your latest and greatest toolchain.
>

IFUNC has limitations. That is one of them. It crashed when ld.so
tried to resolve foo when relocating./ifunclib2.so before global in
/ifunclib1.so was resolved. Since since foo is an IFUNC function, it
segfaulted when it was called due to unresolved global. If an
ifunc function depends on other relocations, there may be a problem
unless you can make sure that dependencies can be resolved first.


-- 
H.J.



More information about the Gcc-patches mailing list