how to select target thread model in libstdc++-v3
Loren James Rittle
rittle@latour.rsch.comm.mot.com
Mon Jun 18 06:03:00 GMT 2001
In article < 3B2B85B4.6C135163@OARcorp.com >,
Joel Sherrill <joel.sherrill@OARcorp.com> writes:
>> > In the 0527 gcc 3.0 snapshot, we used this patch to give RTEMS posix
>> > threads:
>> [...]
>> > What magic needs to happen now?
> We have a gthr-rtems.h included in the distribution so that much is OK.
> So we need to default *-rtems to using that file and address what I
> guess is a change in the abstraction interface which cause this error:
No, according to my study of the history of gcc/gthr.h, the interface
has been stable since at least 1997/12/24. gcc/gthr-rtems.h wasn't
checked in until 2000/12/07. My assessment is that gcc/gthr-rtems.h
has been slightly deficient on this point since it was checked in.
That said, it is still too bad that we didn't catch that both
gcc/gthr-rtems.h and gthr-vxworks.h are missing a required gthr.h
entry point before installing a final patch to the STL threading work.
> All *-rtems targets which can get this far building fail at this point.
> What do we need to add/address/fix?
Excellent, this is a very simple failure. To fix it, you need to read
the comment in gcc/gthr.h:
> Also it has define function int __gthread_active_p () that returns 1
> if thread system is active, 0 if not.
Some concrete implementations of gthr.h arrange so that
__gthread_active_p () returns 1 only when a weak symbol from the
system's threading library has a non-zero value. Other
implementations always return 1 (or 0 in the case of gthr-single.h).
To wit:
static inline int
__gthread_active_p (void)
{
return 1;
}
If RTEMS supports POSIX threads via the standard pthread.h header,
then you might also try explicitly configuring with
--enable-threads=posix. If that works with recent RTEMS but not
older versions, then you might want to mirror the way the solaris
port selects a threading abstraction layer based on whether
various system headers are found.
Please try adding the function above to your copy of gthr-rtems.h and
restart the bootstrap. If that gets you going, then an official patch
to gthr-rtems.h should be submitted.
Although deficient in a similar manner, a patch for gthr-vxworks.h is
not needed since they get a slightly different code path in stl_threads.h
Regards,
Loren
More information about the Gcc-bugs
mailing list