Summary: | Bootstrap failure in libjava against latest git glibc | ||
---|---|---|---|
Product: | gcc | Reporter: | Jakub Jelinek <jakub> |
Component: | bootstrap | Assignee: | Jakub Jelinek <jakub> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | amylaar, aph, christian.joensson, green, hjl.tools, mark, tromey |
Priority: | P1 | ||
Version: | 4.7.0 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2011-11-23 00:00:00 | |
Attachments: | gcc47-pr50888.patch |
Description
Jakub Jelinek
2011-10-27 18:40:05 UTC
This affects 4.6.2 too and most probably 4.5.x too. (In reply to comment #0) > 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. I think that is the best solution, or even only check for a literal space. This code is only used to "parse" properties provided by the GCJ_PROPERTIES environment variable. Which is a gcj extension. It was added in 1999 and it hasn't been changed since then. http://gcc.gnu.org/ml/java-patches/1999-q4/msg00014.html Any opinions Anthony? <antgreen> I don't think isspace() is really needed. We can just check for ' ' and maybe tab. <antgreen> wow - 1999 was a long time ago Recent bootstrap/build on i686/linux libtool: link: /usr/local/src/trunk/objdir/./gcc/gcj -B/usr/local/src/trunk/objdir/i686-redhat-linux/libjava/ -B/usr/local/src/trunk/objdir/./gcc/ -B/usr/i686-redhat-linux/bin/ -B/usr/i686-redhat-linux/lib/ -isystem /usr/i686-redhat-linux/include -isystem /usr/i686-redhat-linux/sys-include -ffloat-store -fomit-frame-pointer -Usun -g -O2 -o .libs/jv-convert --main=gnu.gcj.convert.Convert -shared-libgcc -L/usr/local/src/trunk/objdir/i686-redhat-linux/libjava/.libs -L/usr/local/src/trunk/objdir/i686-redhat-linux/libjava ./.libs/libgcj.so -lpthread -lrt -ldl -lz -Wl,-rpath -Wl,/usr/lib ./.libs/libgcj.so: undefined reference to `__cxa_call_unexpected' collect2: error: ld returned 1 exit status make[3]: *** [jv-convert] Error 1 *** Bug 51177 has been marked as a duplicate of this bug. *** I suppose I don't really object to a workaround in libjava, but surely the sensible thing to do is fix isspace() not to throw. It can't, anyway: that would be in breach of its spec. (In reply to comment #6) > I suppose I don't really object to a workaround in libjava, but surely the > sensible thing to do is fix isspace() not to throw. It can't, anyway: that > would be in breach of its spec. Sorry, forgot about this PR. isspace is actually marked as not throwing, i.e. throw() in C++. In glibc 2.15+ it happens to be implemented as throw() inline function which calls another function (which is throw() too), the problem is that with -fnon-call-exceptions the compiler doesn't know the function pointer is always non-NULL and assumes the call instruction might throw on SIGSEGV/SIGILL etc. That will always work, but the compiler must assume it doesn't always, thus it needs -lsupc++ support with which libjava is not linked. (In reply to comment #7) > isspace is actually marked as not throwing, i.e. throw() in C++. In glibc > 2.15+ it happens to be implemented as throw() inline function which calls > another function (which is throw() too), the problem is that with > -fnon-call-exceptions the compiler doesn't know the function pointer is always > non-NULL and assumes the call instruction might throw on SIGSEGV/SIGILL etc. > That will always work, but the compiler must assume it doesn't always, thus it > needs -lsupc++ support with which libjava is not linked. Thank you, all is now clear. I wonder if it might make sense to fix this in a more general way than simply not calling isspace(). Perhaps we could provide a weak __cxa_call_unexpected, or find some way of persuading g++ not to emit such a call. Created attachment 25901 [details] gcc47-pr50888.patch Untested fix. Checked all locales on my F16 box and in all of them isspace is true only for these 6 characters and nothing else (iswspace accepts various other characters, but isspace works on single bytes only and the other characters are multi-byte. Yes, we could perhaps define __cxa_call_unexpected instead, but we'd really want to make sure it is hidden visibility, in order not to override the libstdc++.so __cxa_call_unexpected. And not all targets support hidden visibility, so it would turn into a portability nightmare. Author: jakub Date: Thu Nov 24 07:18:16 2011 New Revision: 181685 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181685 Log: PR bootstrap/50888 * prims.cc: Don't include ctype.h. (c_isspace): Define. (next_property_key, next_property_value): Use it instead of isspace. Modified: trunk/libjava/ChangeLog trunk/libjava/prims.cc Author: jakub Date: Thu Nov 24 07:21:39 2011 New Revision: 181686 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181686 Log: PR bootstrap/50888 * prims.cc: Don't include ctype.h. (c_isspace): Define. (next_property_key, next_property_value): Use it instead of isspace. Modified: branches/gcc-4_6-branch/libjava/ChangeLog branches/gcc-4_6-branch/libjava/prims.cc Author: jakub Date: Thu Nov 24 07:23:16 2011 New Revision: 181687 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181687 Log: PR bootstrap/50888 * prims.cc: Don't include ctype.h. (c_isspace): Define. (next_property_key, next_property_value): Use it instead of isspace. Modified: branches/gcc-4_5-branch/libjava/ChangeLog branches/gcc-4_5-branch/libjava/prims.cc Author: jakub Date: Thu Nov 24 07:24:43 2011 New Revision: 181688 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181688 Log: PR bootstrap/50888 * prims.cc: Don't include ctype.h. (c_isspace): Define. (next_property_key, next_property_value): Use it instead of isspace. Modified: branches/gcc-4_4-branch/libjava/ChangeLog branches/gcc-4_4-branch/libjava/prims.cc Fixed for 4.4+. Author: xguo Date: Wed Jul 11 06:02:10 2012 New Revision: 189421 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=189421 Log: 2012-07-11 Terry Guo <terry.guo@arm.com> Backport r181685 from mainline 2011-11-24 Jakub Jelinek <jakub@redhat.com> PR bootstrap/50888 * prims.cc: Don't include ctype.h. (c_isspace): Define. (next_property_key, next_property_value): Use it instead of isspace. Added: branches/ARM/embedded-4_6-branch/libjava/ChangeLog.arm Modified: branches/ARM/embedded-4_6-branch/libjava/prims.cc *** Bug 260998 has been marked as a duplicate of this bug. *** Seen from the domain http://volichat.com Page where seen: http://volichat.com/mobile-chat-rooms Marked for reference. Resolved as fixed @bugzilla. |