如何在C ++中找到ELF二进制所需的动态库? [英] How can I find the dynamic libraries required by an ELF Binary in C++?

查看:208
本文介绍了如何在C ++中找到ELF二进制所需的动态库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获得一个elf二进制在linux使用C ++所需的所有动态库的列表?

How can I get a list of all the dynamic libraries that is required by an elf binary in linux using C++?

一旦我设法从二进制文件中提取信息(文件名?),我可以通过搜索 PATH ,但我没有找到任何有关从ELF二进制文件中提取未解决信息的信息。

Once I've managed to extract the information (filename?) from the binary I can find the actual file by searching through the PATH, but I haven't been able to find any information regarding extracting unmangled information from the ELF binary.

想法?

推荐答案

您可以调用readelf -d程序并解析输出:

You can call "readelf -d" program and parse the output:

readelf -d /usr/bin/readelf | grep NEEDED
 0x0000000000000001 (NEEDED)             Shared library: [libz.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

这篇关于如何在C ++中找到ELF二进制所需的动态库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆