Date: Tue, 24 Nov 1998 19:22:04 +1100 (EST) From: John Birrell <jb@cimlogic.com.au> To: jagapen@whitewater.chem.wisc.edu (Jonathan Gapen) Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: ELF Global Constructors Message-ID: <199811240822.TAA07814@cimlogic.com.au> In-Reply-To: <Pine.NXT.4.05.9811190119410.973-100000@swamp> from Jonathan Gapen at "Nov 24, 98 02:02:38 am"
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199811240822.TAA07814>
