Is ld.so an executable?

$ 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.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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, or rather dynamically-linked, executables always require an interpreter; otherwise they’re statically-linked).

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


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x