Detecting multiple libcs

Florian Weimer fweimer@redhat.com
Fri Jun 3 14:50:00 GMT 2016


ptmalloc_init has this code:

#ifdef SHARED
   /* In case this libc copy is in a non-default namespace, never use brk.
      Likewise if dlopened from statically linked program.  */
   Dl_info di;
   struct link_map *l;

   if (_dl_open_hook != NULL
       || (_dl_addr (ptmalloc_init, &di, &l, NULL) != 0
           && l->l_ns != LM_ID_BASE))
     __morecore = __failing_morecore;
#endif

But it does not seem t work because after a static dlopen, _dl_open_hook 
is NULL.

Is there a way to actually detect this situation?  It does not seem to 
be apparent from the way the DT_INIT etc. functions are called.

Thanks,
Florian



More information about the Libc-alpha mailing list