public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] [4.5 regression] Fix PR42811: java.lang.ExceptionInInitializerError  in ecj1 and associated issues.
@ 2010-02-20 18:18 Dave Korn
  2010-02-22 10:12 ` Andrew Haley
  0 siblings, 1 reply; 6+ messages in thread
From: Dave Korn @ 2010-02-20 18:18 UTC (permalink / raw)
  To: Java Patches, GCC Patches

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

[ refs: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42811
        http://gcc.gnu.org/ml/java/2010-02/msg00002.html
        http://gcc.gnu.org/ml/java/2010-02/threads.html#00004 ]

    Hi lists,

  The attached patches resolve PR42811 and the knock-on issues uncovered while
fixing it (see refs).  I've separated them out for ease of review but I've
tested them as a group and would like to ask the java maintainers whether they
need to be applied separately or can all just go in as one.  Thanks are due to
Hans and Bryce for their help in solving this one.

  The main PR is resolved by ensuring that both parts of the whole libgcj are
always loaded, so that all the predefined class data from both sets of .jcr
sections is always present at runtime.

  The uninitialised memory fix is straightforward and was already approved by
Bryce in a separate thread, I quote it here for completeness, and with a
slightly reworded changelog in case it needs to be applied separately from the
fix for the main PR.

  The second copy of the gc code living in the -noncore sublibrary turned out
very fortunately to be completely dead, only present because of
--whole-archive; none of the -noncore code needed to link it at all, so there
was no need to export it from the core sublibrary for the -noncore one to use.
 Of course it was still a waste of time, memory and disk space, and it
confused the hell out of gdb for some reason.  The same turned out to apply to
the other convenience libs required by the main sublibrary, so I trivially
removed them all.

  The changes to the boehm-gc are largely mechanical, and basically involve
turning on the pseudo-support for DYNAMIC_LOADING that is implemented for the
other windows hosts.  I simplified away the version checking, because cygwin
never runs on any windows version that doesn't support DLLs (i.e. win32s), and
it uses the unix get mem function so as to get memory from the cygwin
allocator rather than allocating it from the windows api "behind cygwin's
back"; apart from that, the usage of the VirtualQuery to determine memory
ranges and properties will be absolutely fine on Cygwin, so I didn't try and
rewrite it to use something based on mprotect() or whatever other posix api.


pr42811-final.diff:
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.
	configure: Regenerate.

pr42811-associated-uninitmem-fix.diff:
libjava/ChangeLog:

	* jvmti.cc (_Jv_GetJVMTIEnv): Avoid use of uninitialised memory.

pr42811-associated-dead-lib-code-link-fix.diff:
libjava/ChangeLog:

	* Makefile.am (libgcj_noncore_la_LIBADD): Don't include standard
	list of libtool convenience libs only needed by main library.
	* Makefile.in: Regenerate.

pr42811-associated-gc-fixes.diff:
boehm-gc/ChangeLog:

	* include/private/gc_priv.h (struct roots) [CYGWIN32]: Don't
	declare r_next member on Cygwin as on other windows hosts.
	(LOG_RT_SIZE) [CYGWIN32]: Don't define likewise.
	(RT_SIZE) [CYGWIN32]: Likewise.
	(struct _GC_arrays) [CYGWIN32]: Do declare _heap_bases[] member
	likewise.
	(GC_heap_bases) [CYGWIN32]: Do define likewise.
	(struct _SYSTEM_INFO) [CYGWIN32]: Do forward-declare likewise.
	(GC_sysinfo) [CYGWIN32]: Do declare extern likewise.
	(GC_n_heap_bases) [CYGWIN32]: Likewise.
	(GC_is_tmp_root) [CYGWIN32]: Do prototype likewise.
	* include/private/gcconfig.h (GC_win32_get_mem) [CYGWIN32]: Likewise.
	(GET_MEM) [CYGWIN32]: Do define likewise.
	* boehm-gc/ptr_chck.c (GC_is_visible) [CYGWIN32]: Do handle dynamic
	registration likewise.
	* boehm-gc/os_dep.c (GC_setpagesize) [CYGWIN32]: Do define likewise.
	(GC_no_win32_dlls) [CYGWIN32]: Define as constant false, unlike
	other windows hosts.
	(GC_sysinfo) [CYGWIN32]: Define as on other windows hosts.
	(GC_n_heap_bases) [CYGWIN32]: Likewise.
	(GLOBAL_ALLOC_TEST) [CYGWIN32]: Likewise.
	(GC_win32_get_mem) [CYGWIN32]: Likewise, but wrapping GC_unix_get_mem
	rather than GlobalAlloc/VirtualAlloc.
	(GC_win32_free_heap) [CYGWIN32]: Likewise, but wrapping free instead
	of GlobalFree (even though the function body is optimised away).
	* boehm-gc/mark_rts.c (add_roots_to_index) [CYGWIN32]: Define as on
	other windows hosts.
	(GC_add_roots_inner) [CYGWIN32]: Avoid overlapping or adjacent
	intervals likewise.
	(GC_clear_roots) [CYGWIN32]: Clear GC_root_index[] likewise.
	(GC_rebuild_root_index) [CYGWIN32]: Define as on other windows hosts.
	(GC_remove_tmp_roots) [CYGWIN32]: Call it likewise.
	(GC_remove_roots) [CYGWIN32]: Don't define, as on other windows hosts.
	(GC_is_tmp_root) [CYGWIN32]: Define, as on other windows hosts.
	(GC_cond_register_dynamic_libraries) [CYGWIN32]: Handle temporary
	roots and dynamic registration likewise.
	* boehm-gc/dyn_load.c (GC_has_static_roots) [CYGWIN32]: Define as on
	other windows hosts.
	(GC_register_has_static_roots_callback) [CYGWIN32]: Likewise.
	(GC_cond_add_roots) [CYGWIN32]: Likewise.
	(GC_register_main_static_data) [CYGWIN32]: Define to always return
	false, as on MSWINCE
	(HAVE_REGISTER_MAIN_STATIC_DATA) [CYGWIN32]: Define as on other
	windows hosts.
	(GC_warn_fb) [CYGWIN32]: Likewise.
	(GC_disallow_ignore_fb) [CYGWIN32]: Likewise.
	(GC_ignore_fb_mb) [CYGWIN32]: Likewise.
	(GC_ignore_fb) [CYGWIN32]: Likewise.
	(is_frame_buffer) [CYGWIN32]: Likewise.
	(GC_dump_meminfo) [CYGWIN32]: Likewise.
	(GC_wnt) [CYGWIN32]: Define to constant true.
	(GC_register_dynamic_libraries) [CYGWIN32]: Define as on other
	windows hosts.


  Bootstrapped and tested on i686-pc-cygwin; fixes PR42811 and doesn't cause
any further regressions (there are some preexisting fails that this makes no
difference to).  OK for head?

    cheers,
      DaveK


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

Index: libjava/configure.ac
===================================================================
--- libjava/configure.ac	(revision 156830)
+++ 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
 
 

[-- Attachment #3: pr42811-associated-uninitmem-fix.diff --]
[-- Type: text/x-c, Size: 503 bytes --]

Index: libjava/jvmti.cc
===================================================================
--- libjava/jvmti.cc	(revision 156830)
+++ libjava/jvmti.cc	(working copy)
@@ -2210,6 +2210,7 @@ _Jv_GetJVMTIEnv (void)
 {
   _Jv_JVMTIEnv *env
     = (_Jv_JVMTIEnv *) _Jv_MallocUnchecked (sizeof (_Jv_JVMTIEnv));
+  memset (env, 0, sizeof (_Jv_JVMTIEnv));
   env->p = &_Jv_JVMTI_Interface;
   struct jvmti_env_list *element
     = (struct jvmti_env_list *) _Jv_MallocUnchecked (sizeof (struct jvmti_env_list));

[-- Attachment #4: pr42811-associated-dead-lib-code-link-fix.diff --]
[-- Type: text/x-c, Size: 661 bytes --]

Index: libjava/Makefile.am
===================================================================
--- libjava/Makefile.am	(revision 156830)
+++ libjava/Makefile.am	(working copy)
@@ -474,8 +474,7 @@ EXTRA_libgcj_la_SOURCES = java/lang/Object.java
 if BUILD_SUBLIBS
 libgcj_noncore_la_SOURCES =
 libgcj_noncore_la_LDFLAGS = $(libgcj_la_LDFLAGS)
-libgcj_noncore_la_LIBADD = $(libgcj_noncore_la_LIBADD_SUBOBJECTS) \
-		$(LIBFFI) $(ZLIBS) $(GCLIBS) libgcj.la
+libgcj_noncore_la_LIBADD = $(libgcj_noncore_la_LIBADD_SUBOBJECTS) libgcj.la
 libgcj_noncore_la_DEPENDENCIES = libgcj-$(gcc_version).jar $(LIBLTDL) \
 		$(libgcj_noncore_la_LIBADD) libgcj.la
 if ANONVERSCRIPT

[-- Attachment #5: pr42811-associated-gc-fixes.diff --]
[-- Type: text/x-c, Size: 11835 bytes --]

Index: boehm-gc/include/private/gc_priv.h
===================================================================
--- boehm-gc/include/private/gc_priv.h	(revision 156830)
+++ boehm-gc/include/private/gc_priv.h	(working copy)
@@ -833,14 +833,14 @@ struct exclusion {
 struct roots {
 	ptr_t r_start;
 	ptr_t r_end;
-#	if !defined(MSWIN32) && !defined(MSWINCE)
+#	if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
 	  struct roots * r_next;
 #	endif
 	GC_bool r_tmp;
 	  	/* Delete before registering new dynamic libraries */
 };
 
-#if !defined(MSWIN32) && !defined(MSWINCE)
+#if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
     /* Size of hash table index to roots.	*/
 #   define LOG_RT_SIZE 6
 #   define RT_SIZE (1 << LOG_RT_SIZE) /* Power of 2, may be != MAX_ROOT_SETS */
@@ -1024,7 +1024,7 @@ struct _GC_arrays {
   struct HeapSect {
       ptr_t hs_start; word hs_bytes;
   } _heap_sects[MAX_HEAP_SECTS];
-# if defined(MSWIN32) || defined(MSWINCE)
+# if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32)
     ptr_t _heap_bases[MAX_HEAP_SECTS];
     		/* Start address of memory regions obtained from kernel. */
 # endif
@@ -1033,7 +1033,7 @@ struct _GC_arrays {
     		/* Commited lengths of memory regions obtained from kernel. */
 # endif
   struct roots _static_roots[MAX_ROOT_SETS];
-# if !defined(MSWIN32) && !defined(MSWINCE)
+# if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
     struct roots * _root_index[RT_SIZE];
 # endif
   struct exclusion _excl_table[MAX_EXCLUSIONS];
@@ -1091,7 +1091,7 @@ GC_API GC_FAR struct _GC_arrays GC_arrays;
 # ifdef USE_MUNMAP
 #   define GC_unmapped_bytes GC_arrays._unmapped_bytes
 # endif
-# if defined(MSWIN32) || defined(MSWINCE)
+# if defined(MSWIN32) || defined(MSWINCE) || defined (CYGWIN32)
 #   define GC_heap_bases GC_arrays._heap_bases
 # endif
 # ifdef MSWINCE
@@ -1187,7 +1187,7 @@ extern word GC_n_heap_sects;	/* Number of separate
 
 extern word GC_page_size;
 
-# if defined(MSWIN32) || defined(MSWINCE)
+# if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32)
   struct _SYSTEM_INFO;
   extern struct _SYSTEM_INFO GC_sysinfo;
   extern word GC_n_heap_bases;	/* See GC_heap_bases.	*/
@@ -1479,7 +1479,7 @@ void GC_remove_roots_inner GC_PROTO((char * b, cha
 GC_bool GC_is_static_root GC_PROTO((ptr_t p));
   		/* Is the address p in one of the registered static	*/
   		/* root sections?					*/
-# if defined(MSWIN32) || defined(_WIN32_WCE_EMULATION)
+# if defined(MSWIN32) || defined(_WIN32_WCE_EMULATION) || defined(CYGWIN32)
 GC_bool GC_is_tmp_root GC_PROTO((ptr_t p));
 		/* Is the address p in one of the temporary static	*/
 		/* root sections?					*/
Index: boehm-gc/include/private/gcconfig.h
===================================================================
--- boehm-gc/include/private/gcconfig.h	(revision 156830)
+++ boehm-gc/include/private/gcconfig.h	(working copy)
@@ -2375,7 +2375,7 @@
 					      calloc(1, (size_t)bytes + GC_page_size) \
 					      + GC_page_size-1)
 #     else
-#	ifdef MSWIN32
+#	if defined(MSWIN32) || defined(CYGWIN32)
 	  extern ptr_t GC_win32_get_mem();
 #         define GET_MEM(bytes) (struct hblk *)GC_win32_get_mem(bytes)
 #	else
Index: boehm-gc/ptr_chck.c
===================================================================
--- boehm-gc/ptr_chck.c	(revision 156830)
+++ boehm-gc/ptr_chck.c	(working copy)
@@ -247,7 +247,7 @@ ptr_t p;
     	    if (GC_is_static_root(p)) return(p);
     	    /* Else do it again correctly:	*/
 #           if (defined(DYNAMIC_LOADING) || defined(MSWIN32) || \
-		defined(MSWINCE) || defined(PCR)) \
+		defined(MSWINCE) || defined (CYGWIN32) || defined(PCR)) \
                 && !defined(SRC_M3)
     	        DISABLE_SIGNALS();
     	        GC_register_dynamic_libraries();
Index: boehm-gc/os_dep.c
===================================================================
--- boehm-gc/os_dep.c	(revision 156830)
+++ boehm-gc/os_dep.c	(working copy)
@@ -107,7 +107,7 @@
 # undef GC_AMIGA_DEF
 #endif
 
-#if defined(MSWIN32) || defined(MSWINCE)
+#if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32)
 # define WIN32_LEAN_AND_MEAN
 # define NOSERVICE
 # include <windows.h>
@@ -584,7 +584,7 @@ void GC_enable_signals()
 /* Find the page size */
 word GC_page_size;
 
-# if defined(MSWIN32) || defined(MSWINCE)
+# if defined(MSWIN32) || defined(MSWINCE) || defined (CYGWIN32)
   void GC_setpagesize()
   {
     GetSystemInfo(&GC_sysinfo);
@@ -1169,8 +1169,12 @@ void GC_register_data_segments()
 
 # else /* !OS2 */
 
-# if defined(MSWIN32) || defined(MSWINCE)
+# if defined(MSWIN32) || defined(MSWINCE) || defined (CYGWIN32)
 
+# ifdef CYGWIN32
+#    define GC_no_win32_dlls (FALSE)
+# endif
+
 # ifdef MSWIN32
   /* Unfortunately, we have to handle win32s very differently from NT, 	*/
   /* Since VirtualQuery has very different semantics.  In particular,	*/
@@ -1664,25 +1668,28 @@ void * os2_alloc(size_t bytes)
 # endif /* OS2 */
 
 
-# if defined(MSWIN32) || defined(MSWINCE)
+# if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32)
 SYSTEM_INFO GC_sysinfo;
 # endif
 
-# ifdef MSWIN32
+# if defined(MSWIN32) || defined(CYGWIN32)
 
+word GC_n_heap_bases = 0;
+
 # ifdef USE_GLOBAL_ALLOC
 #   define GLOBAL_ALLOC_TEST 1
 # else
 #   define GLOBAL_ALLOC_TEST GC_no_win32_dlls
 # endif
 
-word GC_n_heap_bases = 0;
-
 ptr_t GC_win32_get_mem(bytes)
 word bytes;
 {
     ptr_t result;
 
+# ifdef CYGWIN32
+    result = GC_unix_get_mem (bytes);
+# else
     if (GLOBAL_ALLOC_TEST) {
     	/* VirtualAlloc doesn't like PAGE_EXECUTE_READWRITE.	*/
     	/* There are also unconfirmed rumors of other		*/
@@ -1702,6 +1709,7 @@ word bytes;
     				      MEM_COMMIT | MEM_RESERVE,
     				      PAGE_EXECUTE_READWRITE);
     }
+#endif
     if (HBLKDISPL(result) != 0) ABORT("Bad VirtualAlloc result");
     	/* If I read the documentation correctly, this can	*/
     	/* only happen if HBLKSIZE > 64k or not a power of 2.	*/
@@ -1714,7 +1722,11 @@ void GC_win32_free_heap ()
 {
     if (GC_no_win32_dlls) {
  	while (GC_n_heap_bases > 0) {
+# ifdef CYGWIN32
+ 	    free (GC_heap_bases[--GC_n_heap_bases]);
+# else
  	    GlobalFree (GC_heap_bases[--GC_n_heap_bases]);
+# endif
  	    GC_heap_bases[GC_n_heap_bases] = 0;
  	}
     }
Index: boehm-gc/mark_rts.c
===================================================================
--- boehm-gc/mark_rts.c	(revision 156830)
+++ boehm-gc/mark_rts.c	(working copy)
@@ -22,7 +22,7 @@
 struct roots {
 	ptr_t r_start;
 	ptr_t r_end;
- #	if !defined(MSWIN32) && !defined(MSWINCE)
+ #	if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
 	  struct roots * r_next;
  #	endif
 	GC_bool r_tmp;
@@ -87,7 +87,7 @@ ptr_t p;
     return(FALSE);
 }
 
-#if !defined(MSWIN32) && !defined(MSWINCE)
+#if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
 /* 
 #   define LOG_RT_SIZE 6
 #   define RT_SIZE (1 << LOG_RT_SIZE)  -- Power of 2, may be != MAX_ROOT_SETS
@@ -139,7 +139,7 @@ struct roots *p;
     GC_root_index[h] = p;
 }
 
-# else /* MSWIN32 || MSWINCE */
+# else /* MSWIN32 || MSWINCE || CYGWIN32 */
 
 #   define add_roots_to_index(p)
 
@@ -175,7 +175,7 @@ GC_bool tmp;
 {
     struct roots * old;
     
-#   if defined(MSWIN32) || defined(MSWINCE)
+#   if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32)
       /* Spend the time to ensure that there are no overlapping	*/
       /* or adjacent intervals.					*/
       /* This could be done faster with e.g. a			*/
@@ -244,7 +244,7 @@ GC_bool tmp;
     GC_static_roots[n_root_sets].r_start = (ptr_t)b;
     GC_static_roots[n_root_sets].r_end = (ptr_t)e;
     GC_static_roots[n_root_sets].r_tmp = tmp;
-#   if !defined(MSWIN32) && !defined(MSWINCE)
+#   if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
       GC_static_roots[n_root_sets].r_next = 0;
 #   endif
     add_roots_to_index(GC_static_roots + n_root_sets);
@@ -263,7 +263,7 @@ void GC_clear_roots GC_PROTO((void))
     roots_were_cleared = TRUE;
     n_root_sets = 0;
     GC_root_size = 0;
-#   if !defined(MSWIN32) && !defined(MSWINCE)
+#   if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
     {
     	register int i;
     	
@@ -285,7 +285,7 @@ int i;
     n_root_sets--;
 }
 
-#if !defined(MSWIN32) && !defined(MSWINCE)
+#if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
 static void GC_rebuild_root_index()
 {
     register int i;
@@ -308,12 +308,12 @@ void GC_remove_tmp_roots()
     	    i++;
     }
     }
-    #if !defined(MSWIN32) && !defined(MSWINCE)
+    #if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
     GC_rebuild_root_index();
     #endif
 }
 
-#if !defined(MSWIN32) && !defined(MSWINCE)
+#if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
 void GC_remove_roots(b, e)
 char * b; char * e;
 {
@@ -340,9 +340,9 @@ char * b; char * e;
     }
     GC_rebuild_root_index();
 }
-#endif /* !defined(MSWIN32) && !defined(MSWINCE) */
+#endif /* !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32) */
 
-#if defined(MSWIN32) || defined(_WIN32_WCE_EMULATION)
+#if defined(MSWIN32) || defined(_WIN32_WCE_EMULATION) || defined(CYGWIN32)
 /* Workaround for the OS mapping and unmapping behind our back:		*/
 /* Is the address p in one of the temporary static root sections?	*/
 GC_bool GC_is_tmp_root(p)
@@ -364,7 +364,7 @@ ptr_t p;
     }
     return(FALSE);
 }
-#endif /* MSWIN32 || _WIN32_WCE_EMULATION */
+#endif /* MSWIN32 || _WIN32_WCE_EMULATION || defined(CYGWIN32) */
 
 ptr_t GC_approx_sp()
 {
@@ -557,7 +557,7 @@ void GC_push_gc_structures GC_PROTO((void))
 void GC_cond_register_dynamic_libraries()
 {
 # if (defined(DYNAMIC_LOADING) || defined(MSWIN32) || defined(MSWINCE) \
-     || defined(PCR)) && !defined(SRC_M3)
+     || defined(CYGWIN32) || defined(PCR)) && !defined(SRC_M3)
     GC_remove_tmp_roots();
     if (!GC_no_dls) GC_register_dynamic_libraries();
 # else
Index: boehm-gc/dyn_load.c
===================================================================
--- boehm-gc/dyn_load.c	(revision 156830)
+++ boehm-gc/dyn_load.c	(working copy)
@@ -49,10 +49,13 @@
 #   undef GC_must_restore_redefined_dlopen
 # endif
 
-#if (defined(DYNAMIC_LOADING) || defined(MSWIN32) || defined(MSWINCE)) \
+#if (defined(DYNAMIC_LOADING) \
+	|| defined(MSWIN32)   \
+	|| defined(MSWINCE)   \
+	|| defined(CYGWIN32)) \
     && !defined(PCR)
 #if !defined(SUNOS4) && !defined(SUNOS5DL) && !defined(IRIX5) && \
-    !defined(MSWIN32) && !defined(MSWINCE) && \
+    !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32) && \
     !(defined(ALPHA) && defined(OSF1)) && \
     !defined(HPUX) && !(defined(LINUX) && defined(__ELF__)) && \
     !defined(RS6000) && !defined(SCO_ELF) && !defined(DGUX) && \
@@ -717,7 +720,7 @@ void GC_register_dynamic_libraries()
 
 # endif /* USE_PROC || IRIX5 */
 
-# if defined(MSWIN32) || defined(MSWINCE)
+# if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32)
 
 # define WIN32_LEAN_AND_MEAN
 # define NOSERVICE
@@ -761,7 +764,7 @@ void GC_register_dynamic_libraries()
     }
 # endif
 
-# ifdef MSWINCE
+# if defined(MSWINCE) || defined(CYGWIN32)
   /* Do we need to separately register the main static data segment? */
   GC_bool GC_register_main_static_data()
   {
@@ -868,8 +871,12 @@ void GC_register_dynamic_libraries()
   }
 # endif /* DEBUG_VIRTUALQUERY */
 
-  extern GC_bool GC_wnt;  /* Is Windows NT derivative.		*/
-  			  /* Defined and set in os_dep.c.	*/
+# ifdef CYGWIN32
+#   define GC_wnt (TRUE)
+# else
+    extern GC_bool GC_wnt;  /* Is Windows NT derivative.	*/
+  			    /* Defined and set in os_dep.c.	*/
+# endif
 
   void GC_register_dynamic_libraries()
   {
@@ -934,7 +941,7 @@ void GC_register_dynamic_libraries()
     GC_cond_add_roots(base, limit);
   }
 
-#endif /* MSWIN32 || MSWINCE */
+#endif /* MSWIN32 || MSWINCE || CYGWIN32 */
   
 #if defined(ALPHA) && defined(OSF1)
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] [4.5 regression] Fix PR42811: java.lang.ExceptionInInitializerError   in ecj1 and associated issues.
  2010-02-20 18:18 [PATCH] [4.5 regression] Fix PR42811: java.lang.ExceptionInInitializerError in ecj1 and associated issues Dave Korn
@ 2010-02-22 10:12 ` Andrew Haley
  2010-02-22 16:49   ` Dave Korn
  2010-03-20 14:29   ` [PATCH,final respin] " Dave Korn
  0 siblings, 2 replies; 6+ messages in thread
From: Andrew Haley @ 2010-02-22 10:12 UTC (permalink / raw)
  To: Dave Korn; +Cc: Java Patches, GCC Patches

On 02/20/2010 06:36 PM, Dave Korn wrote:
> [ refs: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42811
>         http://gcc.gnu.org/ml/java/2010-02/msg00002.html
>         http://gcc.gnu.org/ml/java/2010-02/threads.html#00004 ]
> 
>     Hi lists,
> 
>   The attached patches resolve PR42811 and the knock-on issues uncovered while
> fixing it (see refs).  I've separated them out for ease of review but I've
> tested them as a group and would like to ask the java maintainers whether they
> need to be applied separately or can all just go in as one.  Thanks are due to
> Hans and Bryce for their help in solving this one.
> 
>   The main PR is resolved by ensuring that both parts of the whole libgcj are
> always loaded, so that all the predefined class data from both sets of .jcr
> sections is always present at runtime.
> 
>   The uninitialised memory fix is straightforward and was already approved by
> Bryce in a separate thread, I quote it here for completeness, and with a
> slightly reworded changelog in case it needs to be applied separately from the
> fix for the main PR.
> 
>   The second copy of the gc code living in the -noncore sublibrary turned out
> very fortunately to be completely dead, only present because of
> --whole-archive; none of the -noncore code needed to link it at all, so there
> was no need to export it from the core sublibrary for the -noncore one to use.
>  Of course it was still a waste of time, memory and disk space, and it
> confused the hell out of gdb for some reason.  The same turned out to apply to
> the other convenience libs required by the main sublibrary, so I trivially
> removed them all.
> 
>   The changes to the boehm-gc are largely mechanical, and basically involve
> turning on the pseudo-support for DYNAMIC_LOADING that is implemented for the
> other windows hosts.  I simplified away the version checking, because cygwin
> never runs on any windows version that doesn't support DLLs (i.e. win32s), and
> it uses the unix get mem function so as to get memory from the cygwin
> allocator rather than allocating it from the windows api "behind cygwin's
> back"; apart from that, the usage of the VirtualQuery to determine memory
> ranges and properties will be absolutely fine on Cygwin, so I didn't try and
> rewrite it to use something based on mprotect() or whatever other posix api.
> 
> 
> pr42811-final.diff:
> 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.
> 	configure: Regenerate.
> 
> pr42811-associated-uninitmem-fix.diff:
> libjava/ChangeLog:
> 
> 	* jvmti.cc (_Jv_GetJVMTIEnv): Avoid use of uninitialised memory.
> 
> pr42811-associated-dead-lib-code-link-fix.diff:
> libjava/ChangeLog:
> 
> 	* Makefile.am (libgcj_noncore_la_LIBADD): Don't include standard
> 	list of libtool convenience libs only needed by main library.
> 	* Makefile.in: Regenerate.
> 
> pr42811-associated-gc-fixes.diff:
> boehm-gc/ChangeLog:
> 
> 	* include/private/gc_priv.h (struct roots) [CYGWIN32]: Don't
> 	declare r_next member on Cygwin as on other windows hosts.
> 	(LOG_RT_SIZE) [CYGWIN32]: Don't define likewise.
> 	(RT_SIZE) [CYGWIN32]: Likewise.
> 	(struct _GC_arrays) [CYGWIN32]: Do declare _heap_bases[] member
> 	likewise.
> 	(GC_heap_bases) [CYGWIN32]: Do define likewise.
> 	(struct _SYSTEM_INFO) [CYGWIN32]: Do forward-declare likewise.
> 	(GC_sysinfo) [CYGWIN32]: Do declare extern likewise.
> 	(GC_n_heap_bases) [CYGWIN32]: Likewise.
> 	(GC_is_tmp_root) [CYGWIN32]: Do prototype likewise.
> 	* include/private/gcconfig.h (GC_win32_get_mem) [CYGWIN32]: Likewise.
> 	(GET_MEM) [CYGWIN32]: Do define likewise.
> 	* boehm-gc/ptr_chck.c (GC_is_visible) [CYGWIN32]: Do handle dynamic
> 	registration likewise.
> 	* boehm-gc/os_dep.c (GC_setpagesize) [CYGWIN32]: Do define likewise.
> 	(GC_no_win32_dlls) [CYGWIN32]: Define as constant false, unlike
> 	other windows hosts.
> 	(GC_sysinfo) [CYGWIN32]: Define as on other windows hosts.
> 	(GC_n_heap_bases) [CYGWIN32]: Likewise.
> 	(GLOBAL_ALLOC_TEST) [CYGWIN32]: Likewise.
> 	(GC_win32_get_mem) [CYGWIN32]: Likewise, but wrapping GC_unix_get_mem
> 	rather than GlobalAlloc/VirtualAlloc.
> 	(GC_win32_free_heap) [CYGWIN32]: Likewise, but wrapping free instead
> 	of GlobalFree (even though the function body is optimised away).
> 	* boehm-gc/mark_rts.c (add_roots_to_index) [CYGWIN32]: Define as on
> 	other windows hosts.
> 	(GC_add_roots_inner) [CYGWIN32]: Avoid overlapping or adjacent
> 	intervals likewise.
> 	(GC_clear_roots) [CYGWIN32]: Clear GC_root_index[] likewise.
> 	(GC_rebuild_root_index) [CYGWIN32]: Define as on other windows hosts.
> 	(GC_remove_tmp_roots) [CYGWIN32]: Call it likewise.
> 	(GC_remove_roots) [CYGWIN32]: Don't define, as on other windows hosts.
> 	(GC_is_tmp_root) [CYGWIN32]: Define, as on other windows hosts.
> 	(GC_cond_register_dynamic_libraries) [CYGWIN32]: Handle temporary
> 	roots and dynamic registration likewise.
> 	* boehm-gc/dyn_load.c (GC_has_static_roots) [CYGWIN32]: Define as on
> 	other windows hosts.
> 	(GC_register_has_static_roots_callback) [CYGWIN32]: Likewise.
> 	(GC_cond_add_roots) [CYGWIN32]: Likewise.
> 	(GC_register_main_static_data) [CYGWIN32]: Define to always return
> 	false, as on MSWINCE
> 	(HAVE_REGISTER_MAIN_STATIC_DATA) [CYGWIN32]: Define as on other
> 	windows hosts.
> 	(GC_warn_fb) [CYGWIN32]: Likewise.
> 	(GC_disallow_ignore_fb) [CYGWIN32]: Likewise.
> 	(GC_ignore_fb_mb) [CYGWIN32]: Likewise.
> 	(GC_ignore_fb) [CYGWIN32]: Likewise.
> 	(is_frame_buffer) [CYGWIN32]: Likewise.
> 	(GC_dump_meminfo) [CYGWIN32]: Likewise.
> 	(GC_wnt) [CYGWIN32]: Define to constant true.
> 	(GC_register_dynamic_libraries) [CYGWIN32]: Define as on other
> 	windows hosts.
> 
> 
>   Bootstrapped and tested on i686-pc-cygwin; fixes PR42811 and doesn't cause
> any further regressions (there are some preexisting fails that this makes no
> difference to).  OK for head?

A couple of things:

1.  Bounce the gc changes off gc@napali.hpl.hp.com .
2.  Is it really necessary to make the main program depend on a symbol
    in libgcj-noncore when BC compiling?  Can't you make the libgcj
    itself depend on libgcj-noncore?

Andrew.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] [4.5 regression] Fix PR42811: java.lang.ExceptionInInitializerError  in ecj1 and associated issues.
  2010-02-22 10:12 ` Andrew Haley
@ 2010-02-22 16:49   ` Dave Korn
  2010-03-19 15:55     ` Dave Korn
  2010-03-20 14:29   ` [PATCH,final respin] " Dave Korn
  1 sibling, 1 reply; 6+ messages in thread
From: Dave Korn @ 2010-02-22 16:49 UTC (permalink / raw)
  To: Andrew Haley; +Cc: Dave Korn, Java Patches, GCC Patches

On 22/02/2010 10:12, Andrew Haley wrote:

>>   Bootstrapped and tested on i686-pc-cygwin; fixes PR42811 and doesn't cause
>> any further regressions (there are some preexisting fails that this makes no
>> difference to).  OK for head?
> 
> A couple of things:
> 
> 1.  Bounce the gc changes off gcSPLATnapali.hpl.hp.com .

  Certainly shall, I imagine Hans will be expecting me to.  (It'll take me
some work though, the patch doesn't apply cleanly against upstream cvs, I
already checked; I'll need to verify how much has changed and make sure the
patch is still correct wrt. any internals differences.)

> 2.  Is it really necessary to make the main program depend on a symbol
>     in libgcj-noncore when BC compiling?  Can't you make the libgcj
>     itself depend on libgcj-noncore?

  I probably could, in stage 1, but it would require a large amount of build
system hackery that I don't want to risk at stage 3.  The noncore dll already
depends on the core dll, so if I added a dependency the other way round we'd
have a circular loop.  You can only link a DLL if it's fully resolved
(critical difference from ELF DSOs there), so whichever one we tried to link
first, it would have missing imports from the other.  There is a way round
that, we could use 'dlltool' to build just an import stub library for one of
them separately, first, then fully link the other, generating its own import
library in the process that would let libtool link the original library in the
first place.  But... that would require having a complete list of exports (to
make a .DEF file), and we don't have such a list either, we just have a
version script with some pattern matches; so we'd have to build the dll fully
and find out which symbols did actually get hidden and which made visible ....
at which point we'd have an import library anyway.  So probably the only way
to make it work would be to invoke libtool twice for the same library, once to
build the core dll without this dependency, so that we can then link (and
fully resolve) the noncore dll, and once again after linking the noncore dll,
to relink a version of the core dll with the dependency against the noncore
one added this time round.  (On slightly deeper thought, it might be possible
to generate a fake import stub library, just for the purpose of linking the
core dll, with a single import for the one manually chosen symbol that I'm
using anyway, but I haven't tested that theory yet; I'm making it up as I type
here.)

  So, yeh, I've thought about it, because until I figured out a partitioning
which only had dependencies in one direction, I thought I was going to have to
do it that way all along, and avoiding having to do so was the reason I chose
to try and partition the libraries according to the dependencies between the
object files in the first place.  (That worked, so I stopped thinking about it!)

  If we can think of a non-ugly way of making a circular dependency between
the two libraries, we can change that in the future and stop adding this
dependency to executables without affecting binary compatibility in any way
either forward- or backward-, but I can't really envisage any actual benefits
from doing so, apart from things being a bit conceptually cleaner and nicer,
unless I've overlooked something?  (Do we have to ever worry about anyone
trying to link java applications using 'ld' directly and avoiding the gcj
driver and its specs?  I wouldn't have expected so!)

  Anyway, that's why I figured on taking the simple approach right now; it'll
work, and it's simple, and we can change it without problems in the future.

  Stage 3 probably isn't going to finish this week, but it probably isn't
going to last much longer either.  How about we commit this one now, as
insurance against the branch getting cut, but I also go ahead and see if I can
figure out how to get the dlltool-plus-fake-DEF-file trick working as well; if
I can get it to work while stage 3 is still running, we can revert the change
to the specs at the same time.  OK?

    cheers,
      DaveK

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] [4.5 regression] Fix PR42811: java.lang.ExceptionInInitializerError  in ecj1 and associated issues.
  2010-02-22 16:49   ` Dave Korn
@ 2010-03-19 15:55     ` Dave Korn
  0 siblings, 0 replies; 6+ messages in thread
From: Dave Korn @ 2010-03-19 15:55 UTC (permalink / raw)
  To: Dave Korn; +Cc: Andrew Haley, Java Patches, GCC Patches


  I got busy for a while, but I haven't forgotten this one.

On 22/02/2010 17:07, Dave Korn wrote:
> On 22/02/2010 10:12, Andrew Haley wrote:
> 
>>>   Bootstrapped and tested on i686-pc-cygwin; fixes PR42811 and doesn't cause
>>> any further regressions (there are some preexisting fails that this makes no
>>> difference to).  OK for head?
>> A couple of things:
>>
>> 1.  Bounce the gc changes off gcSPLATnapali.hpl.hp.com .

  I've now sent the changes upstream.

http://permalink.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/3806

>> 2.  Is it really necessary to make the main program depend on a symbol
>>     in libgcj-noncore when BC compiling?  Can't you make the libgcj
>>     itself depend on libgcj-noncore?

  With some help from Ralf (thanks Ralf!) I have figured out an approach that
I think can make this work.  I'm just building it now, and hope to post it for
review by the end of today.

    cheers,
      DaveK

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH,final respin] [4.5 regression] Fix PR42811: java.lang.ExceptionInInitializerError  in ecj1 and associated issues.
  2010-02-22 10:12 ` Andrew Haley
  2010-02-22 16:49   ` Dave Korn
@ 2010-03-20 14:29   ` Dave Korn
  2010-03-20 18:17     ` Andrew Haley
  1 sibling, 1 reply; 6+ messages in thread
From: Dave Korn @ 2010-03-20 14:29 UTC (permalink / raw)
  To: Andrew Haley; +Cc: Dave Korn, Java Patches, GCC Patches

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

> On 02/20/2010 06:36 PM, Dave Korn wrote:

>>   Bootstrapped and tested on i686-pc-cygwin; fixes PR42811 and doesn't cause
>> any further regressions (there are some preexisting fails that this makes no
>> difference to).  OK for head?
> 
> A couple of things:
> 
> 1.  Bounce the gc changes off gc@napali

  The GC changes have now been accepted upstream.  During porting them, I
developed a testcase, which (by your kind permission) I will submit as a
separate patch shortly after this round of patches is accepted and checked in.

> 2.  Is it really necessary to make the main program depend on a symbol
>     in libgcj-noncore when BC compiling?  Can't you make the libgcj
>     itself depend on libgcj-noncore?

  It turns out that I can, and I can do it without having to hack libtool or
do anything else unsuitable (IMO) for stage 3.  Bootstrapped, and test results
posted(*), no regressions.

pr42811-final.diff
libjava/ChangeLog:

	* libjava/configure.ac (DLLTOOL): Call AC_CHECK_TOOL.
	(libgcj_sublib_core_extra_deps): New host-dependent configure var.
	(LIBGCJ_SUBLIB_CORE_EXTRA_DEPS): AC_SUBST it.
	* libjava/configure.host (libgcj_sublib_core_extra_deps): Define
	appropriately on Cygwin and MinGW.
	(libgcj_sublib_core_extra_deps): Add libgcj-noncore-dummy import
	stub library on Cygwin and MinGW.
	* libjava/Makefile.am (LIBJAVA_CORE_EXTRA): Import AC_SUBST'd
	LIBGCJ_SUBLIB_CORE_EXTRA_DEPS if building sublibs, else define empty.
	(libgcj_la_DEPENDENCIES): Use it.
	(DLL_VERSION): New makefile macro.
	(libgcj-noncore-dummy.dll.a): New build rule for dummy import stub
	library.
	(libgcj_noncore_la_LIBADD): Trim superfluous convenience libs.
	(AM_MAKEFLAGS): Add DLLTOOL recursive propagation.
	* libjava/libgcj-noncore-dummy.def: New file.
	* libjava/Makefile.in: Regenerate.
	* libjava/include/Makefile.in: Likewise.
	* libjava/testsuite/Makefile.in: Likewise.
	* libjava/configure: Likewise.
	* libjava/gcj/Makefile.in: Likewise.

pr42811-uninit-mem-fix.diff:
libjava/ChangeLog:

	* jvmti.cc (_Jv_GetJVMTIEnv): Avoid use of uninitialised memory.

pr42811-boehm-gc-fixes.diff:
boehm-gc/ChangeLog:

	* include/private/gc_priv.h (struct roots) [CYGWIN32]: Don't
	declare r_next member on Cygwin as on other windows hosts.
	(LOG_RT_SIZE) [CYGWIN32]: Don't define likewise.
	(RT_SIZE) [CYGWIN32]: Likewise.
	(struct _GC_arrays) [CYGWIN32]: Do declare _heap_bases[] member
	likewise.
	(GC_heap_bases) [CYGWIN32]: Do define likewise.
	(struct _SYSTEM_INFO) [CYGWIN32]: Do forward-declare likewise.
	(GC_sysinfo) [CYGWIN32]: Do declare extern likewise.
	(GC_n_heap_bases) [CYGWIN32]: Likewise.
	(GC_is_tmp_root) [CYGWIN32]: Do prototype likewise.
	* include/private/gcconfig.h (GC_win32_get_mem) [CYGWIN32]: Likewise.
	(GET_MEM) [CYGWIN32]: Do define likewise.
	* boehm-gc/ptr_chck.c (GC_is_visible) [CYGWIN32]: Do handle dynamic
	registration likewise.
	* boehm-gc/os_dep.c (GC_setpagesize) [CYGWIN32]: Do define likewise.
	(GC_no_win32_dlls) [CYGWIN32]: Define as constant false, unlike
	other windows hosts.
	(GC_sysinfo) [CYGWIN32]: Define as on other windows hosts.
	(GC_n_heap_bases) [CYGWIN32]: Likewise.
	(GLOBAL_ALLOC_TEST) [CYGWIN32]: Likewise.
	(GC_win32_get_mem) [CYGWIN32]: Likewise, but wrapping GC_unix_get_mem
	rather than GlobalAlloc/VirtualAlloc.
	(GC_win32_free_heap) [CYGWIN32]: Likewise, but wrapping free instead
	of GlobalFree (even though the function body is optimised away).
	* boehm-gc/mark_rts.c (add_roots_to_index) [CYGWIN32]: Define as on
	other windows hosts.
	(GC_add_roots_inner) [CYGWIN32]: Avoid overlapping or adjacent
	intervals likewise.
	(GC_clear_roots) [CYGWIN32]: Clear GC_root_index[] likewise.
	(GC_rebuild_root_index) [CYGWIN32]: Define as on other windows hosts.
	(GC_remove_tmp_roots) [CYGWIN32]: Call it likewise.
	(GC_remove_roots) [CYGWIN32]: Don't define, as on other windows hosts.
	(GC_is_tmp_root) [CYGWIN32]: Define, as on other windows hosts.
	(GC_cond_register_dynamic_libraries) [CYGWIN32]: Handle temporary
	roots and dynamic registration likewise.
	* boehm-gc/dyn_load.c (GC_has_static_roots) [CYGWIN32]: Define as on
	other windows hosts.
	(GC_register_has_static_roots_callback) [CYGWIN32]: Likewise.
	(GC_cond_add_roots) [CYGWIN32]: Likewise.
	(GC_register_main_static_data) [CYGWIN32]: Define to always return
	false, as on MSWINCE
	(HAVE_REGISTER_MAIN_STATIC_DATA) [CYGWIN32]: Define as on other
	windows hosts.
	(GC_warn_fb) [CYGWIN32]: Likewise.
	(GC_disallow_ignore_fb) [CYGWIN32]: Likewise.
	(GC_ignore_fb_mb) [CYGWIN32]: Likewise.
	(GC_ignore_fb) [CYGWIN32]: Likewise.
	(is_frame_buffer) [CYGWIN32]: Likewise.
	(GC_dump_meminfo) [CYGWIN32]: Likewise.
	(GC_wnt) [CYGWIN32]: Define to constant true.
	(GC_register_dynamic_libraries) [CYGWIN32]: Define as on other
	windows hosts.

  OK for HEAD?

    cheers,
      DaveK
-- 
(*) - http://gcc.gnu.org/ml/gcc-testresults/2010-03/msg01722.html
      http://gcc.gnu.org/ml/gcc-testresults/2010-03/msg01723.html

First post (clean build) has two sets of results because test_summary
discovered an old build dir I had renamed aside; please disregard the first
set of results, the second set (2522 passes) is the one that matches the
patched results.  The reason I had an old dir renamed aside is that I did my
clean bootstrap and tested it, then upgraded my cygwin dll, so figured I'd
better blow away the target libjava dir, remake configure-target-libjava and
all-target-libjava against the new DLL, and re-run the tests, as test runs
against different versions of the cygwin DLL are not necessarily
commensurable.  Patched build was bootstrapped to completion and tested
entirely after the upgrade.


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

Index: libjava/configure.ac
===================================================================
--- libjava/configure.ac	(revision 157534)
+++ libjava/configure.ac	(working copy)
@@ -157,6 +157,7 @@ AC_CHECK_TOOL(AS, as)
 AC_CHECK_TOOL(LD, ld)
 AC_CHECK_TOOL(AR, ar)
 AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(DLLTOOL, dlltool, :)
 AC_PROG_AWK
 AC_CHECK_PROGS([JAR], [jar fastjar gjar], no)
 AC_PATH_PROG([ZIP], [zip], no)
@@ -194,13 +195,16 @@ AC_EXEEXT
 #	libgcj_cxxflags  - host specific C++ compiler flags
 #	libgcj_javaflags - host specific Java compiler flags
 #	libgcj_sublib_ltflags - host specific Libtool flags 
-#                          (only used when building sublibs)
+#	libgcj_sublib_core_extra_deps - host specific extra 
+#			   dependencies for core sublib
+#	(these last two only used when building sublibs)
 # and a number of others; see the list at the start of the file.
 
 libgcj_cflags=
 libgcj_cxxflags=
 libgcj_javaflags=
 libgcj_sublib_ltflags=
+libgcj_sublib_core_extra_deps=
 
 . ${srcdir}/configure.host
 
@@ -214,12 +218,14 @@ LIBGCJ_CFLAGS="${libgcj_cflags}"
 LIBGCJ_CXXFLAGS="${libgcj_cxxflags}"
 LIBGCJ_JAVAFLAGS="${libgcj_javaflags}"
 LIBGCJ_SUBLIB_LTFLAGS="${libgcj_sublib_ltflags}"
+LIBGCJ_SUBLIB_CORE_EXTRA_DEPS="${libgcj_sublib_core_extra_deps}"
 LIBGCJ_LD_SYMBOLIC="${libgcj_ld_symbolic}"
 LIBGCJ_LD_SYMBOLIC_FUNCTIONS="${libgcj_ld_symbolic_functions}"
 AC_SUBST(LIBGCJ_CFLAGS)
 AC_SUBST(LIBGCJ_CXXFLAGS)
 AC_SUBST(LIBGCJ_JAVAFLAGS)
 AC_SUBST(LIBGCJ_SUBLIB_LTFLAGS)
+AC_SUBST(LIBGCJ_SUBLIB_CORE_EXTRA_DEPS)
 AC_SUBST(LIBGCJ_LD_SYMBOLIC)
 AC_SUBST(LIBGCJ_LD_SYMBOLIC_FUNCTIONS)
 
Index: libjava/configure.host
===================================================================
--- libjava/configure.host	(revision 157534)
+++ libjava/configure.host	(working copy)
@@ -18,7 +18,8 @@
 #   libgcj_cflags	Special CFLAGS to use when building
 #   libgcj_cxxflags	Special CXXFLAGS to use when building
 #   libgcj_javaflags	Special JAVAFLAGS to use when building
-#   libgcj_sublib_ltflags  Special Libtool flags to use when building.
+#   libgcj_sublib_ltflags  Special Libtool flags to use when building sublibs
+#   libgcj_sublib_core_extra_deps  Extra dependencies to add to core sublib
 #   libgcj_interpreter  If the bytecode interpreter supports this platform.
 #   enable_java_net_default  If java.net native code should be enabled by
 #                            default.
@@ -43,6 +44,7 @@ libgcj_cflags=
 libgcj_cxxflags=
 libgcj_javaflags=
 libgcj_sublib_ltflags=
+libgcj_sublib_core_extra_deps=
 libgcj_interpreter=
 enable_java_net_default=yes
 enable_hash_synchronization_default=no
@@ -351,7 +353,9 @@ case "${host}" in
   	BACKTRACESPEC=
 	# Win32 DLLs are limited to 64k exported symbols each.
 	enable_libgcj_sublibs_default=yes
-	libgcj_sublib_ltflags='-no-undefined -bindir $(bindir)'
+	libgcj_sublib_ltflags='-no-undefined -bindir $(bindir) \
+	    -Wl,-u,__ZN3org4ietf4jgss10GSSManagerC1Ev,-L..,-lgcj-noncore-dummy'
+	libgcj_sublib_core_extra_deps=libgcj-noncore-dummy.dll.a
   ;;
 esac
 
Index: libjava/Makefile.am
===================================================================
--- libjava/Makefile.am	(revision 157534)
+++ libjava/Makefile.am	(working copy)
@@ -202,11 +202,13 @@ toolexeclib_LTLIBRARIES += libgcj-noncore.la
 libgcj_noncore_la_LIBADD_SUBOBJECTS = $(NONCORE_PACKAGE_SOURCE_FILES_LO)
 libgcj_la_LIBADD_SUBOBJECTS = $(CORE_PACKAGE_SOURCE_FILES_LO)
 LIBJAVA_LDFLAGS_NOUNDEF = $(LIBGCJ_SUBLIB_LTFLAGS)
+LIBJAVA_CORE_EXTRA = @LIBGCJ_SUBLIB_CORE_EXTRA_DEPS@
 else
 # If not building sublibraries, everything goes in libgcj,
 # and it cannot be usefully built shared on PE platforms.
 libgcj_la_LIBADD_SUBOBJECTS = $(ALL_PACKAGE_SOURCE_FILES_LO)
 LIBJAVA_LDFLAGS_NOUNDEF = 
+LIBJAVA_CORE_EXTRA = 
 endif
 
 if USE_LIBGCJ_BC
@@ -460,7 +462,8 @@ libgcj_la_DEPENDENCIES = libgcj-$(gcc_version).jar
 	java/lang/Class.lo \
 	java/process-$(PLATFORM).lo \
 	$(ALL_PACKAGE_SOURCE_FILES_LO) \
-	$(LIBLTDL) $(libgcj_la_LIBADD)
+	$(LIBLTDL) $(libgcj_la_LIBADD) \
+	$(LIBJAVA_CORE_EXTRA)
 if ANONVERSCRIPT
 libgcj_la_DEPENDENCIES += $(srcdir)/libgcj.ver
 endif
@@ -472,18 +475,29 @@ libgcj_la_LINK = $(LIBLINK) $(libgcj_la_LDFLAGS)
 EXTRA_libgcj_la_SOURCES = java/lang/Object.java
 
 if BUILD_SUBLIBS
+## This extra target is invoked on windows hosts only by adding it
+## to LIBGCJ_SUBLIB_CORE_EXTRA_SRCS in configure.host, which causes
+## it to be linked in to the core DLL and generate a circular import
+## dependency loop between the two DLLs.  This is required to fix
+## PR42811 by ensuring that any application that links against
+## either always loads both at runtime.
+DLL_VERSION=`expr \`grep -v '^\#' $(srcdir)/libtool-version | sed -e 's/\(.*\):\(.*\):.*/\1 + \2/'\``
+libgcj-noncore-dummy.dll.a : $(srcdir)/libgcj-noncore-dummy.def
+	$(DLLTOOL) -d $^ -l $@ --dllname cyggcj-noncore-$(DLL_VERSION).dll 
+
+## These are the libtool definitions for the noncore library.
 libgcj_noncore_la_SOURCES =
 libgcj_noncore_la_LDFLAGS = $(libgcj_la_LDFLAGS)
-libgcj_noncore_la_LIBADD = $(libgcj_noncore_la_LIBADD_SUBOBJECTS) \
-		$(LIBFFI) $(ZLIBS) $(GCLIBS) libgcj.la
+libgcj_noncore_la_LIBADD = $(libgcj_noncore_la_LIBADD_SUBOBJECTS) libgcj.la
 libgcj_noncore_la_DEPENDENCIES = libgcj-$(gcc_version).jar $(LIBLTDL) \
 		$(libgcj_noncore_la_LIBADD) libgcj.la
 if ANONVERSCRIPT
 libgcj_noncore_la_DEPENDENCIES += $(srcdir)/libgcj.ver
 endif
 libgcj_noncore_la_LINK = $(libgcj_la_LINK)
-endif
 
+endif	# BUILD_SUBLIBS
+
 # We compile libgcj_tools with -findirect-dispatch so that they can
 # depend on external classes: in particular, gjdoc uses antlr.  In
 # addition, -fno-bootstrap-classes ensures that the tools are loaded
@@ -1513,6 +1527,7 @@ AM_MAKEFLAGS = \
 	"gxx_include_dir=$(gxx_include_dir)" \
 	"AR=$(AR)" \
 	"AS=$(AS)" \
+	"DLLTOOL=$(DLLTOOL)" \
 	"LD=$(LD)" \
 	"LIBCFLAGS=$(LIBCFLAGS)" \
 	"NM=$(NM)" \
Index: libjava/libgcj-noncore-dummy.def
===================================================================
--- libjava/libgcj-noncore-dummy.def	(revision 0)
+++ libjava/libgcj-noncore-dummy.def	(revision 0)
@@ -0,0 +1,7 @@
+
+LIBRARY cyggcj-noncore-11.dll
+
+EXPORTS
+
+  _ZN3org4ietf4jgss10GSSManagerC1Ev
+

[-- Attachment #3: pr42811-uninit-mem-fix.diff --]
[-- Type: text/x-c, Size: 503 bytes --]

Index: libjava/jvmti.cc
===================================================================
--- libjava/jvmti.cc	(revision 157534)
+++ libjava/jvmti.cc	(working copy)
@@ -2210,6 +2210,7 @@ _Jv_GetJVMTIEnv (void)
 {
   _Jv_JVMTIEnv *env
     = (_Jv_JVMTIEnv *) _Jv_MallocUnchecked (sizeof (_Jv_JVMTIEnv));
+  memset (env, 0, sizeof (_Jv_JVMTIEnv));
   env->p = &_Jv_JVMTI_Interface;
   struct jvmti_env_list *element
     = (struct jvmti_env_list *) _Jv_MallocUnchecked (sizeof (struct jvmti_env_list));

[-- Attachment #4: pr42811-boehm-gc-fixes.diff --]
[-- Type: text/x-c, Size: 11835 bytes --]

Index: boehm-gc/include/private/gc_priv.h
===================================================================
--- boehm-gc/include/private/gc_priv.h	(revision 157534)
+++ boehm-gc/include/private/gc_priv.h	(working copy)
@@ -833,14 +833,14 @@ struct exclusion {
 struct roots {
 	ptr_t r_start;
 	ptr_t r_end;
-#	if !defined(MSWIN32) && !defined(MSWINCE)
+#	if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
 	  struct roots * r_next;
 #	endif
 	GC_bool r_tmp;
 	  	/* Delete before registering new dynamic libraries */
 };
 
-#if !defined(MSWIN32) && !defined(MSWINCE)
+#if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
     /* Size of hash table index to roots.	*/
 #   define LOG_RT_SIZE 6
 #   define RT_SIZE (1 << LOG_RT_SIZE) /* Power of 2, may be != MAX_ROOT_SETS */
@@ -1024,7 +1024,7 @@ struct _GC_arrays {
   struct HeapSect {
       ptr_t hs_start; word hs_bytes;
   } _heap_sects[MAX_HEAP_SECTS];
-# if defined(MSWIN32) || defined(MSWINCE)
+# if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32)
     ptr_t _heap_bases[MAX_HEAP_SECTS];
     		/* Start address of memory regions obtained from kernel. */
 # endif
@@ -1033,7 +1033,7 @@ struct _GC_arrays {
     		/* Commited lengths of memory regions obtained from kernel. */
 # endif
   struct roots _static_roots[MAX_ROOT_SETS];
-# if !defined(MSWIN32) && !defined(MSWINCE)
+# if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
     struct roots * _root_index[RT_SIZE];
 # endif
   struct exclusion _excl_table[MAX_EXCLUSIONS];
@@ -1091,7 +1091,7 @@ GC_API GC_FAR struct _GC_arrays GC_arrays;
 # ifdef USE_MUNMAP
 #   define GC_unmapped_bytes GC_arrays._unmapped_bytes
 # endif
-# if defined(MSWIN32) || defined(MSWINCE)
+# if defined(MSWIN32) || defined(MSWINCE) || defined (CYGWIN32)
 #   define GC_heap_bases GC_arrays._heap_bases
 # endif
 # ifdef MSWINCE
@@ -1187,7 +1187,7 @@ extern word GC_n_heap_sects;	/* Number of separate
 
 extern word GC_page_size;
 
-# if defined(MSWIN32) || defined(MSWINCE)
+# if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32)
   struct _SYSTEM_INFO;
   extern struct _SYSTEM_INFO GC_sysinfo;
   extern word GC_n_heap_bases;	/* See GC_heap_bases.	*/
@@ -1479,7 +1479,7 @@ void GC_remove_roots_inner GC_PROTO((char * b, cha
 GC_bool GC_is_static_root GC_PROTO((ptr_t p));
   		/* Is the address p in one of the registered static	*/
   		/* root sections?					*/
-# if defined(MSWIN32) || defined(_WIN32_WCE_EMULATION)
+# if defined(MSWIN32) || defined(_WIN32_WCE_EMULATION) || defined(CYGWIN32)
 GC_bool GC_is_tmp_root GC_PROTO((ptr_t p));
 		/* Is the address p in one of the temporary static	*/
 		/* root sections?					*/
Index: boehm-gc/include/private/gcconfig.h
===================================================================
--- boehm-gc/include/private/gcconfig.h	(revision 157534)
+++ boehm-gc/include/private/gcconfig.h	(working copy)
@@ -2375,7 +2375,7 @@
 					      calloc(1, (size_t)bytes + GC_page_size) \
 					      + GC_page_size-1)
 #     else
-#	ifdef MSWIN32
+#	if defined(MSWIN32) || defined(CYGWIN32)
 	  extern ptr_t GC_win32_get_mem();
 #         define GET_MEM(bytes) (struct hblk *)GC_win32_get_mem(bytes)
 #	else
Index: boehm-gc/ptr_chck.c
===================================================================
--- boehm-gc/ptr_chck.c	(revision 157534)
+++ boehm-gc/ptr_chck.c	(working copy)
@@ -247,7 +247,7 @@ ptr_t p;
     	    if (GC_is_static_root(p)) return(p);
     	    /* Else do it again correctly:	*/
 #           if (defined(DYNAMIC_LOADING) || defined(MSWIN32) || \
-		defined(MSWINCE) || defined(PCR)) \
+		defined(MSWINCE) || defined (CYGWIN32) || defined(PCR)) \
                 && !defined(SRC_M3)
     	        DISABLE_SIGNALS();
     	        GC_register_dynamic_libraries();
Index: boehm-gc/os_dep.c
===================================================================
--- boehm-gc/os_dep.c	(revision 157534)
+++ boehm-gc/os_dep.c	(working copy)
@@ -107,7 +107,7 @@
 # undef GC_AMIGA_DEF
 #endif
 
-#if defined(MSWIN32) || defined(MSWINCE)
+#if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32)
 # define WIN32_LEAN_AND_MEAN
 # define NOSERVICE
 # include <windows.h>
@@ -584,7 +584,7 @@ void GC_enable_signals()
 /* Find the page size */
 word GC_page_size;
 
-# if defined(MSWIN32) || defined(MSWINCE)
+# if defined(MSWIN32) || defined(MSWINCE) || defined (CYGWIN32)
   void GC_setpagesize()
   {
     GetSystemInfo(&GC_sysinfo);
@@ -1169,8 +1169,12 @@ void GC_register_data_segments()
 
 # else /* !OS2 */
 
-# if defined(MSWIN32) || defined(MSWINCE)
+# if defined(MSWIN32) || defined(MSWINCE) || defined (CYGWIN32)
 
+# ifdef CYGWIN32
+#    define GC_no_win32_dlls (FALSE)
+# endif
+
 # ifdef MSWIN32
   /* Unfortunately, we have to handle win32s very differently from NT, 	*/
   /* Since VirtualQuery has very different semantics.  In particular,	*/
@@ -1664,25 +1668,28 @@ void * os2_alloc(size_t bytes)
 # endif /* OS2 */
 
 
-# if defined(MSWIN32) || defined(MSWINCE)
+# if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32)
 SYSTEM_INFO GC_sysinfo;
 # endif
 
-# ifdef MSWIN32
+# if defined(MSWIN32) || defined(CYGWIN32)
 
+word GC_n_heap_bases = 0;
+
 # ifdef USE_GLOBAL_ALLOC
 #   define GLOBAL_ALLOC_TEST 1
 # else
 #   define GLOBAL_ALLOC_TEST GC_no_win32_dlls
 # endif
 
-word GC_n_heap_bases = 0;
-
 ptr_t GC_win32_get_mem(bytes)
 word bytes;
 {
     ptr_t result;
 
+# ifdef CYGWIN32
+    result = GC_unix_get_mem (bytes);
+# else
     if (GLOBAL_ALLOC_TEST) {
     	/* VirtualAlloc doesn't like PAGE_EXECUTE_READWRITE.	*/
     	/* There are also unconfirmed rumors of other		*/
@@ -1702,6 +1709,7 @@ word bytes;
     				      MEM_COMMIT | MEM_RESERVE,
     				      PAGE_EXECUTE_READWRITE);
     }
+#endif
     if (HBLKDISPL(result) != 0) ABORT("Bad VirtualAlloc result");
     	/* If I read the documentation correctly, this can	*/
     	/* only happen if HBLKSIZE > 64k or not a power of 2.	*/
@@ -1714,7 +1722,11 @@ void GC_win32_free_heap ()
 {
     if (GC_no_win32_dlls) {
  	while (GC_n_heap_bases > 0) {
+# ifdef CYGWIN32
+ 	    free (GC_heap_bases[--GC_n_heap_bases]);
+# else
  	    GlobalFree (GC_heap_bases[--GC_n_heap_bases]);
+# endif
  	    GC_heap_bases[GC_n_heap_bases] = 0;
  	}
     }
Index: boehm-gc/mark_rts.c
===================================================================
--- boehm-gc/mark_rts.c	(revision 157534)
+++ boehm-gc/mark_rts.c	(working copy)
@@ -22,7 +22,7 @@
 struct roots {
 	ptr_t r_start;
 	ptr_t r_end;
- #	if !defined(MSWIN32) && !defined(MSWINCE)
+ #	if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
 	  struct roots * r_next;
  #	endif
 	GC_bool r_tmp;
@@ -87,7 +87,7 @@ ptr_t p;
     return(FALSE);
 }
 
-#if !defined(MSWIN32) && !defined(MSWINCE)
+#if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
 /* 
 #   define LOG_RT_SIZE 6
 #   define RT_SIZE (1 << LOG_RT_SIZE)  -- Power of 2, may be != MAX_ROOT_SETS
@@ -139,7 +139,7 @@ struct roots *p;
     GC_root_index[h] = p;
 }
 
-# else /* MSWIN32 || MSWINCE */
+# else /* MSWIN32 || MSWINCE || CYGWIN32 */
 
 #   define add_roots_to_index(p)
 
@@ -175,7 +175,7 @@ GC_bool tmp;
 {
     struct roots * old;
     
-#   if defined(MSWIN32) || defined(MSWINCE)
+#   if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32)
       /* Spend the time to ensure that there are no overlapping	*/
       /* or adjacent intervals.					*/
       /* This could be done faster with e.g. a			*/
@@ -244,7 +244,7 @@ GC_bool tmp;
     GC_static_roots[n_root_sets].r_start = (ptr_t)b;
     GC_static_roots[n_root_sets].r_end = (ptr_t)e;
     GC_static_roots[n_root_sets].r_tmp = tmp;
-#   if !defined(MSWIN32) && !defined(MSWINCE)
+#   if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
       GC_static_roots[n_root_sets].r_next = 0;
 #   endif
     add_roots_to_index(GC_static_roots + n_root_sets);
@@ -263,7 +263,7 @@ void GC_clear_roots GC_PROTO((void))
     roots_were_cleared = TRUE;
     n_root_sets = 0;
     GC_root_size = 0;
-#   if !defined(MSWIN32) && !defined(MSWINCE)
+#   if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
     {
     	register int i;
     	
@@ -285,7 +285,7 @@ int i;
     n_root_sets--;
 }
 
-#if !defined(MSWIN32) && !defined(MSWINCE)
+#if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
 static void GC_rebuild_root_index()
 {
     register int i;
@@ -308,12 +308,12 @@ void GC_remove_tmp_roots()
     	    i++;
     }
     }
-    #if !defined(MSWIN32) && !defined(MSWINCE)
+    #if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
     GC_rebuild_root_index();
     #endif
 }
 
-#if !defined(MSWIN32) && !defined(MSWINCE)
+#if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
 void GC_remove_roots(b, e)
 char * b; char * e;
 {
@@ -340,9 +340,9 @@ char * b; char * e;
     }
     GC_rebuild_root_index();
 }
-#endif /* !defined(MSWIN32) && !defined(MSWINCE) */
+#endif /* !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32) */
 
-#if defined(MSWIN32) || defined(_WIN32_WCE_EMULATION)
+#if defined(MSWIN32) || defined(_WIN32_WCE_EMULATION) || defined(CYGWIN32)
 /* Workaround for the OS mapping and unmapping behind our back:		*/
 /* Is the address p in one of the temporary static root sections?	*/
 GC_bool GC_is_tmp_root(p)
@@ -364,7 +364,7 @@ ptr_t p;
     }
     return(FALSE);
 }
-#endif /* MSWIN32 || _WIN32_WCE_EMULATION */
+#endif /* MSWIN32 || _WIN32_WCE_EMULATION || defined(CYGWIN32) */
 
 ptr_t GC_approx_sp()
 {
@@ -557,7 +557,7 @@ void GC_push_gc_structures GC_PROTO((void))
 void GC_cond_register_dynamic_libraries()
 {
 # if (defined(DYNAMIC_LOADING) || defined(MSWIN32) || defined(MSWINCE) \
-     || defined(PCR)) && !defined(SRC_M3)
+     || defined(CYGWIN32) || defined(PCR)) && !defined(SRC_M3)
     GC_remove_tmp_roots();
     if (!GC_no_dls) GC_register_dynamic_libraries();
 # else
Index: boehm-gc/dyn_load.c
===================================================================
--- boehm-gc/dyn_load.c	(revision 157534)
+++ boehm-gc/dyn_load.c	(working copy)
@@ -49,10 +49,13 @@
 #   undef GC_must_restore_redefined_dlopen
 # endif
 
-#if (defined(DYNAMIC_LOADING) || defined(MSWIN32) || defined(MSWINCE)) \
+#if (defined(DYNAMIC_LOADING) \
+	|| defined(MSWIN32)   \
+	|| defined(MSWINCE)   \
+	|| defined(CYGWIN32)) \
     && !defined(PCR)
 #if !defined(SUNOS4) && !defined(SUNOS5DL) && !defined(IRIX5) && \
-    !defined(MSWIN32) && !defined(MSWINCE) && \
+    !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32) && \
     !(defined(ALPHA) && defined(OSF1)) && \
     !defined(HPUX) && !(defined(LINUX) && defined(__ELF__)) && \
     !defined(RS6000) && !defined(SCO_ELF) && !defined(DGUX) && \
@@ -717,7 +720,7 @@ void GC_register_dynamic_libraries()
 
 # endif /* USE_PROC || IRIX5 */
 
-# if defined(MSWIN32) || defined(MSWINCE)
+# if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32)
 
 # define WIN32_LEAN_AND_MEAN
 # define NOSERVICE
@@ -761,7 +764,7 @@ void GC_register_dynamic_libraries()
     }
 # endif
 
-# ifdef MSWINCE
+# if defined(MSWINCE) || defined(CYGWIN32)
   /* Do we need to separately register the main static data segment? */
   GC_bool GC_register_main_static_data()
   {
@@ -868,8 +871,12 @@ void GC_register_dynamic_libraries()
   }
 # endif /* DEBUG_VIRTUALQUERY */
 
-  extern GC_bool GC_wnt;  /* Is Windows NT derivative.		*/
-  			  /* Defined and set in os_dep.c.	*/
+# ifdef CYGWIN32
+#   define GC_wnt (TRUE)
+# else
+    extern GC_bool GC_wnt;  /* Is Windows NT derivative.	*/
+  			    /* Defined and set in os_dep.c.	*/
+# endif
 
   void GC_register_dynamic_libraries()
   {
@@ -934,7 +941,7 @@ void GC_register_dynamic_libraries()
     GC_cond_add_roots(base, limit);
   }
 
-#endif /* MSWIN32 || MSWINCE */
+#endif /* MSWIN32 || MSWINCE || CYGWIN32 */
   
 #if defined(ALPHA) && defined(OSF1)
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH,final respin] [4.5 regression] Fix PR42811: java.lang.ExceptionInInitializerError   in ecj1 and associated issues.
  2010-03-20 14:29   ` [PATCH,final respin] " Dave Korn
@ 2010-03-20 18:17     ` Andrew Haley
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Haley @ 2010-03-20 18:17 UTC (permalink / raw)
  To: java-patches

On 03/20/2010 02:46 PM, Dave Korn wrote:
>> On 02/20/2010 06:36 PM, Dave Korn wrote:
> 
>>>   Bootstrapped and tested on i686-pc-cygwin; fixes PR42811 and doesn't cause
>>> any further regressions (there are some preexisting fails that this makes no
>>> difference to).  OK for head?
>>
>> A couple of things:
>>
>> 1.  Bounce the gc changes off gc@napali
> 
>   The GC changes have now been accepted upstream.  During porting them, I
> developed a testcase, which (by your kind permission) I will submit as a
> separate patch shortly after this round of patches is accepted and checked in.
> 
>> 2.  Is it really necessary to make the main program depend on a symbol
>>     in libgcj-noncore when BC compiling?  Can't you make the libgcj
>>     itself depend on libgcj-noncore?
> 
>   It turns out that I can, and I can do it without having to hack libtool or
> do anything else unsuitable (IMO) for stage 3.  Bootstrapped, and test results
> posted(*), no regressions.
> 
> pr42811-final.diff
> libjava/ChangeLog:
> 
> 	* libjava/configure.ac (DLLTOOL): Call AC_CHECK_TOOL.
> 	(libgcj_sublib_core_extra_deps): New host-dependent configure var.
> 	(LIBGCJ_SUBLIB_CORE_EXTRA_DEPS): AC_SUBST it.
> 	* libjava/configure.host (libgcj_sublib_core_extra_deps): Define
> 	appropriately on Cygwin and MinGW.
> 	(libgcj_sublib_core_extra_deps): Add libgcj-noncore-dummy import
> 	stub library on Cygwin and MinGW.
> 	* libjava/Makefile.am (LIBJAVA_CORE_EXTRA): Import AC_SUBST'd
> 	LIBGCJ_SUBLIB_CORE_EXTRA_DEPS if building sublibs, else define empty.
> 	(libgcj_la_DEPENDENCIES): Use it.
> 	(DLL_VERSION): New makefile macro.
> 	(libgcj-noncore-dummy.dll.a): New build rule for dummy import stub
> 	library.
> 	(libgcj_noncore_la_LIBADD): Trim superfluous convenience libs.
> 	(AM_MAKEFLAGS): Add DLLTOOL recursive propagation.
> 	* libjava/libgcj-noncore-dummy.def: New file.
> 	* libjava/Makefile.in: Regenerate.
> 	* libjava/include/Makefile.in: Likewise.
> 	* libjava/testsuite/Makefile.in: Likewise.
> 	* libjava/configure: Likewise.
> 	* libjava/gcj/Makefile.in: Likewise.
> 
> pr42811-uninit-mem-fix.diff:
> libjava/ChangeLog:
> 
> 	* jvmti.cc (_Jv_GetJVMTIEnv): Avoid use of uninitialised memory.
> 
> pr42811-boehm-gc-fixes.diff:
> boehm-gc/ChangeLog:
> 
> 	* include/private/gc_priv.h (struct roots) [CYGWIN32]: Don't
> 	declare r_next member on Cygwin as on other windows hosts.
> 	(LOG_RT_SIZE) [CYGWIN32]: Don't define likewise.
> 	(RT_SIZE) [CYGWIN32]: Likewise.
> 	(struct _GC_arrays) [CYGWIN32]: Do declare _heap_bases[] member
> 	likewise.
> 	(GC_heap_bases) [CYGWIN32]: Do define likewise.
> 	(struct _SYSTEM_INFO) [CYGWIN32]: Do forward-declare likewise.
> 	(GC_sysinfo) [CYGWIN32]: Do declare extern likewise.
> 	(GC_n_heap_bases) [CYGWIN32]: Likewise.
> 	(GC_is_tmp_root) [CYGWIN32]: Do prototype likewise.
> 	* include/private/gcconfig.h (GC_win32_get_mem) [CYGWIN32]: Likewise.
> 	(GET_MEM) [CYGWIN32]: Do define likewise.
> 	* boehm-gc/ptr_chck.c (GC_is_visible) [CYGWIN32]: Do handle dynamic
> 	registration likewise.
> 	* boehm-gc/os_dep.c (GC_setpagesize) [CYGWIN32]: Do define likewise.
> 	(GC_no_win32_dlls) [CYGWIN32]: Define as constant false, unlike
> 	other windows hosts.
> 	(GC_sysinfo) [CYGWIN32]: Define as on other windows hosts.
> 	(GC_n_heap_bases) [CYGWIN32]: Likewise.
> 	(GLOBAL_ALLOC_TEST) [CYGWIN32]: Likewise.
> 	(GC_win32_get_mem) [CYGWIN32]: Likewise, but wrapping GC_unix_get_mem
> 	rather than GlobalAlloc/VirtualAlloc.
> 	(GC_win32_free_heap) [CYGWIN32]: Likewise, but wrapping free instead
> 	of GlobalFree (even though the function body is optimised away).
> 	* boehm-gc/mark_rts.c (add_roots_to_index) [CYGWIN32]: Define as on
> 	other windows hosts.
> 	(GC_add_roots_inner) [CYGWIN32]: Avoid overlapping or adjacent
> 	intervals likewise.
> 	(GC_clear_roots) [CYGWIN32]: Clear GC_root_index[] likewise.
> 	(GC_rebuild_root_index) [CYGWIN32]: Define as on other windows hosts.
> 	(GC_remove_tmp_roots) [CYGWIN32]: Call it likewise.
> 	(GC_remove_roots) [CYGWIN32]: Don't define, as on other windows hosts.
> 	(GC_is_tmp_root) [CYGWIN32]: Define, as on other windows hosts.
> 	(GC_cond_register_dynamic_libraries) [CYGWIN32]: Handle temporary
> 	roots and dynamic registration likewise.
> 	* boehm-gc/dyn_load.c (GC_has_static_roots) [CYGWIN32]: Define as on
> 	other windows hosts.
> 	(GC_register_has_static_roots_callback) [CYGWIN32]: Likewise.
> 	(GC_cond_add_roots) [CYGWIN32]: Likewise.
> 	(GC_register_main_static_data) [CYGWIN32]: Define to always return
> 	false, as on MSWINCE
> 	(HAVE_REGISTER_MAIN_STATIC_DATA) [CYGWIN32]: Define as on other
> 	windows hosts.
> 	(GC_warn_fb) [CYGWIN32]: Likewise.
> 	(GC_disallow_ignore_fb) [CYGWIN32]: Likewise.
> 	(GC_ignore_fb_mb) [CYGWIN32]: Likewise.
> 	(GC_ignore_fb) [CYGWIN32]: Likewise.
> 	(is_frame_buffer) [CYGWIN32]: Likewise.
> 	(GC_dump_meminfo) [CYGWIN32]: Likewise.
> 	(GC_wnt) [CYGWIN32]: Define to constant true.
> 	(GC_register_dynamic_libraries) [CYGWIN32]: Define as on other
> 	windows hosts.
> 
>   OK for HEAD?

OK, thanks.

Andrew.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-03-20 18:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-20 18:18 [PATCH] [4.5 regression] Fix PR42811: java.lang.ExceptionInInitializerError in ecj1 and associated issues Dave Korn
2010-02-22 10:12 ` Andrew Haley
2010-02-22 16:49   ` Dave Korn
2010-03-19 15:55     ` Dave Korn
2010-03-20 14:29   ` [PATCH,final respin] " Dave Korn
2010-03-20 18:17     ` Andrew Haley

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).