This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: RFC: Add DT_FLAGS_2 and DF_2_GNU_IFUNC
On Fri, May 25, 2018 at 2:26 PM, Florian Weimer <fweimer@redhat.com> wrote:
> On 05/25/2018 11:18 PM, H.J. Lu wrote:
>
>>> 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]$
>
>
> This doesn't reproduce for me. The commands above do not produce
> libmemmove.so. “LD_PRELOAD=./libbar.so ./x” does not crash here (with a
> glibc 2.26-derived library that hasn't got my IFUNC scheduler).
>
https://sourceware.org/bugzilla/show_bug.cgi?id=23240
--
H.J.