'>>> from os.path import exists
>>> bash = ELF(which(\'bash\'))
>>> all(map(exists, bash.libs.keys()))
True
>>> any(map(lambda x: \'libc\' in x, bash.libs.keys()))
True'

def _populate_libraries(self):

    if (not self.get_section_by_name('.dynamic')):
        self.libs = {}
        return
    try:
        cmd = ('ulimit    -s    unlimited;    LD_TRACE_LOADED_OBJECTS=1    LD_WARN=1    LD_BIND_NOW=1    %s    2>/dev/null' % sh_string(self.path))
        data = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
        libs = misc.parse_ldd_output(data)
        for lib in dict(libs):
            if os.path.exists(lib):
                continue
            qemu_lib = ('/etc/qemu-binfmt/%s/%s' % (get_qemu_arch(arch=self.arch), lib))
            if os.path.exists(qemu_lib):
                libs[os.path.realpath(qemu_lib)] = libs.pop(lib)
        self.libs = libs
    except subprocess.CalledProcessError:
        self.libs = {}
