Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Apr 1999 12:24:31 -0500
From:      Jacques Vidrine <n@nectar.com>
To:        John Polstra <jdp@polstra.com>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: __attribute__ ((constructor)) functions & shared libs 
Message-ID:  <199904181724.MAA30234@spawn.nectar.com>
In-Reply-To: <199904181639.JAA20403@vashon.polstra.com> 
References:  <199904181639.JAA20403@vashon.polstra.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 18 April 1999 at 9:39, John Polstra <jdp@polstra.com> wrote:
> Which version/date of FreeBSD?

Tested on 3.1-STABLE circa Apr 12
 
> If it's ELF, the dynamic linker runs before crt1 gets control.  The
> kernel invokes the dynamic linker directly.  After it has finished
> its job, the dynamic linker transfers control to the main program's
> entry point.

Where can I find this code (which invokes the dynamic linker)?  
A backtrace from the debugger showed _rtld -> _init -> do_ctors ->
libfoo_init, but I'm not sure where to find _rtld() and _init().

> You are not officially "allowed" to assume that anything is already
> initialized in those constructor/destructor functions.  Not even
> printf is really guaranteed to work.  But perhaps we can make some
> simple changes so that most things will work despite that.

I hope so.  This code does some fairly heavy duty stuff during
initialization, including XOpenDisplay!  It apparently works on some
versions of OSF/1, HP/UX, AIX, SCO, IRIX, Solaris, SunOS, and Linux.
I have a hunch it would work on a FreeBSD a.out system, though I 
haven't tested this.

Jacques Vidrine / n@nectar.com / nectar@FreeBSD.org


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199904181724.MAA30234>