This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug bootstrap/50888] New: Bootstrap failure in libjava against latest git glibc


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

             Bug #: 50888
           Summary: Bootstrap failure in libjava against latest git glibc
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jakub@gcc.gnu.org
                CC: aph@gcc.gnu.org, mark@gcc.gnu.org, tromey@gcc.gnu.org


./.libs/libgcj.so: undefined reference to `__cxa_call_unexpected'
collect2: ld returned 1 exit status
make[3]: *** [jv-convert] Error 1
make[3]: *** Waiting for unfinished jobs....
./.libs/libgcj.so: undefined reference to `__cxa_call_unexpected'
collect2: ld returned 1 exit status
make[3]: *** [gcj-dbtool] Error 1

The problem is that libgcj is compiled with C++ and -fnon-call-exceptions, but
doesn't link against -lstdc++ nor -lsupc++.  <ctype.h> in glibc recently
changed, so that isspace in C++ is now an inline function:
# define __isctype_f(type) \
  __extern_inline int                                                         \
  is##type (int __c) __THROW                                                  \
  {                                                                           \
    return (*__ctype_b_loc ())[(int) (__c)] & (unsigned short int) _IS##type; \
  }
...
__isctype_f (space)

While __ctype_b_loc, a function pointer, has throw () on it, the isspace inline
has it too.  So normally not a problem.  But with -fnon-call-exceptions we end
up with __cxa_call_unexpected call just in case __ctype_b_loc fn pointer would
be invalid (it is not, but gcc doesn't know it).

2011-10-27  Jakub Jelinek  <jakub@redhat.com>

        * prims.cc (__NO_CTYPE): For glibc define this before including
        ctype.h.

--- libjava/prims.cc    2009-04-28 06:02:30.000000000 +0200
+++ libjava/prims.cc    2011-10-27 12:57:42.748752380 +0200
@@ -38,6 +38,14 @@ details.  */
 #endif

 #ifndef DISABLE_GETENV_PROPERTIES
+#ifdef __GLIBC__
+/* glibc 2.15+ provides even for C++ inline optimized ::isspace etc.
+   Unfortunately those inlines are throw (), and call a function pointer
+   (which is throw () too, but with -fnon-call-exceptions this results
+   in a __cxa_call_unexpected call.  This macro disables the optimized
+   version.  */
+#define __NO_CTYPE 1
+#endif
 #include <ctype.h>
 #include <java-props.h>
 #define PROCESS_GCJ_PROPERTIES process_gcj_properties()

works for me but might be considered too hackish (__NO_CTYPE results in macro
says to <ctype.h> it should optimize isspace etc.).

Other alternatives would be to link -lsupc++ in, or replace use of isspace (c)
with memchr (" \t\n\r\v", c, 5) != NULL (the standard POSIX "C" locale isspace
characters), or use safe-ctype, etc.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]