Mailing List Archive

Why are *.so library files executable?
Gentoo users tend to be technically adept, so I'll ask the question here:

Why are *.so files set as executables? I noticed that they keep working
if I do a "chmod a-x" on them.
Re: Why are *.so library files executable? [ In reply to ]
On Sun, 2011-06-05 at 17:43 +0300, Nikos Chantziaras wrote:
> Gentoo users tend to be technically adept, so I'll ask the question here:
>
> Why are *.so files set as executables? I noticed that they keep working
> if I do a "chmod a-x" on them.

Well, they are "executables" in that they are object code that are
(loaded and) executed.

In the olden days (pre libc6?) believe it was required form them to be
both executable and by whoever wanted to run (load) them. It's probably
still a requirement for other *nix systems.
Re: Why are *.so library files executable? [ In reply to ]
On 5 June 2011 15:43, Nikos Chantziaras <realnc@arcor.de> wrote:
> Why are *.so files set as executables?  I noticed that they keep working if
> I do a "chmod a-x" on them.

You can in fact make a library be an executable at the same time, see:
/lib/libc.so.6

For those that care if can be accomplished by this method:
http://gcc.gnu.org/ml/gcc-help/2003-07/msg00232.html.

By rights shared libraries are a form of executable, the trick however
is that they have multiple entry points (whereas binaries have one).

I am not entirely sure the requirement for +x is needed anymore (it
certainly was in the past).

Thanks
Mark