ldd在动态链接的二进制文件上不起作用 [英] ldd doesn't work on dynamically linked binary

查看:612
本文介绍了ldd在动态链接的二进制文件上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用一堆.so文件的二进制文件.

I have a binary that uses a bunch of .so files.

bash-3.00$ file foo
foo: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.21, dynamically linked (uses shared libs), not stripped

但是,如果我在此文件上运行ldd,则它无法获取二进制文件所依赖的.so文件.'

But if I run ldd on this file, its not able to pick up the .so files the binary is dependent on.'

bash-3.00$ ldd foo
        not a dynamic executable
bash-3.00$

readelf确实显示了二进制文件使用的共享库的列表.

readelf does show the list of shared libraries used by the binary..

bash-3.00$ readelf -d  foo
Dynamic segment at offset 0x17c810 contains 70 entries:

  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libdl.so.2]

在这种情况下,为什么ldd无法拾取库依赖项?

Why is ldd not able to pick up the library dependencies in this case ?

推荐答案

就像评论中的一个一样-您尝试在64位系统上使用ldd来检查32位ELF对象. ldd使用标准的动态链接器跟踪依赖关系,因此,如果您的平台没有被检查的ELF对象所需的链接器,则ldd会失败. 在这些情况下,Readelf和objdump更加强大.

Like one of the comment says - you tried using ldd on 64 bit system to inspect a 32-bit ELF object. ldd uses the standard dynamic linker to trace the dependencies, so if your platform doesn't have the linker required by the ELF object being inspected, ldd fails. Readelf and objdump are more robust in these situations.

这篇关于ldd在动态链接的二进制文件上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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