From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9874 invoked by alias); 27 Oct 2011 18:40:33 -0000 Received: (qmail 9861 invoked by uid 22791); 27 Oct 2011 18:40:32 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_GC,TW_IB X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 27 Oct 2011 18:40:12 +0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug bootstrap/50888] New: Bootstrap failure in libjava against latest git glibc Date: Thu, 27 Oct 2011 18:40:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: bootstrap X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-10/txt/msg02907.txt.bz2 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++. 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 * 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 #include #define PROCESS_GCJ_PROPERTIES process_gcj_properties() works for me but might be considered too hackish (__NO_CTYPE results in macro says to 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.