On redhat most of the systemd started services are implemented as shared objects. Why is this the case?
For instance:
file /usr/sbin/sshd
file /usr/sbin/squid
file /usr/sbin/crond
file /usr/sbin/rsyslogd
The output for all these daemons is ELF 64-bit LSB shared object, x86-64. I can understand why systemd itself is implemented as a shared object. When Kernel loads it there are no other shared objects/executables in user space. So very likely systemd is full of direct system call instead of going through libc.
However what is the reason for the daemons listed above to be implemented as shared objects instead of executables?
shared objectsandexecutableshave machine code in them. However, there is a distinction between the two. Theshared objectscode is a library of several functions that are shared among multiple executables. – sshekhar1980 Nov 25 '16 at 17:21libc.so.6... Basically an ELF dynamically-linked executable is a shared object with a program header, andfiledoesn't look at that. This LWN article has more detail. Check outldd systemd, you'll see it useslibcjust like the other daemons you're asking about... – Stephen Kitt Nov 25 '16 at 18:59