Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 01 Feb 1996 17:17:41 EST
From:      Christopher Provenzano  <proven@MIT.EDU>
To:        Peter Wemm <peter@jhome.dialix.com>
Cc:        John Polstra <jdp@polstra.com>, nate@sri.MT.net, CVS-committers@freebsd.org, cvs-lib@freebsd.org, proven@MIT.EDU
Subject:   Re: cvs commit: src/lib/csu/i386 crt0.c 
Message-ID:  <9602012217.AA07409@yaz-pistachio.MIT.EDU>
In-Reply-To: Your message of "Thu, 01 Feb 1996 17:30:23 %2B0800." <199602010930.RAA13154@jhome.DIALix.COM> 

next in thread | previous in thread | raw e-mail | index | archive | help

Since the bootstrapping problem is a basic mess. Might I suggest
using what pthreads has done. Make a c++ constructor in the library
that is called when the program is initialized. It removes the 
problem of having to deal with crt0.o at all. Here is how pthreads
does it.

init.cc

extern "C" void pthread_init (void);

struct __pthread_init_hack_t {
  __pthread_init_hack_t () { pthread_init (); }
};

__pthread_init_hack_t __pthread_init_hack_x;
char __pthread_init_hack = 42;


In any one file that is always linked in with the library eg signal.c

/* This will force init.o to get dragged in; if you've got support for
   C++ initialization, that'll cause pthread_init to be called at
   program startup automatically, so the application won't need to
   call it explicitly.  */

extern char __pthread_init_hack;
char *__pthread_init_hack_2 = &__pthread_init_hack;

CAP



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