From owner-freebsd-hackers Sun Apr 18 10:28:58 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from cerebus.nectar.com (nectar-gw.nectar.com [204.0.249.101]) by hub.freebsd.org (Postfix) with ESMTP id 5828614DC1 for ; Sun, 18 Apr 1999 10:28:55 -0700 (PDT) (envelope-from nectar@nectar.com) Received: (from smap@localhost) by cerebus.nectar.com (8.9.1/8.9.1) id MAA62374; Sun, 18 Apr 1999 12:26:23 -0500 (CDT) (envelope-from nectar@nectar.com) Received: from spawn.nectar.com(10.0.0.101) by cerebus.nectar.com via smap (V2.1) id xma062372; Sun, 18 Apr 99 12:25:55 -0500 Received: from spawn.nectar.com (localhost [127.0.0.1]) by spawn.nectar.com (8.9.3/8.9.1) with ESMTP id MAA30234; Sun, 18 Apr 1999 12:24:31 -0500 (CDT) (envelope-from nectar@spawn.nectar.com) Message-Id: <199904181724.MAA30234@spawn.nectar.com> X-Mailer: exmh version 2.0.2 2/24/98 X-Exmh-Isig-CompType: repl X-Exmh-Isig-Folder: mlist/freebsd/hackers X-PGP-RSAfprint: 00 F9 E6 A2 C5 4D 0A 76 26 8B 8B 57 73 D0 DE EE X-PGP-RSAkey: http://www.nectar.com/nectar-rsa.txt X-PGP-DSSfprint: AB2F 8D71 A4F4 467D 352E 8A41 5D79 22E4 71A2 8C73 X-PGP-DHfprint: 2D50 12E5 AB38 60BA AF4B 0778 7242 4460 1C32 F6B1 X-PGP-DH-DSSkey: http://www.nectar.com/nectar-dh-dss.txt From: Jacques Vidrine In-reply-to: <199904181639.JAA20403@vashon.polstra.com> References: <199904181639.JAA20403@vashon.polstra.com> Subject: Re: __attribute__ ((constructor)) functions & shared libs Mime-Version: 1.0 Content-Type: text/plain To: John Polstra Cc: hackers@FreeBSD.ORG Date: Sun, 18 Apr 1999 12:24:31 -0500 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 18 April 1999 at 9:39, John Polstra 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