This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: [Bug libgcj/13212] JNI/CNI AttachCurrentThread does not register thread with garbage collector
- From: Richard Guenther <rguenther at suse dot de>
- To: java at gcc dot gnu dot org
- Date: Sat, 25 Mar 2006 17:34:11 +0100 (CET)
- Subject: Re: [Bug libgcj/13212] JNI/CNI AttachCurrentThread does not register thread with garbage collector
- References: <bug-13212-7355@http.gcc.gnu.org/bugzilla/> <20060324174125.7739.qmail@sourceware.org> <Pine.LNX.4.64.0603250013471.3982@t148.fhfr.qr>
On Sat, 25 Mar 2006, Richard Guenther wrote:
> On Fri, 24 Mar 2006, aph at gcc dot gnu dot org wrote:
> > ------- Comment #28 from aph at gcc dot gnu dot org 2006-03-24 17:41 -------
> > Richard Guenther: should this be posted to java@gcc.gnu.org for discussion?
> >
> > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13212
>
> Hmm, I guess so. Me and Michael Matz have tried to somehow work around
> the gjc GC issues with OpenOffice which does open libgcj via dlopen and
> such suffers from the thread registration problem. On the 4.1 branch
> there is the workaround to have libgcj provide pthread_create which should
> in theory override libpthread.so pthread_create. This works only if
> you link against libgcj, not if you later dlopen it, because you then
> bound to say pthread_create@GLIBC_2.1. To work around this issue we made
> libgcj provide pthread_create with the same symver as glibc does. This
> exposes another issue, namely boehm GC being configured with
> GC_all_interior_pointers set to 1 by default - which causes GC_bl_init
> to not initialize GC_old_normal_bl and others. libgcj unfortunately
> sets GC_all_interior_pointers to 0 at init time, which then causes the
> uninitialized GC_old_normal_bl to be used and we segfault. To work around
> this we changed boehm to default to GC_all_interior_pointers 0 instead.
>
> Now, while this seems to solve the OpenOffice problems if you LD_PRELOAD
> libgcj, the change seems to cause libjava testsuite failures (which we
> didn't yet investigate):
Michael just noticed I messed up during cleaning up the patch:
> Index: boehm-gc/pthread_support.c
> ===================================================================
> *** boehm-gc/pthread_support.c (revision 112314)
> --- boehm-gc/pthread_support.c (working copy)
> *************** constr (void)
> *** 1231,1237 ****
>
>
> int
> ! GC_PTHREAD_CREATE_NAME(pthread_t *new_thread,
> const pthread_attr_t *attr,
> void *(*start_routine)(void *), void *arg)
> {
> --- 1231,1237 ----
>
>
> int
> ! GC_pthread_create (pthread_t *new_thread,
> const pthread_attr_t *attr,
> void *(*start_routine)(void *), void *arg)
> {
> *************** GC_PTHREAD_CREATE_NAME(pthread_t *new_th
> *** 1308,1313 ****
> --- 1308,1315 ----
> return(result);
> }
>
> + __asm__ (".symver pthread_create, pthread_create@@" GC_PTHREAD_SYM_VERSION);
> +
> #ifdef GENERIC_COMPARE_AND_SWAP
> pthread_mutex_t GC_compare_and_swap_lock = PTHREAD_MUTEX_INITIALIZER;
>
Should read
__asm__ (".symver GC_pthread_create, pthread_create@@" GC_PTHREAD_SYM_VERSION);
This way libjava tests fine.
Richard.