Still I don't see what this buys you if the LD_PRELOAD object has IFUNCs,
too.
[hjl@gnu-cfl-1 ifunc-2]$ cat bar.c
void
bar (char *dst, const char *src, unsigned int size)
{
__builtin_memmove (dst, src, size);
}
[hjl@gnu-cfl-1 ifunc-2]$ cat main.c
extern void bar (char *, const char *, unsigned int);
int
main ()
{
char dst[50];
const char src[] =
{
"This is a test"
};
bar (dst, src, sizeof (src));
if (__builtin_memcmp (dst, src, sizeof (src)) != 0)
__builtin_abort ();
return 0;
}
[hjl@gnu-cfl-1 ifunc-2]$ make
gcc -O2 -g -c -o main.o main.c
gcc -O2 -g -fPIC -c -o bar.o bar.c
gcc -shared -z now -o libbar.so bar.o
gcc -z now -o x main.o libbar.so -Wl,-R,.
./x
[hjl@gnu-cfl-1 ifunc-2]$ LD_PRELOAD=./libmemmove.so ./x
./x: Relink `./libbar.so' with `./libmemmove.so' for IFUNC symbol `memmove'
[hjl@gnu-cfl-1 ifunc-2]$