This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC 2/2] Update prototype of IFUNC resolver for MIPS
- From: Szabolcs Nagy <szabolcs dot nagy at arm dot com>
- To: Faraz Shahbazker <faraz dot shahbazker at imgtec dot com>, "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>
- Cc: Matthew Fortune <Matthew dot Fortune at imgtec dot com>, Robert Suchanek <Robert dot Suchanek at imgtec dot com>
- Date: Fri, 04 Sep 2015 14:17:56 +0100
- Subject: Re: [RFC 2/2] Update prototype of IFUNC resolver for MIPS
- Authentication-results: sourceware.org; auth=none
- References: <DCB1C42372B1674B8F912A294CCB775A71684631 at BADAG02 dot ba dot imgtec dot org> <87k2tdn5xt dot fsf at googlemail dot com> <55BFC10F dot 2050503 at imgtec dot com> <87k2tapwq0 dot fsf at googlemail dot com> <55CE5217 dot 5020902 at imgtec dot com> <87io8f2gc9 dot fsf at googlemail dot com> <55D23368 dot 1070705 at imgtec dot com> <87io8dhegb dot fsf at googlemail dot com> <55D269D2 dot 2030208 at imgtec dot com> <87si7h6oyv dot fsf at googlemail dot com> <55D7A3C5 dot 8050600 at imgtec dot com> <87vbc7u1df dot fsf at googlemail dot com> <55E8C3C5 dot 8000107 at imgtec dot com>
On 03/09/15 23:03, Faraz Shahbazker wrote:
Comments are invited on the prototype of the IFUNC resolver for MIPS. We want
something flexible enough to handle current requirements and extensions.
This patch, from RobertS, provides the resolver with 2 HWCAP registers and a
callback control function. The callback currently provides the ability to
toggle/switch between FP ABI modes.
...
@@ -43,7 +44,9 @@ elf_ifunc_invoke (ElfW(Addr) addr)
(unsigned long int)t_addr);
}
- return ((ElfW(Addr) (*) (unsigned long int)) (addr)) (GLRO(dl_hwcap));
+ return ((ElfW(Addr) (*) (unsigned long int, unsigned long int,
+ int (int, int))) addr)
+ (GLRO(dl_hwcap), GLRO(dl_hwcap2), dl_ifunc_control);
}
the only ifunc documentation i know of says
"The calling convention of the STT_GNU_IFUNC function, which takes
no arguments and returns a function pointer, should follow the
processor-specific ABI."
(ifunc.txt at https://sites.google.com/site/x32abi/documents )
this is for x86 and wrong for other archs.
i think the interface contracts of the resolver should be
documented if ifunc is used outside the libc.
> +static int __attribute_used__
> +dl_ifunc_control (int operation, int value)
> +{
...
> + /* Remember the choice for the last compabitle FP ABI. */
> + ifunc_fpabi = in_abi;
...
+/* FP ABI requirement for ifunc with callback. The new mode switch can only
+ be requested once. */
+
+static int ifunc_fpabi = -1;
+
i think the resolver needs to be as-safe, so modified
objects should be volatile (sig_atomic_t).
the ifunc situation is quite messy, is it supposed to be
used outside of the libc? (i know on x86, gcc target libs
and function multi-versioning use it, but i'd assume other
targets would move away from it outside the libc).