[PATCH] Fix dladdr return value when cannot find symbol

Carmelo AMOROSO carmelo.amoroso at st.com
Mon Dec 10 15:13:36 UTC 2007


Nickolai Zeldovich wrote:
>  On Dec 9, 2007 11:26 AM, Carmelo Amoroso <carmelo73 at gmail.com> wrote:
>   
>> Attached patch tries to fix it. The GNU_HASH part needs to be fixed accordingly.
>>
>> Any comments ?
>>     
>
> I think that should work.  Minor point:
>
>   
>> --- ldso/libdl/libdl.c  (revision 20633)
>> +++ ldso/libdl/libdl.c  (working copy)
>> @@ -723,8 +723,11 @@
>>                 _dl_if_debug_print("Module \"%s\" at %p\n",
>>                                    tpnt->libname, DL_LOADADDR_BASE(tpnt->loadaddr));
>>
>> -               if (DL_ADDR_IN_LOADADDR((ElfW(Addr)) __address, tpnt, pelf))
>> +               if (DL_ADDR_IN_LOADADDR((ElfW(Addr)) __address, tpnt, pelf)) {
>>                         pelf = tpnt;
>> +                       /* Found, stop looping */
>> +                       break;
>> +               }
>>         }
>>
>>         if (!pelf) {
>>     
>
> I don't think this change is necessary or correct.  With this change,
> the code can exit having found any shared library mapped at any lower
> address.  Instead, you need to iterate over all loaded ELF files to
> find the nearest shared library mapped at a lower address (see the
> comment for DL_ADDR_IN_LOADADDR in dl-defs.h).
>   
> Nickolai.
>   
Yes, you're right. I'm doing some tests and I'll commit a comprehensive 
patch.
Thanks,
Carmelo
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://busybox.net/cgi-bin/mailman/listinfo/uclibc
>
>   




More information about the uClibc mailing list