From patchwork Wed Nov 23 20:38:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 127385 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 337451007D7 for ; Thu, 24 Nov 2011 07:38:35 +1100 (EST) Received: (qmail 16916 invoked by alias); 23 Nov 2011 20:38:34 -0000 Received: (qmail 16906 invoked by uid 22791); 23 Nov 2011 20:38:33 -0000 X-SWARE-Spam-Status: No, hits=-7.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, SPF_HELO_PASS, TW_GC, TW_IB X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 23 Nov 2011 20:38:15 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pANKcFjJ032339 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 23 Nov 2011 15:38:15 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id pANKcEvM032581 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 23 Nov 2011 15:38:14 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id pANKcEkH012610; Wed, 23 Nov 2011 21:38:14 +0100 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id pANKcDdm012608; Wed, 23 Nov 2011 21:38:13 +0100 Date: Wed, 23 Nov 2011 21:38:13 +0100 From: Jakub Jelinek To: Andrew Haley , Tom Tromey , Mark Wielaard Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix libjava build on current git glibc (PR bootstrap/50888) Message-ID: <20111123203813.GE27242@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi! As discussed in the PR, libjava fails to build against latest glibc, because prims.cc is compiled with -fnon-call-exceptions, uses ctype.h and libgcj isn't linked against -lsupc++ or -lstdc++. isspace in latest glibc is a throw() inline that calls a throw() function pointer. Unfortunately, with -fnon-call-exceptions the compiler doesn't have a guarantee that the function pointer that is being called is always valid (it is in glibc) and thus adds a __cxa_call_unexpected call if the call would throw and that symbol isn't satisfied during linking of libgcj and apps against it. In all locales on my box isspace is equivalent to POSIX locale isspace (while iswspace is true also for various other characters, they are always multi-byte and thus isspace which works on single byte only isn't true for them), so this patch effectively makes no difference in libgcj behavior. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk/4.6? 2011-11-23 Jakub Jelinek PR bootstrap/50888 * prims.cc: Don't include ctype.h. (c_isspace): Define. (next_property_key, next_property_value): Use it instead of isspace. Jakub --- libjava/prims.cc.jj 2009-05-04 16:46:48.000000000 +0200 +++ libjava/prims.cc 2011-11-23 13:56:34.067198033 +0100 @@ -38,7 +38,6 @@ details. */ #endif #ifndef DISABLE_GETENV_PROPERTIES -#include #include #define PROCESS_GCJ_PROPERTIES process_gcj_properties() #else @@ -985,6 +984,8 @@ static java::lang::Thread *main_thread; #ifndef DISABLE_GETENV_PROPERTIES +#define c_isspace(c) (memchr (" \t\n\r\v\f", c, 6) != NULL) + static char * next_property_key (char *s, size_t *length) { @@ -993,7 +994,7 @@ next_property_key (char *s, size_t *leng JvAssert (s); // Skip over whitespace - while (isspace (*s)) + while (c_isspace (*s)) s++; // If we've reached the end, return NULL. Also return NULL if for @@ -1005,7 +1006,7 @@ next_property_key (char *s, size_t *leng // Determine the length of the property key. while (s[l] != 0 - && ! isspace (s[l]) + && ! c_isspace (s[l]) && s[l] != ':' && s[l] != '=') { @@ -1027,19 +1028,19 @@ next_property_value (char *s, size_t *le JvAssert (s); - while (isspace (*s)) + while (c_isspace (*s)) s++; if (*s == ':' || *s == '=') s++; - while (isspace (*s)) + while (c_isspace (*s)) s++; // Determine the length of the property value. while (s[l] != 0 - && ! isspace (s[l]) + && ! c_isspace (s[l]) && s[l] != ':' && s[l] != '=') {