This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/5092] New: dl_init load LD_PRELOADed init function last


It appears _dl_init() call up the init() function in reverse order, ie.:

 i = main_map->l_searchlist.r_nlist;
  while (i-- > 0)
    call_init (main_map->l_initfini[i], argc, argv, env);

while the the list is built using LD_PRELOAD 1st, then the listed in 
the "a.out". Is this an intentional semantic that LD_PRELOAD is looked 1st for 
symbols and last for init()ialization ? 

This is easily reproducible by building 2 dso ( with their respective init() 
functions ) and a.out ( compiled -L. -l2nd ) called like this:

env LD_DEBUG=libs LD_PRELOAD=lib1st.do LD_LIBRARY_PATH=`pwd` ./a.out
  .
  calling init: lib2nd.so
  .
  calling init: lib1st.so

Given that *reverse* behaviour, it's impossible to set something in 
LD_PRELOAD=lib1st.so init function for use by the *regular* next init() dso. 
Maybe there is a way but found none so far.

-- 
           Summary: dl_init  load LD_PRELOADed init function last
           Product: glibc
           Version: 2.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: michel at sgi dot com
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=5092

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]