标签云

微信群

扫码加入我们

WeChat QR Code

I'd like to know which libraries are used by executables on my system. More specifically, I'd like to rank which libraries are used the most, along with the binaries that use them. How can I do this?


You will probably not be able to get an exact number if the executables use dlopen.

2019年06月25日23分33秒

This is a great answer (I've up-voted it) but can you explain the "grep -P '\t.*so'" command? According to man, this interprets the pattern as a perl regexp, but my version of grep doesn't support it (man indicates this is a general issue). What bit of the regexp is perl-specific?

2019年06月26日23分33秒

I think you may need to use ldd -v

2019年06月25日23分33秒

Be aware that ldd actually runs the executable with a special environment variable, and the Linux dynamic linker recognizes this flag and just outputs the libraries rather than running the executable. Look at the source to ldd; on my system, it's a bash script. If the executable is statically linked and uses syscalls, and specifies a different loader, it can do arbitrary evil things. So don't use ldd on an executable you don't trust.

2019年06月25日23分33秒

This should be safe too, unlike ldd which shouldn't be used on untrusted executables.

2019年06月26日23分33秒

Also, obbjdump -p shows additional information like the RPATH, which may be of help when investigating dynamic linking issues with your executable.

2019年06月26日23分33秒

Used this to find out if mariadb was actually using tc-malloc, which gets loaded by LD_PRELOAD. Works great.

2019年06月25日23分33秒

I was looking for something that would show me '.so' for a given pid. This is exactly what I needed. Thanks!

2019年06月25日23分33秒

objdump is nice one and thanks for that.. +1

2019年06月25日23分33秒

Of course there is lsof on OS X.

2019年06月25日23分33秒

Bingo! Exactly what I needed - thanks!

2019年06月25日23分33秒