This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[Question] ifunc odering in ELF
- From: Juchan Kim <juckim at blackberry dot com>
- To: "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>
- Date: Thu, 12 Sep 2019 19:03:04 +0000
- Subject: [Question] ifunc odering in ELF
- Reply-to: Juchan Kim <juckim at blackberry dot com>
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
Thanks,
Juchan Kim