dlopen / dlsym issue ? / Reproducing the issue

jean-marie.verdun at splitted-desktop.org jean-marie.verdun at splitted-desktop.org
Tue Apr 11 12:10:52 UTC 2006


Ok Peter, Thanks for the update.
I will try to backport  from svn to my 0.9.27 tree. Any chance to 
have a test on 0.9.28 ?

Joakim, I will submit you a test case based on the small code I made to 
dlopen stuff.

Jm


On Tue, 11 Apr 2006, Peter S. Mazinger wrote:

> On Tue, 11 Apr 2006 jean-marie.verdun at splitted-desktop.org wrote:
>
>> Hi,
>>
>> I have written a simple reproducer which make easily raise the bug.
>> just follow this into a chroot environment with 0.9.27 or 0.9.28
>>
>> mkdir test
>> cd test
>> mkdir test1
>> mkdir test2
>>
>> -> Edit module1.c
>> #include <stdio.h>
>>
>> void module_open()
>> {
>>          printf("Module Open call ok module 1\n");
>> }
>>
>> -> Edit module2.c
>> #include <stdio.h>
>>
>> void module_open()
>> {
>>          printf("Module Open call ok module 2\n");
>> }
>>
>> -> Edit main.c
>>
>> #include <stdio.h>
>> #include <stdlib.h>
>> #include <dlfcn.h>
>> int main()
>> {
>>      void *handle;
>>      void (*ptr)();
>>       handle=dlopen("test2/module.so", RTLD_LAZY);
>>       printf("Handle %lx\n",handle);
>>       if (handle)
>>       {
>>          ptr=dlsym(handle,"module_open");
>>       }
>>       printf("Return function addr %lx\n",ptr);
>>       (*ptr)();
>>       handle=dlopen("test1/module.so", RTLD_LAZY);
>>            printf("Handle %lx\n",handle);
>>       if (handle)
>>       {
>>          ptr=dlsym(handle,"module_open");
>>       }
>>       printf("Return function addr %lx\n",ptr);
>>       (*ptr)();
>>
>>       return(0);
>> }
>>
>> Compile module1.c
>> gcc -c module1.c
>> gcc -o test1/module.so -shared module1.o
>>
>> Compile module2.c
>> gcc -c module2.c
>> gcc -o test2.module.so -shared module2.o
>>
>> Compile main.c
>> gcc main.c -ldl
>>
>> With a glibc environment
>> ./a.out
>> Handle 804a020
>> Return function addr 400166cc
>> Module Open call ok module 2
>> Handle 804a390
>> Return function addr 400196cc
>> Module Open call ok module 1
>>
>> With a uClibc enivironment
>> ./a.out
>> Handle 804a120
>> Return function addr 400bb440
>> Module Open call ok module 2
>> Handle 804a150
>> Return function addr 400bb440
>> Module Open call ok module 2
>
> uClibc-svn (native build on x86) is ok
>
> Peter
>>
>> There is 2 different handles but dlsym is not returning the right stuff.
>> I will try to investigate more today.
>>
>> Jm
>>
>>
>> On Tue, 11 Apr 2006, Joakim Tjernlund wrote:
>>
>>>
>>>>
>>>> Hi,
>>>>
>>>> I am using uClibc 0.97 as a test plateform to build a
>>>> lightweight graphical environment. I am trying to port on top
>>>> of a buildroot environment Enlightenment DR17
>>>> (http://www.enlightenment.org) which is under heavy
>>>
>>> .97(I assume this is really 0.9.27) is very old and lots has happened since then(in ldso as well).
>>> I think you should try both 0.9.28 and current SVN.
>>> If that doesn't work, show me the the RTLD_XX flags you are using and make sure
>>> that the .so libs has all dependencies in their DT_NEEDED list.
>>>
>>>>
>>>> I have included into my 0.97 source tree the lates ldso tree
>>>> from the CVS but without major success.
>>>
>>> Don't see how you can just rip out the ldso sub tree and make that work with current
>>> SVN. What did you do?
>>>
>>>
>>
>>
>
> -- 
> Peter S. Mazinger <ps dot m at gmx dot net>           ID: 0xA5F059F2
> Key fingerprint = 92A4 31E1 56BC 3D5A 2D08  BB6E C389 975E A5F0 59F2
>



More information about the uClibc mailing list