Non-executable shared objects work fine, but libraries marked executable may also be runnable as standalone programs.
So, what's the point of setting this x?
None, unless you want them to emit version or other info
Must all library packagers do that?
No
What will happen if I dlopen() a shared library that has 0644
permissions?
You'll get a new shared object handle (so long as the file is readable etc.) ... the exec bit doesn't affect this
As to why libraries which aren't usable as standalone executables still have the exec bit set: this is probably just an artefact of the build system or link script used.
example output, just for reference:
$ /lib/i386-linux-gnu/libc.so.6
GNU C Library (Ubuntu EGLIBC 2.15-0ubuntu10) stable release version 2.15, by Roland McGrath et al.
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.6.3.
Compiled on a Linux 3.2.14 system on 2012-04-19.
Available extensions:
crypt add-on version 2.1 by Michael Glad and others
GNU Libidn by Simon Josefsson
Native POSIX Threads Library by Ulrich Drepper et al
BIND-8.2.3-T5B
libc ABIs: UNIQUE IFUNC
For bug reporting instructions, please see:
<http://www.debian.org/Bugs/>.
/lib
and/usr/lib
are libc and libpthread, and both print a copyright notice when executed.main()
symbol as an entry point is not a minor bug, but a fundamental design choice. You missed my point.