'_dynamic_load_dynelf(libname) -> DynELF
Looks up information about a loaded library via the link map.
Arguments:
libname(str):  Name of the library to resolve, or a substring (e.g. \'libc.so\')
Returns:
A DynELF instance for the loaded library, or None.'

def _dynamic_load_dynelf(self, libname):

    cur = self.link_map
    leak = self.leak
    LinkMap = {32: elf.Elf32_Link_Map, 64: elf.Elf64_Link_Map}[self.elfclass]
    while leak.field(cur, LinkMap.l_prev):
        cur = leak.field(cur, LinkMap.l_prev)
    while cur:
        self.status(('link_map    entry    %#x' % cur))
        p_name = leak.field(cur, LinkMap.l_name)
        name = leak.s(p_name)
        if (libname in name):
            break
        if name:
            self.status(('Skipping    %s' % name))
        cur = leak.field(cur, LinkMap.l_next)
    else:
        self.failure(('Could    not    find    library    with    name    containing    %r' % libname))
        return None
    libbase = leak.field(cur, LinkMap.l_addr)
    self.status(('Resolved    library    %r    at    %#x' % (libname, libbase)))
    lib = DynELF(leak, libbase)
    lib._dynamic = leak.field(cur, LinkMap.l_ld)
    lib._waitfor = self._waitfor
    return lib
