libgcj/1440: Linux/PPC segfault in GC_mark_from_mark_stack that kills app

khendricks@ivey.uwo.ca khendricks@ivey.uwo.ca
Wed Dec 20 12:27:00 GMT 2000


>Number:         1440
>Category:       libgcj
>Synopsis:       Linux/PPC segfault in GC_mark_from_mark_stack that kills app
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    tromey
>State:          feedback
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 20 12:19:52 PST 2000
>Closed-Date:    
>Last-Modified:  Thu Nov  4 13:50:00 PST 1999
>Originator:     Kevin B. Hendricks
>Release:        libgcj 2.95.1
>Organization:
>Environment:
Linux/PPC, gcc 2.95.1, libgcj 2.95.1, glibc 2.1.1, 2.2.12 kernel 
>Description:
Segfault in GC_mark_from_mark_stack when running compiled (native) 
HelloWorld.  

Note gcj -C works fine to compile java source
to class files.  

But when used with main= to compile to native
even simple programs seg-fault in GC_mark_from_mark_stack in mark.c in boehm_gc.
>How-To-Repeat:
gcj -g --main=HelloWorld HelloWorld.java
a.out
>Fix:
Unknown, gdb does not work well enough with shared libs
under powerpc to pinpoint the exact cause of error.

>Release-Note:

>Audit-Trail:

Formerly PR libgcj/60

Responsible-Changed-From-To: apbianco->tromey
Responsible-Changed-By: apbianco
Responsible-Changed-When: Mon Oct  4 09:20:44 1999
Responsible-Changed-Why:
    A segfault in GC code looks right into Tom's jurisdiction.

From: Tom Tromey <tromey@cygnus.com>
To: "Kevin B. Hendricks" <khendricks@ivey.uwo.ca>
Cc: apbianco@cygnus.com, green@cygnus.com, tromey@cygnus.com,
        Java Gnats Server <java-gnats@sourceware.cygnus.com>
Subject: Re: libgcj/60
Date: Thu, 7 Oct 1999 23:39:02 -0700

 >>>>> "Kevin" == Kevin B Hendricks <khendricks@ivey.uwo.ca> writes:
 
 Kevin> So the problem has something to do with how the gcj library is
 Kevin> being linked into the final executable.  Possibly LD_BIND_NOW
 Kevin> might help.  I will check this.
 
 Did you ever find out?
 
 I haven't looked at this bug at all yet.  I won't be able to for a
 little while yet, either.
 
 It's possible that this is a GC bug that is fixed in the current
 version of the GC.  It might be worthwhile trying the new GC, or at
 least reading the change log to see if the Linux PPC port has been
 changed.
 
 Importing the new GC has been on my to-do list a long, long time, but
 that's another task that won't reach the top for a while :-(
 
 Tom
 

From: Kevin_Hendricks <khendricks@admin.ivey.uwo.ca>
To: khendricks@ivey.uwo.ca, tromey@cygnus.com
Cc: apbianco@cygnus.com, green@cygnus.com, tromey@cygnus.com, 
    java-gnats@sourceware.cygnus.com
Subject: Re: libgcj/60
Date: Fri, 8 Oct 1999 08:49:10 -0400 (EDT)

 Hi Tom,
 
 >Kevin> So the problem has something to do with how the gcj library is
 >Kevin> being linked into the final executable.  Possibly LD_BIND_NOW
 >Kevin> might help.  I will check this.
 >
 >Did you ever find out?
 
 No, it doesn't help. I tried changing RTLD_LAZY to RTLD_NOW in the dynamic 
 library loading code in boehm-gc. I also tried exporting LD_BIND_NOW=true and 
 that did not help.
 
 I then upgraded to glibc 2.1.2 from glibc 2.1.1 and that didn't help.
 
 The only way I can get things to work is to use -static with gcj and then 
 everything seems to work fine.  So whatever the gc is doing works well when 
 statically linked into the executable but dies when the gc code is loaded from a 
 shared library (or other shared libraries are loaded?).
 
 >I haven't looked at this bug at all yet.  I won't be able to for a
 >little while yet, either.
 >
 >It's possible that this is a GC bug that is fixed in the current
 >version of the GC.  It might be worthwhile trying the new GC, or at
 >least reading the change log to see if the Linux PPC port has been
 >changed.
 
 Where would I find the new GC code?  Would snapshots have it?  Is there a public 
 source tree?
 
 Thanks,
 
 Kevin
 
 --
 Kevin B. Hendricks
 Associate Professor of Operations and Information Technology
 Richard Ivey School of Business, University of Western Ontario
 London, Ontario  N6A-3K7  CANADA   
 khendricks@ivey.uwo.ca, (519) 661-3874, fax: 519-661-3959
 

From: Tom Tromey <tromey@cygnus.com>
To: Kevin_Hendricks <khendricks@admin.ivey.uwo.ca>
Cc: khendricks@ivey.uwo.ca, tromey@cygnus.com, apbianco@cygnus.com,
        green@cygnus.com, java-gnats@sourceware.cygnus.com
Subject: Re: libgcj/60
Date: Fri, 8 Oct 1999 08:10:46 -0700

 Kevin> Where would I find the new GC code?  Would snapshots have it?
 Kevin> Is there a public source tree?
 
 Here's where I look:
 
 http://reality.sgi.com/boehm_mti/gc.html
 
 It isn't entirely trivial to build with a collector that hasn't been
 integrated into our tree.  So this approach is not for the faint of
 heart.
 
 Tom
State-Changed-From-To: open->feedback
State-Changed-By: tromey
State-Changed-When: Wed Nov  3 14:55:17 1999
State-Changed-Why:
    I've upgraded the GC to 5.0alpha4.
    Can you try the latest GC + libjava from the CVS trunk?
    If it you can try it and it works, I'll close this PR.
    Otherwise I'll reopen the PR until I can build on
    Linux PPC (should be fairly soon, I think)

From: tromey@cygnus.com
To: java-gnats@sourceware.cygnus.com, khendricks@ivey.uwo.ca,
  tromey@cygnus.com
Cc:  
Subject: Re: libgcj/60
Date: 3 Nov 1999 22:55:17 -0000

 Synopsis: Linux/PPC segfault in GC_mark_from_mark_stack that kills app
 
 State-Changed-From-To: open->feedback
 State-Changed-By: tromey
 State-Changed-When: Wed Nov  3 14:55:17 1999
 State-Changed-Why:
     I've upgraded the GC to 5.0alpha4.
     Can you try the latest GC + libjava from the CVS trunk?
     If it you can try it and it works, I'll close this PR.
     Otherwise I'll reopen the PR until I can build on
     Linux PPC (should be fairly soon, I think)
 
 http://sourceware.cygnus.com/cgi-bin/gnatsweb.pl?cmd=view&database=java&pr=60

From: Kevin Hendricks <khendricks@ivey.uwo.ca>
To: tromey@cygnus.com, java-gnats@sourceware.cygnus.com,
        khendricks@ivey.uwo.ca, tromey@cygnus.com
Cc:  
Subject: Re: libgcj/60
Date: Thu, 4 Nov 1999 14:38:27 -0500

 Hi,
 
 As requested, I have downloaded the 11-04 snapshot.
 
 There are numerous problems in the build:
 
 Does anyone ever build these snapshots on Linux or Linux PPC?
 
 -  in libffi/powerpc/sysv.S you need to change
    #include <powerpc/asm.h> 
 to
    #include "asm.h"
 
 - in libjava/include/  java-array.h is missing but it is referenced by
 java/lang/String.h , etc
   (to work around this I made a sym link to ../gcj/array.h  (is this right?)
 
 - for some reason the powerpc builds are defaulting to msoft-float even if I
 specify not to in configure
 
 - in boehm-gc/misc.c thre is a reference to GC_init_linuxppc() which  used to
 exist in os_dep.c but does not anymore.  I didn't know whether to copy it out
 of an old os_dep.c or simply comment it out.  I commented it out (is that
 right?)
 
 - after installation you can get a message about a malformed spec file after
 216 characters.  I tracked this down to the very last line of libgcj.spec which
 simply has jc1: and nothing else.  I simply removed the jc1: and then these
 error messages went away.
 
 So I finally had something to test:
 
 - gcj -C Hello.java works fine
 
 - gcj -fassume-compiled -c Hello.java works fine
 
  - gcj  -oHello.exe --main=Hello Hello.java will complete but when run comes
 back with the exact same error message as the earlier libgcj did, namely:
 
 Program received signal SIGSEGV in GC_mark_from_mark_stack() in
 boehm-gc/mark.c: 161
 
 - gcj -static -oHello.exe --main=Hello Hello.java  
 used to work in libgcj for gcc 2.95.1 but it errors out with the following
 message under the snapshot.
 
 /usr/lib/libc.a(brk.o): In function `brk':
 brk.o(.text+0x16): relocation truncated to fit: R_PPC_SDAREL16 __curbrk
 collect2: ld returned 1 exit status (problem in glibc?)
 
 - gcj -oHello.exe /usr/lib/libgcj.a /usr/lib/libzgcj.a /usr/lib/libgcjgc
 Hello.java
 will build but when run will segfault and die in the same place in
 GC_mark_from_mark_stack().
 
 
 So needless to say, things are not very pretty for gcj on ppc.
 
 Please let me know once you get the other build issues ironed out and I woulod
 be happy to try again.
 
 Kevin
 
 
 

From: Tom Tromey <tromey@cygnus.com>
To: khendricks@ivey.uwo.ca
Cc: tromey@cygnus.com, java-gnats@sourceware.cygnus.com
Subject: Re: libgcj/60
Date: Thu, 4 Nov 1999 12:14:57 -0800 (PST)

 >>>>> "Kevin" == Kevin Hendricks <khendricks@ivey.uwo.ca> writes:
 
 Kevin> Does anyone ever build these snapshots on Linux or Linux PPC?
 
 I don't ever look at the snapshots.  However, I build from cvs on x86
 Linux every day.
 
 Kevin> - in libjava/include/  java-array.h is missing but it is referenced by
 Kevin> java/lang/String.h , etc
 Kevin>   (to work around this I made a sym link to ../gcj/array.h  (is this right?)
 
 This means you are using the 2.95.1 gcjh with the CVS libgcj.
 Unfortunately, you can't do this.  There is a patch available (I saw a
 post about it this week, or late last week, to java-discuss) to turn
 2.95.1 into something resembling the current cvs gcc.
 
 Kevin> - for some reason the powerpc builds are defaulting to
 Kevin> msoft-float even if I specify not to in configure
 
 I don't know about this.
 I can't look at it for a while yet.
 
 Kevin> - in boehm-gc/misc.c thre is a reference to GC_init_linuxppc()
 Kevin> which used to exist in os_dep.c but does not anymore.  I didn't
 Kevin> know whether to copy it out of an old os_dep.c or simply
 Kevin> comment it out.  I commented it out (is that right?)
 
 Yep, thanks.  I checked in this fix.
 
 Kevin> - after installation you can get a message about a malformed
 Kevin> spec file after 216 characters.  I tracked this down to the
 Kevin> very last line of libgcj.spec which simply has jc1: and nothing
 Kevin> else.  I simply removed the jc1: and then these error messages
 Kevin> went away.
 
 This is related to the 2.95.1 thing, too.  Your fix is fine.
 
 Kevin> Program received signal SIGSEGV in GC_mark_from_mark_stack() in
 Kevin> boehm-gc/mark.c: 161
 
 Bummer.
 I should be looking at Linux PPC builds pretty soon.  Until I actually
 start, though, I can't spend any time on it.  So you're on your own
 for now, I'm afraid :-(
 
 T

From: Bryce McKinlay <bryce@albatross.co.nz>
To: Cc: java-gnats@sourceware.cygnus.com
Subject: Re: libgcj/60
Date: Fri, 05 Nov 1999 10:44:59 +1300

 Kevin Hendricks wrote:
 
 >  As requested, I have downloaded the 11-04 snapshot.
 >
 >  There are numerous problems in the build:
 
 You'll need to apply a java patch to gcc 2.95 which can be found here:
 http://waitaki.otago.ac.nz/~bryce/gcj/
 
 This should allow you to build the latest libgcj snapshots.
 
 regards
 
   [ bryce ]
>Unformatted:




More information about the Gcc-prs mailing list