libgcj build in bootstrap fails on i686-pc-cygwin due to undefined reference
error in boehm-gc library.

libtool: link: /home/LarryR/Build/gcc-4.3.0/gcc/gcj
-B/home/LarryR/Build/gcc-4.3.0/i686-pc-cygwin/libjava/
-B/home/LarryR/Build/gcc-4.3.0/gcc/ -ffloat-store -fomit-frame-pointer -Usun
-march=prescott -pipe -o .libs/jv-convert.exe --main=gnu.gcj.convert.Convert
-shared-libgcc  -L/home/LarryR/Build/gcc-4.3.0/i686-pc-cygwin/libjava/.libs
-L/home/LarryR/Build/gcc-4.3.0/i686-pc-cygwin/libjava ./.libs/libgcj.a -ldl -lz
-L/gcc-4.3.0/lib/gcc/i686-pc-cygwin/4.3.0
./.libs/libgcj.a(lt105-misc.o):misc.c:(.text+0xc10): undefined reference to
`_GC_get_thread_stack_base'
collect2: ld returned 1 exit status

This is caused by the following in "boehm-gc":

in "pthread-support.c" line 60 ...

# if defined(GC_PTHREADS) && !defined(GC_SOLARIS_THREADS) \
     && !defined(GC_WIN32_THREADS)

the functions in "pthread-support.c" are not compiled if GC_WIN32_THREADS is
defined, in particular "GC_get_thread_stack_base()" is not compiled.

in "misc.c" line 677 ...

# if defined(GC_PTHREADS) && ! defined(GC_SOLARIS_THREADS)
/* Use thread_stack_base if available, as GC could be initialized from
   a thread that is not the "main" thread.  */
GC_stackbottom = GC_get_thread_stack_base();
# endif

thus a call to GC_get_thread_stack_base() is generated even though
GC_WIN32_THREADS is defined so that GC_get_thread_stack_base() does not exist,
which breaks the build.

The following patch fixes the problem

--- boehm-gc/misc.c     (revision 130402)
+++ boehm-gc/misc.c     (working copy)
@@ -674,7 +674,7 @@
 #   if !defined(THREADS) || defined(GC_PTHREADS) || defined(GC_WIN32_THREADS)
\
        || defined(GC_SOLARIS_THREADS)
       if (GC_stackbottom == 0) {
-        # if defined(GC_PTHREADS) && ! defined(GC_SOLARIS_THREADS)
+        # if defined(GC_PTHREADS) && ! defined(GC_SOLARIS_THREADS) && !
defined(GC_WIN32_THREADS)
        /* Use thread_stack_base if available, as GC could be initialized from
           a thread that is not the "main" thread.  */
        GC_stackbottom = GC_get_thread_stack_base();


-- 
           Summary: bootstrap fails when libgcj enabled due to undefined
                    reference in libgcjgc (boehm-gc)
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: boehm-gc
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: silver-dad at comcast dot net
 GCC build triplet: i686-pc-cygwin
  GCC host triplet: i686-pc-cygwin
GCC target triplet: i686-pc-cygwin


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34232

Reply via email to