On Fri, Feb 08, 2008 at 10:24:40AM +0100, Carmelo AMOROSO wrote:
>Bernd Schmidt wrote:
>> Carmelo AMOROSO wrote:
>>   
>>> based on  the patch from Nickolai, here you can find a comprehensive
>>> patch to fix
>>> dladdr function.
>>>
>>> With the current implementation, the invocation of dladdr((void *) 1,
>>> &dlinfo)
>>> will fill dlinfo.dli_fname with the name of the application itself and
>>> dlinfo.dli_fbase with 0 (the current value of tpnt->loadaddr for the
>>> main app).
>>>
>>> The patch solves this adding a new field into the struct elf_resolve
>>> named  DL_LOADADDR_TYPE mapaddr.
>>> For shared objects, mapaddr has exactly the same value as loadaddr,
>>> while for the
>>> main app it contains the address of the first PT_LOAD segmented loaded.
>>>
>>> loadaddr will keep it's value and will used exactly as is (as a in
>>> memory offset
>>> with respect to relative addresses from ELF sections).
>>> While in the DL_ADDR_IN_LOADADDR macro, the new field mapaddr needs to
>>> be used.
>>>     
>>
>> This is broken on FD-PIC, since you treat DL_LOADADDR_TYPE variables as
>> pointers, defeating the point of abstracting away the type.
>>
>> The following patch makes it compile on Blackfin, but I'm unable to test
>> this on a non-FDPIC system.  Does it still work for you?
>>
>>
>> Bernd
>>   
>Hi Bernd,
>the fix is fine for me too.. sorry I did not take care of the 
>specificity of bfin.
>Please, go ahead and commit it. I'll update the nptl branch too.

Ever since this patch was installed, i get:
ldso/libdl/libdl.c: In function 'dladdr':
ldso/libdl/libdl.c:746: warning: assignment makes pointer from integer without 
a cast

To bypass this alleged bug, i suspect something like the paste below
could be appropriate, but i'd prefer if somebody else would have a look
and fix this. TIA..


Index: uClibc/ldso/libdl/libdl.c
===================================================================
--- uClibc/ldso/libdl/libdl.c   (revision 21490)
+++ uClibc/ldso/libdl/libdl.c   (working copy)
@@ -743,7 +743,7 @@ int dladdr(const void *__address, Dl_inf
 
                /* Set the info for the object the address lies in */
                __info->dli_fname = pelf->libname;
-               __info->dli_fbase = pelf->mapaddr;
+               __info->dli_fbase = (void*)(pelf->mapaddr);
 
                symtab = (ElfW(Sym) *) (pelf->dynamic_info[DT_SYMTAB]);
                strtab = (char *) (pelf->dynamic_info[DT_STRTAB]);
_______________________________________________
uClibc mailing list
uClibc@uclibc.org
http://busybox.net/cgi-bin/mailman/listinfo/uclibc

Reply via email to