This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

libgcj/1422: HelloWorld dumps core (SIGSEGV) (no CLASSPATH set)



>Number:         1422
>Category:       libgcj
>Synopsis:       HelloWorld dumps core (SIGSEGV) (no CLASSPATH set)
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    tromey
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 20 12:19:42 PST 2000
>Closed-Date:    Fri Sep 24 09:58:56 PDT 1999
>Last-Modified:  Fri Sep 24 09:58:56 PDT 1999
>Originator:     Adam Sulmicki
>Release:        gcc 2.95.1, libgcj 2.95.1
>Organization:
>Environment:
SunOS one.cfar.umd.edu 5.6 Generic_105181-12 sun4u sparc SUNW,Ultra-5_10
gcc version 2.95.1 19990816 (release)
>Description:
Hello,
	I have this silly problem ... AFAIK it is a bug :(

adam@one:HelloApp $ cat HelloWorldApp.java 
  class HelloWorldApp {
    public static void main(String[] args) {
      System.out.println("Hello World!"); }
  }

1) I can compile bytecode of it using gcj and it will run
    fine under Sun's 'java' interpreter.

adam@one:HelloApp $ gcj -C HelloWorldApp.java 
adam@one:HelloApp $ java -version
java version "1.2.1"
Solaris VM (build Solaris_JDK_1.2.1_03, native threads, sunwjit)
adam@one:HelloApp $ java  HelloWorldApp  
Hello World!

2) However, when I try to make native binary, it will dump  
   core.

gcj -g --main=HelloWorldApp -o HelloWorldApp1 HelloWorldApp.java -R/homes/adam/usr/lib -L/homes/adam/usr/include

adam@one:HelloApp $ ./HelloWorldApp1
Segmentation Fault (core dumped)

adam@one:HelloApp $ ldd HelloWorldApp1
        libgcj.so.0 =>   /homes/adam/usr/lib/libgcj.so.0
        libm.so.1 =>     /usr/lib/libm.so.1
        libgcjgc.so.0 =>         /homes/adam/usr/lib/libgcjgc.so.0
        libzgcj.so.0 =>  /homes/adam/usr/lib/libzgcj.so.0
        libsocket.so.1 =>        /usr/lib/libsocket.so.1
        libnsl.so.1 =>   /usr/lib/libnsl.so.1
        libdl.so.1 =>    /usr/lib/libdl.so.1
        libc.so.1 =>     /usr/lib/libc.so.1
        libmp.so.2 =>    /usr/lib/libmp.so.2

adam@one:HelloApp $ gdb HelloWorldApp1
GNU gdb 4.18
(gdb) run
Starting program: /one/adam/classes/all/99.fall/CMSC417/HelloApp/HelloWorldApp1 

Program received signal SIGSEGV, Segmentation fault.
0xef54f5a0 in GC_find_limit (p=0xeffff6c4 "īJ/¸", up=1)
    at ../../../libgcj-2.95.1/boehm-gc/os_dep.c:681
681                     GC_noop1((word)(*result));
(gdb) where
#0  0xef54f5a0 in GC_find_limit (p=0xeffff6c4 "īJ/¸", up=1)
    at ../../../libgcj-2.95.1/boehm-gc/os_dep.c:681
#1  0xef54f600 in GC_get_stack_base ()
    at ../../../libgcj-2.95.1/boehm-gc/os_dep.c:723
#2  0xef54e754 in GC_init_inner ()
    at ../../../libgcj-2.95.1/boehm-gc/misc.c:457
#3  0xef54b818 in GC_generic_malloc_inner (lb=2052, k=0)
    at ../../../libgcj-2.95.1/boehm-gc/malloc.c:91
#4  0xef6bb298 in _Jv_InitGC () at ../../../libgcj-2.95.1/libjava/boehm.cc:335
#5  0xef6a6d28 in _Jv_RegisterClasses (classes=0xeffff910)
    at ../../../libgcj-2.95.1/libjava/java/lang/natClass.cc:582
#6  0xef6a6db4 in _Jv_RegisterClass (klass=0x28bfc)
    at ../../../libgcj-2.95.1/libjava/java/lang/natClass.cc:602
#7  0x13e20 in global constructors keyed to HelloWorldApp.HelloWorldApp ()
    at HelloWorldApp.java:8
#8  0x17cc4 in __do_global_ctors_aux () at ../../src/gcc/cp/tinfo2.cc:300
#9  0x17cfc in _init () at ../../src/gcc/cp/tinfo2.cc:300

Hope it helps,
Adam
>How-To-Repeat:
crashes each time 
>Fix:

>Release-Note:

>Audit-Trail:

Formerly PR libgcj/44


From: Tom Tromey <tromey@cygnus.com>
To: adam@cfar.umd.edu
Cc: java-gnats@sourceware.cygnus.com
Subject: Re: libgcj/44: HelloWorld dumps core (SIGSEGV) (no CLASSPATH set)
Date: Sun, 12 Sep 1999 20:32:13 -0700

 You probably have the infamous Solaris bug.  The fix is to use the
 latest GNU ld from binutils instead of the Solaris linker.
 
 The debugger stack trace you sent is a bit deceptive.  The GC catches
 some SEGVs when it is finding the stack limits; in this case I believe
 if you "continue" you will see that this SEGV is one such.
 
 Tom
 

From: Adam Sulmicki <adam@cfar.umd.edu>
To: Tom Tromey <tromey@cygnus.com>
Cc: adam@cfar.umd.edu, java-gnats@sourceware.cygnus.com
Subject: Re: libgcj/44: HelloWorld dumps core (SIGSEGV) (no CLASSPATH set) 
Date: Mon, 13 Sep 1999 17:15:04 -0400

 Tom Tromey writes:
 ->You probably have the infamous Solaris bug.  The fix is to use the
 ->latest GNU ld from binutils instead of the Solaris linker.
 
 Ok, I have grabbed latest beta binutils from 
 	ftp://ftp.varesearch.com/pub/support/hjl/binutils
 That would be : binutils-2.9.5.0.12.tar.gz
 
 I have installed them in my home dir. The (perhaps silly) question is:
 
 is that possible to tell gcc to use this different ld without having
 to recompile whole gcc package? 
 
 I see I can pass some options to linker via gcc command line,
 but I don't think I can pass which specific gcc it should use.
 
 I don't know how I should edit 'specs' file :(
 
 ->The debugger stack trace you sent is a bit deceptive.  The GC catches
 ->some SEGVs when it is finding the stack limits; in this case I believe
 ->if you "continue" you will see that this SEGV is one such.
 
 FWIW, here's full run of the program with use of continue.
 
 adam@one:HelloApp $ gdb HelloWorldApp1
 GNU gdb 4.18
 This GDB was configured as "sparc-sun-solaris2.6"...
 (gdb) run
 Starting program: /one/adam/classes/all/99.fall/CMSC417/ex/HelloApp/HelloWorldApp1 
 
 Program received signal SIGSEGV, Segmentation fault.
 0xef54f5a0 in GC_find_limit (p=0xeffff6c4 "īJ/¸", up=1)
     at ../../../libgcj-2.95.1/boehm-gc/os_dep.c:681
 681                     GC_noop1((word)(*result));
 (gdb) cont
 Continuing.
 
 Program received signal SIGSEGV, Segmentation fault.
 _Jv_equalUtf8Consts (a=0x0, b=0xef6d4282)
     at ../../../libgcj-2.95.1/libjava/prims.cc:89
 89        if (a->hash != b->hash)
 Current language:  auto; currently c++
 (gdb) cont
 Continuing.
 
 Program terminated with signal SIGSEGV, Segmentation fault.
 The program no longer exists.
 (gdb) 
 
 
 
 adam@one:HelloApp $ cat HelloWorldApp.java 
   class HelloWorldApp {
     public static void main(String[] args) {
       System.out.println("Hello World!"); // Display "Hello World!" } }
 adam@one:HelloApp $ 
 
 adam@one:HelloApp $ cat Makefile 
 
 HelloWorldApp1:
         gcj -g --main=HelloWorldApp -o HelloWorldApp1 HelloWorldApp.java \
 -R/homes/adam/usr/lib -L/homes/adam/usr/include
 
 adam@one:HelloApp $

From: Tom Tromey <tromey@cygnus.com>
To: Adam Sulmicki <adam@cfar.umd.edu>
Cc: Tom Tromey <tromey@cygnus.com>, java-gnats@sourceware.cygnus.com
Subject: Re: libgcj/44: HelloWorld dumps core (SIGSEGV) (no CLASSPATH set) 
Date: Tue, 14 Sep 1999 11:18:23 -0700

 >>>>> "Adam" == Adam Sulmicki <adam@cfar.umd.edu> writes:
 
 Adam> I have installed them in my home dir. The (perhaps silly) question is:
 Adam> is that possible to tell gcc to use this different ld without having
 Adam> to recompile whole gcc package? 
 
 I'm afraid I don't know.
 
 Adam> FWIW, here's full run of the program with use of continue.
 
 You definitely have the standard Solaris problem.
 
 Tom

From: Alexandre Oliva <oliva@lsd.ic.unicamp.br>
To: Adam Sulmicki <adam@cfar.umd.edu>
Cc: tromey@cygnus.com, java-gnats@sourceware.cygnus.com
Subject: Re: libgcj/44: HelloWorld dumps core (SIGSEGV) (no CLASSPATH set)
Date: 18 Sep 1999 11:43:30 -0300

 On Sep 13, 1999, Adam Sulmicki <adam@cfar.umd.edu> wrote:
 
 >  Ok, I have grabbed latest beta binutils from 
 >  I have installed them in my home dir. The (perhaps silly) question is:
  
 >  is that possible to tell gcc to use this different ld without having
 >  to recompile whole gcc package? 
  
 gcc -B/binutils/prefix/bin/
 
 -- 
 Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
 oliva@{lsd.ic.unicamp.br,guarana.{org,com}} aoliva@{acm,computer}.org
 oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
 ** I may forward mail about projects to mailing lists; please use them
 

From: Adam Sulmicki <adam@cfar.umd.edu>
To: Alexandre Oliva <oliva@lsd.ic.unicamp.br>
Cc: Adam Sulmicki <adam@cfar.umd.edu>, tromey@cygnus.com,
        java-gnats@sourceware.cygnus.com
Subject: Re: libgcj/44: HelloWorld dumps core (SIGSEGV) (no CLASSPATH set) 
Date: Sat, 18 Sep 1999 12:08:20 -0400

 Alexandre Oliva writes:
 ->On Sep 13, 1999, Adam Sulmicki <adam@cfar.umd.edu> wrote:
 ->
 ->>  Ok, I have grabbed latest beta binutils from 
 ->>  I have installed them in my home dir. The (perhaps silly) question is:
 -> 
 ->>  is that possible to tell gcc to use this different ld without having
 ->>  to recompile whole gcc package? 
 -> 
 ->gcc -B/binutils/prefix/bin/
 
 Hello,
 	Thanks for your reply. However, it does not seems quite to
 	work for me. Am I doing something obviously  wrong? :(
 
 adam@one:HelloApp $ /homes/adam/x/bin/ld -v
 GNU ld version 2.9.5 (with BFD 2.9.5.0.12)
 
 adam@one:HelloApp $ gcj -v
 Reading specs from /homes/adam/usr/lib/gcc-lib/sparc-sun-solaris2.6/2.95.1/specsReading specs from /homes/adam/usr/lib/libgcj.spec
 rename spec lib to liborig
 gcc version 2.95.1 19990816 (release)
 
 adam@one:HelloApp $ make hwa1
 gcj -B/homes/adam/x/bin -g --main=HelloWorldApp -o HelloWorldApp1 HelloWorldApp.java \
 -R/homes/adam/usr/lib -L/homes/adam/usr/include
 gcj: file path prefix `/homes/adam/x/bin' never used
 
 
 (.. and yeah, it still crashes.. )
 

From: Alexandre Oliva <oliva@lsd.ic.unicamp.br>
To: Adam Sulmicki <adam@cfar.umd.edu>
Cc: tromey@cygnus.com, java-gnats@sourceware.cygnus.com
Subject: Re: libgcj/44: HelloWorld dumps core (SIGSEGV) (no CLASSPATH set)
Date: 18 Sep 1999 13:54:26 -0300

 On Sep 18, 1999, Adam Sulmicki <adam@cfar.umd.edu> wrote:
 
 -> gcc -B/binutils/prefix/bin/
                             ^^
 > gcj -B/homes/adam/x/bin -g --main=HelloWorldApp -o HelloWorldApp1 HelloWorldApp.java \
                         ^^
 
 See the difference? :-)
 
 The trailing slash is significant.
 
 -- 
 Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
 oliva@{lsd.ic.unicamp.br,guarana.{org,com}} aoliva@{acm,computer}.org
 oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
 ** I may forward mail about projects to mailing lists; please use them
 

From: Tom Tromey <tromey@cygnus.com>
To: Adam Sulmicki <adam@cfar.umd.edu>
Cc: Tom Tromey <tromey@cygnus.com>, java-gnats@sourceware.cygnus.com
Subject: Re: libgcj/44: HelloWorld dumps core (SIGSEGV) (no CLASSPATH set) 
Date: Sat, 18 Sep 1999 09:58:20 -0700

 >>>>> "Adam" == Adam Sulmicki <adam@cfar.umd.edu> writes:
 
 Adam> However, it still crashes. So I'm wondering if there's some way
 Adam> to tell if it indeed actaully did use gnu's linker. Looking at
 Adam> gdb output it looks exactly the same as if it was using Solaris'
 Adam> provided linker.
 
 Use "gcj -v" to see what gcj thinks it is doing.
 
 Tom

From: Adam Sulmicki <adam@cfar.umd.edu>
To: Alexandre Oliva <oliva@lsd.ic.unicamp.br>
Cc: Adam Sulmicki <adam@cfar.umd.edu>, tromey@cygnus.com,
        java-gnats@sourceware.cygnus.com
Subject: Re: libgcj/44: HelloWorld dumps core (SIGSEGV) (no CLASSPATH set) 
Date: Sat, 18 Sep 1999 13:07:21 -0400

 Alexandre Oliva writes:
 ->On Sep 18, 1999, Adam Sulmicki <adam@cfar.umd.edu> wrote:
 ->
 ->-> gcc -B/binutils/prefix/bin/
 ->                            ^^
 ->> gcj -B/homes/adam/x/bin -g --main=HelloWorldApp -o HelloWorldApp1 HelloWorl
 ->dApp.java \
 ->
 ->See the difference? :-)
 
 Yeah :-) Tom already pointed me this out. Looking at gcc output I can see
 that it uses gnu's ld... the only issue is that it still crashes :(
 
 ------------------------------------------------------------------------
 Script started on Sat Sep 18 13:01:15 1999
 adam@one:HelloApp $ make hwa1
 gcj -v -B/homes/adam/x/bin/ -g --main=HelloWorldApp -o HelloWorldApp1 HelloWorldApp.java \
 -R/homes/adam/usr/lib -L/homes/adam/usr/include
 Reading specs from /homes/adam/usr/lib/gcc-lib/sparc-sun-solaris2.6/2.95.1/specs
 Reading specs from /homes/adam/usr/lib/libgcj.spec
 rename spec lib to liborig
 gcc version 2.95.1 19990816 (release)
  /homes/adam/usr/lib/gcc-lib/sparc-sun-solaris2.6/2.95.1/jc1 HelloWorldApp.java -quiet -g -version -o /var/tmp/cc0ptqTH.s
 GNU Java version 2.95.1 19990816 (release) (sparc-sun-solaris2.6) compiled by GNU C version 2.95 19990728 (release).
  /homes/adam/x/bin/as -V -Qy -s -o /var/tmp/ccMRHsck.o /var/tmp/cc0ptqTH.s
 GNU assembler version 2.9.5 (sparc-sun-solaris2.6) using BFD version 2.9.5.0.12
  /homes/adam/usr/lib/gcc-lib/sparc-sun-solaris2.6/2.95.1/jvgenmain HelloWorldApp /var/tmp/ccWpjwb1.i
  /homes/adam/usr/lib/gcc-lib/sparc-sun-solaris2.6/2.95.1/cc1 /var/tmp/ccWpjwb1.i -quiet -dumpbase HelloWorldApp.c -g -version -o /var/tmp/ccMVWw3I.s
 GNU C version 2.95.1 19990816 (release) (sparc-sun-solaris2.6) compiled by GNU C version 2.95 19990728 (release).
  /homes/adam/x/bin/as -V -Qy -s -o /var/tmp/ccs2H0Xs.o /var/tmp/ccMVWw3I.s
 GNU assembler version 2.9.5 (sparc-sun-solaris2.6) using BFD version 2.9.5.0.12
 GNU ld version 2.9.5 (with BFD 2.9.5.0.12)
   Supported emulations:
    elf32_sparc
 
 adam@one:HelloApp $ gdb WorldApp1
 GNU gdb 4.18
 Copyright 1998 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 "sparc-sun-solaris2.6"...
 (gdb) run
 Starting program: /one/adam/classes/all/99.fall/CMSC417/ex/HelloApp/HelloWorldApp1 
 
 Program received signal SIGSEGV, Segmentation fault.
 0xef54f5a0 in GC_find_limit (p=0xeffff704 "īJ/¸", up=1)
     at ../../../libgcj-2.95.1/boehm-gc/os_dep.c:681
 681			GC_noop1((word)(*result));
 (gdb) cont
 Continuing.
 
 Program received signal SIGSEGV, Segmentation fault.
 _Jv_equalUtf8Consts (a=0x0, b=0xef6d4282)
     at ../../../libgcj-2.95.1/libjava/prims.cc:89
 89	  if (a->hash != b->hash)
 Current language:  auto; currently c++
 (gdb) cont
 Continuing.
 
 Program terminated with signal SIGSEGV, Segmentation fault.
 The program no longer exists.
 (gdb) quit
 adam@one:HelloApp $ exit
 exit
 
 script done on Sat Sep 18 13:01:46 1999
 ------------------------------------------------------------------------
 

From: Alexandre Oliva <oliva@lsd.ic.unicamp.br>
To: Adam Sulmicki <adam@cfar.umd.edu>
Cc: tromey@cygnus.com, java-gnats@sourceware.cygnus.com
Subject: Re: libgcj/44: HelloWorld dumps core (SIGSEGV) (no CLASSPATH set)
Date: 18 Sep 1999 15:37:33 -0300

 On Sep 18, 1999, Adam Sulmicki <adam@cfar.umd.edu> wrote:
 
 > Yeah :-) Tom already pointed me this out. Looking at gcc output I can see
 > that it uses gnu's ld... the only issue is that it still crashes :(
 
 Did you rebuild all of libgcj, in a fresh build tree, with GNU ld?
 
 -- 
 Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
 oliva@{lsd.ic.unicamp.br,guarana.{org,com}} aoliva@{acm,computer}.org
 oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
 ** I may forward mail about projects to mailing lists; please use them
 

From: Adam Sulmicki <adam@cfar.umd.edu>
To: Alexandre Oliva <oliva@lsd.ic.unicamp.br>
Cc: Adam Sulmicki <adam@cfar.umd.edu>, tromey@cygnus.com,
        java-gnats@sourceware.cygnus.com, adam@cfar.umd.edu
Subject: Re: libgcj/44: HelloWorld dumps core (SIGSEGV) (no CLASSPATH set) 
Date: Sat, 18 Sep 1999 14:40:31 -0400

 Alexandre Oliva writes:
 ->On Sep 18, 1999, Adam Sulmicki <adam@cfar.umd.edu> wrote:
 ->
 ->> Yeah :-) Tom already pointed me this out. Looking at gcc output I can see
 ->> that it uses gnu's ld... the only issue is that it still crashes :(
 ->
 ->Did you rebuild all of libgcj, in a fresh build tree, with GNU ld?
 
 Uh, no. Will do sometime later and let u know the outcome.
 
 Should I rebuild gcc too?

From: Alexandre Oliva <oliva@lsd.ic.unicamp.br>
To: Adam Sulmicki <adam@cfar.umd.edu>
Cc: tromey@cygnus.com, java-gnats@sourceware.cygnus.com
Subject: Re: libgcj/44: HelloWorld dumps core (SIGSEGV) (no CLASSPATH set)
Date: 18 Sep 1999 15:59:01 -0300

 On Sep 18, 1999, Adam Sulmicki <adam@cfar.umd.edu> wrote:
 
 > Should I rebuild gcc too?
 
 It would probably be easier to rebuild libgcj with GNU ld if you did,
 because libtool, that libgcj uses, won't pass the -B flag to gcc.
 
 -- 
 Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
 oliva@{lsd.ic.unicamp.br,guarana.{org,com}} aoliva@{acm,computer}.org
 oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
 ** I may forward mail about projects to mailing lists; please use them
 

From: Tom Tromey <tromey@cygnus.com>
To: Adam Sulmicki <adam@cfar.umd.edu>
Cc: tromey@cygnus.com, java-gnats@sourceware.cygnus.com
Subject: Re: libgcj/44: HelloWorld dumps core (SIGSEGV) (no CLASSPATH set) 
Date: Tue, 21 Sep 1999 23:45:31 -0700

 Did you ever resolve your libgcj/Solaris problem?
 T

From: Adam Sulmicki <adam@cfar.umd.edu>
To: Tom Tromey <tromey@cygnus.com>
Cc: Adam Sulmicki <adam@cfar.umd.edu>, java-gnats@sourceware.cygnus.com
Subject: Re: libgcj/44: HelloWorld dumps core (SIGSEGV) (no CLASSPATH set) 
Date: Wed, 22 Sep 1999 08:31:05 -0400

 Tom Tromey writes:
 ->Did you ever resolve your libgcj/Solaris problem?
 
 No.
 
 The last thing was that I need to recompile libgcj with 
 gnu's binutils.
 
 For one thing I'm not sure how to tell libgcj to use gnu binutils
 instead of the ones which come with solaris. There don't
 seems be option '--with-gnu' for ./configure.
 
 for other I had been busy  with other things right now.
State-Changed-From-To: open->closed
State-Changed-By: tromey
State-Changed-When: Fri Sep 24 09:58:56 1999
State-Changed-Why:
    Reporter reports this is fixed.
    Rebuilding gcc with the newest binutils did the trick.
>Unformatted:



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]