This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: to exec a shared object
- From: Ian Lance Taylor <ian at wasabisystems dot com>
- To: Henry Thor Baldursson <henry at f-prot dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: 10 May 2004 13:12:43 -0400
- Subject: Re: to exec a shared object
- References: <1084196124.2924.154.camel@henry.frisk-software.com>
Henry Thor Baldursson <henry@f-prot.com> writes:
> I am running gcc 3.2.2, and I'm wondering why shared objects that are
> linked with -shared (binutils 2.13), aren't linked with libc, and don't
> have an interpreter defined, still have some bogus entrypoint? And why
> the ".init" code seems to try and call this bogus entrypoint also. The
> entry points to the same address as the .text section.
This does not seem like a gcc question. It sounds like a binutils or
glibc question. I recommend a different mailing list for any
followups.
You imply that your operating system is GNU/Linux. GNU/Linux does
permit executing shared libraries. But as far as I know it does not
require executing them. If you don't like the results of executing a
shared library, then don't execute it.
When you use a shared library, either by linking against it or by
calling dlopen, the dynamic linker will normally look for a DT_INIT
dynamic tag, and call the function at that address. The GNU/Linux
runtime linker will normally set DT_INIT to the symbol '_init'; this
behaviour is for compatibility with SVR4 linkers. You can change the
magic symbol name using the -init option.
Ian