This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: to exec a shared object


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]