ldd command
linux의 ldd
명령어(CLI)는 바이너리 파일을 실행할 때 필요한 공유 라이브러리(Shared Library) 의존성을 보여주는 명령어 입니다.
기본 사용법
$> ldd /bin/echo
linux-vdso.so.1 (0x00007ffe83de4000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007f5802b15000)
/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f5802d2d000)
# 라이브러리 의존성과 해당 라이브러리 의존성 보기
$> ldd -v /bin/echo
linux-vdso.so.1 (0x00007fffd26f3000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007f545e813000)
/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f545ea2b000)
Version information:
/bin/echo:
libc.so.6 (GLIBC_2.3) => /usr/lib/libc.so.6
libc.so.6 (GLIBC_2.3.4) => /usr/lib/libc.so.6
libc.so.6 (GLIBC_2.16) => /usr/lib/libc.so.6
libc.so.6 (GLIBC_2.4) => /usr/lib/libc.so.6
libc.so.6 (GLIBC_2.34) => /usr/lib/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /usr/lib/libc.so.6
/usr/lib/libc.so.6:
ld-linux-x86-64.so.2 (GLIBC_2.2.5) => /usr/lib64/ld-linux-x86-64.so.2
ld-linux-x86-64.so.2 (GLIBC_2.3) => /usr/lib64/ld-linux-x86-64.so.2
ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /usr/lib64/ld-linux-x86-64.so.2
ldd help
$> ldd --help
Usage: ldd [OPTION]... FILE...
--help print this help and exit
--version print version information and exit
-d, --data-relocs process data relocations
-r, --function-relocs process data and function relocations
-u, --unused print unused direct dependencies
-v, --verbose print all information
For bug reporting instructions, please see:
<https://bugs.archlinux.org/>.
TLDR
$> tldr ldd
ldd
Display shared library dependencies of a binary.
Do not use on an untrusted binary, use objdump for that instead.
More information: https://manned.org/ldd.
- Display shared library dependencies of a binary:
ldd path/to/binary
- Display all information about dependencies:
ldd --verbose path/to/binary
- Display unused direct dependencies:
ldd --unused path/to/binary
- Report missing data objects and perform data relocations:
ldd --data-relocs path/to/binary
- Report missing data objects and functions, and perform relocations for both:
ldd --function-relocs path/to/binary