1
$ file /lib/ld-linux.so.2
/lib/ld-linux.so.2: symbolic link to i386-linux-gnu/ld-2.27.so
$ readlink -f /lib/ld-linux.so.2
/lib/i386-linux-gnu/ld-2.27.so
$ file /lib/i386-linux-gnu/ld-2.27.so
/lib/i386-linux-gnu/ld-2.27.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=7a59ed1836f27b66ffd391d656da6435055f02f8, stripped

So is ld-2.27.so a shared library?

It is said to be a dynamic linker/loader and mentioned in section 8 of man. So is it an executable?

If yes, why is it named like a shared library as *.so?

If no, how shall I understand it is like an executable, for being a dynamic linker/loader and mentioned in section 8 of man?

Thanks.

5

It is both, which is perfectly valid.

The ld.so-style naming scheme is largely historical; the first dynamic linker in this style was SunOS 4’s, which was named ld.so (I have its history somewhere, I’ll clarify this once I’ve found it). But there are valid reasons for it to be named like a shared library rather than an executable, including:

  • it exists to serve executables, like shared libraries (it has no purpose without executables to run);
  • it is a shared ELF object, but it doesn’t require an interpreter (it has no .interp entry); this is typical of libraries (shared executables always require an interpreter; otherwise they’re static, not dynamic).

The distinction between executables and libraries is somewhat fluid in ELF; any ELF object with an entry point can be an executable, regardless of its other properties.

  • Did you happen to find that naming history? – ilkkachu Jul 11 '18 at 12:02
  • @ilkkachu not yet... – Stephen Kitt Jul 11 '18 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.