Sample Header Ad - 728x90

Why does ldd behave differently on the ldconfig binary?

1 vote
0 answers
97 views
When we run ldd on some file, there are two possible results: If the file is dynamic executable, the shared dependencies are shown, for example:
# ldd /usr/bin/sleep
        linux-vdso.so.1 (0x00007ffff7fc7000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007ffff7dd6000)
        /lib64/ld-linux-x86-64.so.2 (0x00007ffff7fc9000)
Or, if the file is either a static executable or not an executable at all, we see not a dynamic executable, for example
# ldd /usr/bin/toybox
        not a dynamic executable
# ldd /etc/shadow
warning: you do not have execution permission...
        not a dynamic executable
But I have also discovered a special case! It takes place if you ever happen to invoke ldd on /usr/sbin/ldconfig. Then, ldd will **explicitly** say that the binary is statically linked!
# ldd /usr/sbin/ldconfig
        statically linked
I'm very interested to know why this happens, what's so special about the ldconfig binary? Thanks.
Asked by melonfsck - she her (150 rep)
Aug 26, 2024, 05:52 PM