答复: Some question abou t linker dlopen with valgrind

Wuweijia <[email protected]>
Newsgroups gmane.comp.debugging.valgrind
Message-ID <[email protected]>
Is there any ways to make valgrind to support init_array to dlopen shared object;

I think linker can make the right jump to the malloc function without valgirind, so the source is right;

I want some ways to trace the valgirnd why redir module to malloc is failue;  




-----邮件原件-----
发件人: John Reiser [mailto:[email protected]] 
发送时间: 2019年4月23日 23:19
收件人: [email protected]
主题: Re: [Valgrind-users] Some question about linker dlopen with valgrind

>>            On the Android OS,  there is a question about the linker program with vaglrind memcheck.

Which version of Android?

>>
>>            The 1^st  experiment,  the libc module *do*call the dlopen 
>> function to load some shared object, before the linker  call the 
>> pre_init functions (  before transfer the cpu control to the main ), 
>> and then the valgrind *can  not*trace malloc leak;
>>
>>            The second experiment, the libc module *do not*call the 
>> dlopen function to load some shared object, before the linker  call 
>> the pre_init functions (  before transfer the cpu control to the main 
>> ), and then the valgrind *can*  trace malloc leak;
>>
>>            I want to know why , and how to  make valgrind can trace memory leak, while  the libc module call the dlopen function to load some so, before the linker call the pre-init functions.

According to
    https://docs.oracle.com/cd/E19683-01/816-1386/6m7qcobks/index.html
the order of execution is:
   1. linker resolves and fetches all DT_NEEDED modules (shared libraries),
      and performs all relocations for the entire process image
   2. linker calls DT_PREINIT_ARRAY functions of the main program, in order
      (only a main program may have DT_PREINIT_ARRAY; a shared library MUST NOT)
   3. in dependency order (topological bottom-up) of all loaded modules (main program
      and shared libraries): linker calls DT_INIT and then DT_INIT_ARRAY (in order)
      for the module
   4. linker transfers control to the ElfXX_Ehdr.e_entry address of the main program

It is undefined what happens if a DT_PREINIT_ARRAY, DT_INIT_ARRAY, or DT_INIT function calls dlopen, particularly if the newly-loaded module depends on any other modules, whether or not those modules have been loaded already.  (The dependent module might not be initialized yet.)


_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.