This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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: [Question] ifunc odering in ELF


On Thu, Sep 12, 2019 at 12:03 PM Juchan Kim <juckim@blackberry.com> wrote:
>
> Hello,
>
> My name is Juchan Kim and working for QNX.
> I'm writing this to ask a question regarding IFUNC.
>
> We get a segmentation fault and here is the scenario.
>
> We have two ifuncs foo1 and foo2 in our library
>
> foo1 has foo1_resolver()
> foo2 has foo2_resolver()
>
>
> foo1_resolver() {
>         ...
> }
>
> foo2_resolver() {
>         foo1()
>         ...
> }
>
> As you can see foo2_reoslver calls foo1() inside and this is the order
> in ELF
> 000000010fc0  000000000408 R_AARCH64_IRELATI         ac4 // foo2()
> 000000010fc8  000000000408 R_AARCH64_IRELATI         aec // foo1()
>
> When the library is loaded in our dynamic linker, it resolves foo2()
> first by running foo2_resolver(), but since foo1() is not reoslvered at
> that time, we get a segfault.
>
> We can resolve it by modifying the library, but I'm looking for ways on
> ELF or ld sides.
>
> What I mean is that...
> Is there any way to re-order R_AARCH64_IRELATI by dependencies using
> link scrpit or 'ld'?
>
> or I would appreiciate if you have other suggestions

What normally glibc does is lazy bindings.  But what can be done in an
ifunc resolver is usually limited anyways.  There has been discussions
about what can and cannot be done in a resolver function.  Most of
them just die out with nothing changing.  These discussion have been
about using floating point (or simd registers) in them.

Thanks,
Andrew Pinski

>
> Thanks,
> Juchan Kim


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