This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GCJ 4.1.1 and static linking - SEGV


Hello,

probably I am missing something obvious... I'm trying to build a static
java program, let's say

  public class test {
    public static void main( String args[] ) {
      System.err.println( "Hello" ); }}

with 

  gcj -g -static --main=test -Wl,--whole-archive -lnss_files_p -lnss_dns_p -lresolv -lpthread -ldl -Wl,--no-whole-archive test.java

This works like expected up to GCJ 4.0.1 (probably also in 4.0.3, but haven't
tested), when started the program prints "Hello" and exits.

When trying with 4.1.1, I get

  # ./a.out
  Segmentation fault

GDB stack trace tells me

  (gdb) bt
  #0  0x00000000 in ?? ()
  #1  0x081e89de in pthread_create (new_thread=0x86c733c, attr=0xbffffa04,
    start_routine=0x808fff0 <really_start>, arg=0x74ff8) at ../.././boehm-gc/pthread_support.c:1289
  #2  0x0808fee7 in _Jv_ThreadStart (thread=0x5cb18, data=0x86c7338,
    meth=0x808cd30 <_Jv_ThreadRun(java::lang::Thread*)>) at ../.././libjava/posix-threads.cc:488
  #3  0x0808c702 in java::lang::Thread::start (this=0x5cb18)
    at ../.././libjava/java/lang/natThread.cc:328
  #4  0x080620e4 in _Jv_CreateJavaVM (vm_args=0x0) at ../.././libjava/prims.cc:1334
  #5  0x080622da in _Jv_RunMain (vm_args=0x0, klass=0x8441fc0, name=0x0, argc=1, argv=0xbffffd84,
    is_jar=false) at ../.././libjava/prims.cc:1355
  #6  0x08062468 in _Jv_RunMain (klass=0x8441fc0, name=0x0, argc=1, argv=0xbffffd84, is_jar=false)
    at ../.././libjava/prims.cc:1401
  #7  0x0806249b in JvRunMain (klass=0x8441fc0, argc=1, argv=0xbffffd84)
    at ../.././libjava/prims.cc:1407
  #8  0x0804824c in main (argc=Cannot access memory at address 0x1
  ) at /tmp/ccYuSF5L.i:11

The problem persists wether I build gcc 4.1.1 with --disable-shared or not.

Has anyone got a hint for me? Am I doing some silly mistake?

Best regards,
Tom
-- 
----------------------------------------------------------------------------
Thomas Aeby, Kirchweg 52, 1735 Giffers, Switzerland, Tel: (+41)264180040
Internet: aeby@graeff.com                       PGP public key available
----------------------------------------------------------------------------



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