public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Dave Korn <dave.korn.cygwin@googlemail.com>
To: Java Patches <java-patches@gcc.gnu.org>,
	  GCC Patches <gcc-patches@gcc.gnu.org>
Subject: [PATCH PR42811,4.5 regression] java.lang.ExceptionInInitializerError  in ecj1
Date: Fri, 05 Feb 2010 22:09:00 -0000	[thread overview]
Message-ID: <4B6C9B26.3010106@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1392 bytes --]

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42811


    Hi lists,

  In this PR, ecj1 is failing (on Cygwin, presumably MinGW as well) owing to
unintended fallout from building libgcj as two separate DLLs.

  There are only static dependencies (i.e. unresolved symbols in the ecj.o
object) for ecjx to pull in the main libgcj at linktime, so only that DLL gets
loaded into memory at runtime.  But the class loader wants to load something
from the subsidiary (-noncore) DLL, and it's not present in memory, so it
fails.  (IIUC this is what the class definition data that is stored in .jcr
sections and made available to the class loader through a a .ctor-like
mechanism in the crtbegin code is all about.)

  In this patch, I add an arbitrary undef to the link spec, against a fairly
randomly chosen symbol (my only criterion was that the org.ietf.jgss namespace
is probably fairly stable) from the -noncore part of the library.  This
sufficed to build an ecjx that links against and hence loads both DLLs, and it
doesn't throw the exception shown in the PR anymore.

libjava/ChangeLog:

	PR java/42811
	* configure.ac (libgcj_spec_lgcj_override): Add undefined reference
	to arbitrary symbol in noncore library.
	(libgcj_spec_lgcj_bc_override): Likewise.

  I'm taking this for a bootstrap-and-test cycle on i686-pc-cygwin.  Does it
seem like a reasonable approach?

    cheers,
      DaveK


[-- Attachment #2: pr42811.diff --]
[-- Type: text/x-c, Size: 1104 bytes --]

Index: libjava/configure.ac
===================================================================
--- libjava/configure.ac	(revision 156467)
+++ libjava/configure.ac	(working copy)
@@ -244,9 +244,13 @@ if test "$enable_libgcj_sublibs" = yes ; then
   # tag "_bc" onto the end of it when we use it to generate the
   # spec, but that's an ugly thing to do when there are multiple
   # words in the string and you're relying on the ordering to
-  # append the correct one.
-  libgcj_spec_lgcj_override="-lgcj-noncore -lgcj"
-  libgcj_spec_lgcj_bc_override="-lgcj-noncore -lgcj_bc"
+  # append the correct one.  Note that we add an arbitrary undef
+  # from libgcj-noncore to ensure the library is actually linked
+  # and loaded, as there aren't static dependencies to tell us
+  # which classes will be loaded at runtime, so we need to ensure
+  # that all the class data (.jcr sections) are present and initialised.
+  libgcj_spec_lgcj_override="-lgcj-noncore -u__ZN3org4ietf4jgss10GSSManagerC1Ev -lgcj"
+  libgcj_spec_lgcj_bc_override="-lgcj-noncore -u__ZN3org4ietf4jgss10GSSManagerC1Ev -lgcj_bc"
 fi
 
 

             reply	other threads:[~2010-02-05 22:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-05 22:09 Dave Korn [this message]
2010-02-06  6:12 ` Dave Korn
2010-02-15  2:49   ` [REVIVED: PATCH " Dave Korn
2010-02-15 13:04     ` Bryce McKinlay
2010-02-18  4:28       ` Dave Korn
2010-02-18 15:38         ` Dave Korn

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=4B6C9B26.3010106@gmail.com \
    --to=dave.korn.cygwin@googlemail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=java-patches@gcc.gnu.org \
    /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).