This is the mail archive of the
mailing list for the libstdc++ project.
Re: libstdc++ related boostrap failure
On Fri, Feb 14, 2003 at 12:17:30PM -0500, Phil Edwards wrote:
> On Thu, Feb 13, 2003 at 09:17:04PM -0600, Loren James Rittle wrote:
> > < __gthread_mutex_t _Atomic_add_mutex __attribute__ ((__weak__))
> > < = __GTHREAD_MUTEX_INIT;
> > ---
> > > extern __gthread_mutex_t _Atomic_add_mutex;
> > The non-extern implementation was moved into the library without being
> > exported in the symbol map (i.e. hidden, not available for satisfying
> > the linker).
> That was by design; clearly I don't understand FreeBSD as well as I should.
> This symbol should ("should") only be needed by other routines within the
> library, not outside it. Namely, the two routines in atomicity.h. I'm
> confused as to why bits/gthr-default.h is showing the undefined reference.
New theory occurred to me in the middle of writing an email to Loren on
this subject. The routine in atomicity.h which references the variable
is marked 'inline'. Anywhere it actually gets inlined will also create
a reference to the variable.
The choice is either
A) export _Atomic_add_mutex from the library, like Loren's patch did, or
B) for the generic case, move the definition of the atomic routines to
misc-inst.cc, along with the helper variables. This makes everything
nice and tidy and private, but kills any chance of inlining.
I tend to lean to 'A'.
I would therefore like to posit that computing's central challenge, viz. "How
not to make a mess of it," has /not/ been met.
- Edsger Dijkstra, 1930-2002