public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Haley <aph@redhat.com>
To: Kurt Miller <kurt@intricatesoftware.com>
Cc: java@gcc.gnu.org
Subject: Re: gcj on OpenBSD
Date: Wed, 11 Mar 2009 16:53:00 -0000	[thread overview]
Message-ID: <49B7EC5C.80107@redhat.com> (raw)
In-Reply-To: <49B7D280.5020306@intricatesoftware.com>

Kurt Miller wrote:

> I've been working on getting gcj up and running on OpenBSD/i386.
> Currently I'm working on adding gcj to gcc 4.2 port. I'm pretty far
> along with the work: enabled dwarf2 exceptions, thread model posix, etc.
> The build completes but gcj-dbtool segfaults and gij too. The segfault
> occurs when initializing the class loader because engine is null.
> 
> Could anyone suggest some ideas for diagnosing the root cause of this?

This happens because class registration hasn't been done.  gcc generates
a magic section called .jcr, and this is a list of pointers to classes.

On x86_64 a .jcr section in an .o file with two classes looks like this:

RELOCATION RECORDS FOR [.jcr]:
OFFSET           TYPE              VALUE
0000000000000000 R_X86_64_64       P::class$
0000000000000008 R_X86_64_64       Hello::class$

And the .init section:

0000000000400bb0 <_init>:
  400bb0:       48 83 ec 08             sub    $0x8,%rsp
  400bb4:       e8 63 01 00 00          callq  400d1c <call_gmon_start>
  400bb9:       e8 f2 01 00 00          callq  400db0 <frame_dummy>
  400bbe:       e8 2d 04 00 00          callq  400ff0 <__do_global_ctors_aux>
  400bc3:       48 83 c4 08             add    $0x8,%rsp
  400bc7:       c3                      retq

which calls (*_Jv_RegisterClasses)

0000000000400db0 <frame_dummy>:
  400db0:       55                      push   %rbp
  400db1:       48 83 3d 87 04 20 00    cmpq   $0x0,0x200487(%rip)        # 601240 <__JCR_LIST__>
  400db8:       00
  400db9:       48 89 e5                mov    %rsp,%rbp
  400dbc:       74 1a                   je     400dd8 <frame_dummy+0x28>
  400dbe:       41 bb 18 0c 40 00       mov    $0x400c18 <_Jv_RegisterClasses@plt>,%r11d
  400dc4:       4d 85 db                test   %r11,%r11
  400dc7:       74 0f                   je     400dd8 <frame_dummy+0x28>
  400dc9:       bf 40 12 60 00          mov    $0x601240 <__JCR_LIST__>,%edi
  400dce:       c9                      leaveq
  400dcf:       41 ff e3                jmpq   *%r11
  400dd2:       66 0f 1f 44 00 00       nopw   0x0(%rax,%rax,1)
  400dd8:       c9                      leaveq
  400dd9:       c3                      retq

I suspect that this mechanism is not working on BSD.

Andrew.

  reply	other threads:[~2009-03-11 16:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-11 15:02 Kurt Miller
2009-03-11 16:53 ` Andrew Haley [this message]
2009-03-11 16:57   ` Andrew Haley
2009-03-11 20:14   ` Kurt Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49B7EC5C.80107@redhat.com \
    --to=aph@redhat.com \
    --cc=java@gcc.gnu.org \
    --cc=kurt@intricatesoftware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).