From owner-freebsd-hackers Tue Nov 24 00:17:11 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id AAA21594 for freebsd-hackers-outgoing; Tue, 24 Nov 1998 00:17:11 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from cimlogic.com.au (cimlog.lnk.telstra.net [139.130.51.31]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id AAA21575 for ; Tue, 24 Nov 1998 00:17:07 -0800 (PST) (envelope-from jb@cimlogic.com.au) Received: (from jb@localhost) by cimlogic.com.au (8.9.1/8.9.1) id TAA07814; Tue, 24 Nov 1998 19:22:04 +1100 (EST) (envelope-from jb) From: John Birrell Message-Id: <199811240822.TAA07814@cimlogic.com.au> Subject: Re: ELF Global Constructors In-Reply-To: from Jonathan Gapen at "Nov 24, 98 02:02:38 am" To: jagapen@whitewater.chem.wisc.edu (Jonathan Gapen) Date: Tue, 24 Nov 1998 19:22:04 +1100 (EST) Cc: freebsd-hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL40 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Jonathan Gapen wrote: > I'm in the process of porting GNUstep to FreeBSD 3.0, and I've run > into a lack of documentation. Consequently, I don't know where the > problem lies. It's like this: > GNUstep needs to have a function _gnu_process_args() called before > main() to set up information about the process for use by the Foundation > library. On non-Linux ELF systems, it tries this bit of code: > > static void *__gnustep_base_subinit_args__ > __attribute__ ((section ("_libc_subinit"))) = &(_gnu_process_args); > > This is where the lack of documentation is getting me. I can't find > out what *will* work. I don't know if this is the correct way to hook in > a function call before main() and FreeBSD is broken, or egcs is broken, or > if it's the wrong way entirely. > I'm not even sure where to dig into the system source to find out > what's going on, so I'd appreciate any help/pointers. Thanks! For an example of a constructor, have a look at: src/lib/libc_r/uthread/uthread_autoinit.cc This is how a threaded process is initialised prior to the process calling main(). This code works with the in-tree compiler (I haven't used egcs, so I'm not sure about that). -- John Birrell - jb@cimlogic.com.au; jb@freebsd.org http://www.cimlogic.com.au/ CIMlogic Pty Ltd, GPO Box 117A, Melbourne Vic 3001, Australia +61 418 353 137 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message