Re: Libraries are *not* executable, correct?
- From: Robert Heller <heller@xxxxxxxxxxxx>
- Date: Tue, 29 Apr 2008 21:26:01 -0500
At Tue, 29 Apr 2008 18:42:31 -0700 (PDT) Ramon F Herrera <ramon@xxxxxxxxxxx> wrote:
Why do people set the executable bit in libraries?
I thought they were just ignorant/careless, but I was just reading
some Adobe documentation:
-----------------------------------------------------------------------------------------------------
UNIX:
Before you can compile the samples, you must point the makefiles to
your gcc 3.2 or VisualAge XL 6.0 compiler. Make sure the permissions
on all libraries are set so that the dynamic loader can find and load
the libraries.
chmod o+x libraryname
-----------------------------------------------------------------------------------------------------
I just checked in a Linux server and most *.a libraries do not have
the execute bits set, but most *.so files have it.
What's the story with this?
*Shared* libraries are handled by the same image load/vm mapping code
that executables are. They are in fact a *kind* of executable in a
sense. Some operating systems (VAX/VMS comes to mind) use the same
extension for shared libraries as executables. Yes, you cannot execute
a .so file on its own. Setting the execute bit gives the *permission*
the image load and VM mapping code needs to do what it needs to do to
load and map the shared library into virtual memory so it can be used as
part of a running program/process.
Static libraries (.a on most UNIX systems), are only handled by the
static linker (ld). They are actually a kind of archive (an 'ar' type
archive, not unlike a tar file or a zip file or even a jar file, at
least conceptually), with object files as archive elements, which are
extacted and copied to the constructed executable file.
-Ramon
--
Robert Heller -- Get the Deepwoods Software FireFox Toolbar!
Deepwoods Software -- Linux Installation and Administration
http://www.deepsoft.com/ -- Web Hosting, with CGI and Database
heller@xxxxxxxxxxxx -- Contract Programming: C/C++, Tcl/Tk
.
- Follow-Ups:
- Re: Libraries are *not* executable, correct?
- From: Keith Keller
- Re: Libraries are *not* executable, correct?
- From: Darren Salt
- Re: Libraries are *not* executable, correct?
- References:
- Libraries are *not* executable, correct?
- From: Ramon F Herrera
- Libraries are *not* executable, correct?
- Prev by Date: Re: Market for SMB Linux consultants?
- Next by Date: Re: Libraries are *not* executable, correct?
- Previous by thread: Libraries are *not* executable, correct?
- Next by thread: Re: Libraries are *not* executable, correct?
- Index(es):
Relevant Pages
|