[patch] Fix oddity in personality routine

Jack Howarth howarth@bromo.med.uc.edu
Sat Dec 5 04:37:00 GMT 2009


On Fri, Dec 04, 2009 at 03:57:11PM +0000, Bryce McKinlay wrote:
> On Fri, Dec 4, 2009 at 3:48 PM, Andrew Haley <aph@redhat.com> wrote:
> 
> > Yes, which is why I suggested you use SYSTEMSPEC.  (Twice now, I think.  :-)
> >
> > SYSTEMSPEC should pass that flag to everything liked with gcj.
> 
> Jack,
> 
> Here's a patch that adds the allow_stack_execute flag to SYSTEMSPEC as
> suggested by Andrew.
> 
> It does not fix the problem with ecj, but I agree it's a good idea.
> 
> Bryce

Bryce,
   Your proposed patch builds libjava normally on x86_64-apple-darwin10
and I now see...

#
# This spec file is read by gcj when linking.
# It is used to specify the standard libraries we need in order
# to link with libgcj.
#
%rename startfile startfileorig
*startfile:  %(startfileorig)

%rename lib liborig
*lib:  %{s-bc-abi:} -lgcj  -lm -L/sw/lib -liconv  -lpthread -lz -allow_stack_execute  -ldl %(libgcc)  %(liborig)

*jc1: -fhash-synchronization -fuse-divide-subroutine -fcheck-references -fuse-boehm-gc -fnon-call-exceptions     -fkeep-inline-functions

in /sw/lib/gcc4.5/lib/gcc/x86_64-apple-darwin10.2.0/4.5.0/../../../libgcj.spec instead of...

#
# This spec file is read by gcj when linking.
# It is used to specify the standard libraries we need in order
# to link with libgcj.
#
%rename startfile startfileorig
*startfile:  %(startfileorig)

%rename lib liborig
*lib:  %{s-bc-abi:} -lgcj  -lm -L/sw/lib -liconv  -lpthread -lz   -ldl %(libgcc)  %(liborig)

*jc1: -fhash-synchronization -fuse-divide-subroutine -fcheck-references -fuse-boehm-gc -fnon-call-exceptions     -fkeep-inline-functions

Linking with gcj -v also reveals that -allow_stack_execute is being passed to collect2
as expected. Can we get this in to gcc trunk as an obvious change?
                      Jack
ps Gcj still crashes compiling java as I saw yesterday with the alternative approach to passing -stack_allow_execute...

[MacPro:~] howarth% gdb /sw/lib/gcc4.5/libexec/gcc/x86_64-apple-darwin10.2.0/4.5.0/ecj1
GNU gdb 6.3.50-20050815 (Apple version gdb-1346) (Fri Sep 18 20:40:51 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ...... done

warning: Could not find object file "/var/tmp//cckmtKiq.o" - no debug information available for "/var/tmp//cc4vWuF2.i".


(gdb) break ../../../gcc-4.5-20091204/libjava/gnu/classpath/natVMStackWalker.cc:104
Breakpoint 1 at 0x20c49ba4ad2864: file ../../../gcc-4.5-20091204/libjava/gnu/classpath/natVMStackWalker.cc, line 104.
Breakpoint 2 at 0x20c49ba4ad28a0: file ../../../gcc-4.5-20091204/libjava/gnu/classpath/natVMStackWalker.cc, line 104.
warning: Multiple breakpoints were set.
Use the "delete" command to delete unwanted breakpoints.
(gdb) r testme.java -fbootclasspath=/sw/share/java/ecj/ecj.jar:./:/sw/share/xtal/ccp4-6.1.2/bin/:/sw/lib/gcc4.5/share/java/libgcj-4.5.0.jar -fsource=1.5 -ftarget=1.5 -fzip-dependency /var/folders/1C/1CdoNxmNFHyOIjNBLNuJh++++TM/-Tmp-//ccf5cqZS.zip -fzip-target /var/folders/1C/1CdoNxmNFHyOIjNBLNuJh++++TM/-Tmp-//ccK4ZxH8.jar
Starting program: /sw/lib/gcc4.5/libexec/gcc/x86_64-apple-darwin10.2.0/4.5.0/ecj1 testme.java -fbootclasspath=/sw/share/java/ecj/ecj.jar:./:/sw/share/xtal/ccp4-6.1.2/bin/:/sw/lib/gcc4.5/share/java/libgcj-4.5.0.jar -fsource=1.5 -ftarget=1.5 -fzip-dependency /var/folders/1C/1CdoNxmNFHyOIjNBLNuJh++++TM/-Tmp-//ccf5cqZS.zip -fzip-target /var/folders/1C/1CdoNxmNFHyOIjNBLNuJh++++TM/-Tmp-//ccK4ZxH8.jar
Reading symbols for shared libraries +++++. done

Breakpoint 1, gnu::classpath::VMStackWalker::getCallingClassLoader (pc=0x10098d774) at ../../../gcc-4.5-20091204/libjava/gnu/classpath/natVMStackWalker.cc:104
104	  jclass klass = GET_CALLING_CLASS(pc);
(gdb) s
Current language:  auto; currently c++
0x0000000100994db2 in dyld_stub__Unwind_FindEnclosingFunction ()
(gdb) s
Single stepping until exit from function dyld_stub__Unwind_FindEnclosingFunction, 
which has no line number information.
0x00007fff844bffc0 in _Unwind_FindEnclosingFunction ()
(gdb) s
Single stepping until exit from function _Unwind_FindEnclosingFunction, 
which has no line number information.

Program received signal SIGABRT, Aborted.
0x00007fff843d4fe6 in __kill ()
(gdb) 

I'll repeat this build on x86_64-apple-darwin9 tomorrow to verify that in both darwin9 and
darwin10 (with the proper passing of -allow_stack_execute) that the crash has moved to the
same location and update the PR. Thanks again for the patch.
                Jack
ps After I verify that stock gcc trunk behaves the same under darwin9 with the above patch,
I'll rebuild gcc trunk with the libgcc_ext changes regressed out to verify that the FSF libgcc
and the system libgcc unwinder are both failing in the same manner on darwin9. This will also
allow me to walk the unwinder (as unfortunately Apple's libgcc and libSystem unwinders don't
ship with debug code...sigh). 



More information about the Java mailing list