[PATCH, take 2] Build java as two separate DLLs on windows.

View: New views
18 Messages — Rating Filter:   Alert me  

[PATCH, take 2] Build java as two separate DLLs on windows.

by Dave Korn-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    Hi all,

  Here's the final version of my libjava-as-dlls patch.  Nobody had anything
much to say about the first draft so I take it there were no obvious massive
flaws; this is basically the same patch, tweaked to add -lgcj-noncore to the
specs when using -lgcj_bc as well as when using ordinary -lgcj, and adding
dependencies on libgcj-noncore.la to the tool executables everywhere they link
against libgcj.la, so as to guarantee both libraries are available at the time
those modified specs get used, preventing the parallel build from breaking.

gcc/ChangeLog:

        * config/i386/cygming.h (TARGET_USE_JCR_SECTION): Enable.
        * config/i386/cygwin.h (LIBGCJ_SONAME): Define.
        * config/i386/mingw32.h (LIBGCJ_SONAME): Likewise.

libjava/ChangeLog:

        * configure.host (enable_libgcj_sublibs_default): New variable,
        set for Cygwin and MinGW.
        * configure.ac (--enable-libgcj-sublibs): New command-line switch.
        (BUILD_SUBLIBS): New AM_CONDITIONAL relating to it.
        (libgcj_spec_lgcj_override): New variable, define if building sublibs.
        (libgcj_spec_lgcj_bc_override): Likewise for when USE_LIBGCJ_BC.
        (LIBGCJ_SPEC_LGCJ): New variable to abstract "-lgcj" from specs.
        (LIBGCJ_SPEC_LGCJ_BC): Likewise for when USE_LIBGCJ_BC.
        (LIBGCJ_SPEC): Use them.
        * configure: Regenerate.
        * Makefile.am (LOWER_PACKAGE_FILES_LO): New variable.
        (ALL_PACKAGE_SOURCE_FILES_LO): Likewise.
        (NONCORE_PACKAGE_SOURCE_FILES_LO): Likewise.
        (CORE_PACKAGE_SOURCE_FILES_LO): Likewise.
        (toolexeclib_LTLIBRARIES): Add libgcj-noncore.la if building sublibs.
        (libgcj_noncore_la_LIBADD_SUBOBJECTS): New variable.
        (libgcj_la_LIBADD_SUBOBJECTS): Likewise.
        (libgcj_la_LDFLAGS_NOUNDEF): Likewise.
        (libgij_la_LDFLAGS): Add DLL-related options.
        (libgcj_la_LDFLAGS): Use libgcj_la_LDFLAGS_NOUNDEF and
        libgcj_la_LIBADD_SUBOBJECTS.
        (libgcj_la_DEPENDENCIES): Adjust to match.
        (libgcj_noncore_la_SOURCES, libgcj_noncore_la_LDFLAGS,
        libgcj_noncore_la_LIBADD, libgcj_noncore_la_DEPENDENCIES,
        libgcj_noncore_la_LINK): New automake variables for sublibrary.
        (libgcj_tools_la_LDFLAGS): Add DLL-related flags.
        (libgcj_tools_la_LIBADD): New variable.
        (libjvm_la_LDFLAGS): Add DLL-related flags.
        (lib_gnu_awt_xlib_la_LDFLAGS): Likewise.
        (libgcj_bc_la_LDFLAGS): Likewise.
        (libgij_la_DEPENDENCIES): Add dependency on libgcj-noncore.la when
        building sublibs.
        (libgcj_tools_la_DEPENDENCIES, libjvm_la_DEPENDENCIES,
        lib_gnu_awt_xlib_la_DEPENDENCIES, jv_convert_DEPENDENCIES,
        gcj_dbtool_DEPENDENCIES, gc_analyze_DEPENDENCIES, ecjx_DEPENDENCIES):
        Likewise.
        * Makefile.in: Regenerate.
        * sysdep/i386/backtrace.h (MAIN_FUNC): New #define for main function,
        set appropriately for Cygwin on that platform or to "main" elsewhere.
        (fallback_backtrace): Use it to limit stack unwind.

libjava/libltdl/ChangeLog:

        * ltdl.h (LT_SCOPE): Change conditional to avoid breaking
        auto-export during libgcj DLL linking.
        * Makefile.am (libltdl_la_LDFLAGS): Remove -bindir switch.
        * Makefile.in: Regenerate.

  Bootstrapped at -j4 on i686-pc-cygwin.  Tests currently running, results
anticipated in a few hours.  Assuming (as I have every reason to expect) no
regressions, OK for HEAD?

    cheers,
      DaveK


Index: gcc/config/i386/cygming.h
===================================================================
--- gcc/config/i386/cygming.h (revision 151124)
+++ gcc/config/i386/cygming.h (working copy)
@@ -383,7 +383,7 @@ do { \
 /* FIXME: SUPPORTS_WEAK && TARGET_HAVE_NAMED_SECTIONS is true,
    but for .jcr section to work we also need crtbegin and crtend
    objects.  */
-#define TARGET_USE_JCR_SECTION 0
+#define TARGET_USE_JCR_SECTION 1
 
 /* Decide whether it is safe to use a local alias for a virtual function
    when constructing thunks.  */
Index: gcc/config/i386/cygwin.h
===================================================================
--- gcc/config/i386/cygwin.h (revision 151124)
+++ gcc/config/i386/cygwin.h (working copy)
@@ -267,3 +267,7 @@ while (0)
 #define LIBGCC_EH_EXTN "-sjlj"
 #endif
 #define LIBGCC_SONAME "cyggcc_s" LIBGCC_EH_EXTN "-1.dll"
+
+/* We should find a way to not have to update this manually.  */
+#define LIBGCJ_SONAME "cyggcj" /*LIBGCC_EH_EXTN*/ "-11.dll"
+
Index: gcc/config/i386/mingw32.h
===================================================================
--- gcc/config/i386/mingw32.h (revision 151124)
+++ gcc/config/i386/mingw32.h (working copy)
@@ -221,3 +221,7 @@ __enable_execute_stack (void *addr) \
 #define LIBGCC_EH_EXTN "_sjlj"
 #endif
 #define LIBGCC_SONAME "libgcc_s" LIBGCC_EH_EXTN "-1.dll"
+
+/* We should find a way to not have to update this manually.  */
+#define LIBGCJ_SONAME "cyggcj" /*LIBGCC_EH_EXTN*/ "-11.dll"
+
Index: libjava/libltdl/ltdl.h
===================================================================
--- libjava/libltdl/ltdl.h (revision 151124)
+++ libjava/libltdl/ltdl.h (working copy)
@@ -128,7 +128,7 @@ LT_BEGIN_C_DECLS
    ridiculous implementation of data symbol exporting. */
 #ifndef LT_SCOPE
 #  ifdef __WINDOWS__
-#    ifdef DLL_EXPORT /* defined by libtool (if required) */
+#    ifdef LIBLTDL_DLL_EXPORT /* don't define or ld disables auto-export. */
 #      define LT_SCOPE __declspec(dllexport)
 #    endif
 #    ifdef LIBLTDL_DLL_IMPORT /* define if linking with this dll */
Index: libjava/libltdl/Makefile.am
===================================================================
--- libjava/libltdl/Makefile.am (revision 151124)
+++ libjava/libltdl/Makefile.am (working copy)
@@ -22,7 +22,7 @@ endif
 CLEANFILES = libltdl.la libltdlc.la
 
 libltdl_la_SOURCES = ltdl.c
-libltdl_la_LDFLAGS = -no-undefined -bindir "$(bindir)" -version-info 4:1:1
+libltdl_la_LDFLAGS = -no-undefined -version-info 4:1:1
 libltdl_la_LIBADD = $(LIBADD_DL)
 
 libltdlc_la_SOURCES = ltdl.c
Index: libjava/configure.host
===================================================================
--- libjava/configure.host (revision 151124)
+++ libjava/configure.host (working copy)
@@ -23,6 +23,9 @@
 #                            default.
 #   enable_hash_synchronization_default  If hash synchronization should be
 #                                        enabled by default.
+#   enable_libgcj_sublibs_default  Whether to build libgcj as a bunch of
+#                                  separate shared libraries or in one
+#                                  monolithic one.
 #   sysdeps_dir Directory containing system-dependent headers
 #   slow_pthread_self   The synchronization code should try to avoid
 # pthread_self calls by caching thread IDs in a hashtable
@@ -41,6 +44,7 @@ libgcj_javaflags=
 libgcj_interpreter=
 enable_java_net_default=yes
 enable_hash_synchronization_default=no
+enable_libgcj_sublibs_default=no
 sysdeps_dir=generic
 slow_pthread_self=
 can_unwind_signal=no
@@ -341,6 +345,8 @@ case "${host}" in
  fallback_backtrace_h=sysdep/i386/backtrace.h  
  # We need a frame pointer on Windows, so override BACKTRACESPEC
    BACKTRACESPEC=
+ # Win32 DLLs are limited to 64k exported symbols each.
+ enable_libgcj_sublibs_default=yes
   ;;
 esac
 
Index: libjava/configure.ac
===================================================================
--- libjava/configure.ac (revision 151124)
+++ libjava/configure.ac (working copy)
@@ -206,6 +206,7 @@ AC_EXEEXT
 # libgcj_cflags    - host specific C compiler flags
 # libgcj_cxxflags  - host specific C++ compiler flags
 # libgcj_javaflags - host specific Java compiler flags
+# and a number of others; see the list at the start of the file.
 
 libgcj_cflags=
 libgcj_cxxflags=
@@ -237,6 +238,26 @@ fi
 
 AC_CONFIG_HEADERS([include/config.h gcj/libgcj-config.h])
 
+# Possibly build libgcj as many sub-libraries.
+AC_ARG_ENABLE(libgcj-sublibs,
+  AS_HELP_STRING([--enable-libgcj-sublibs],
+                 [build libgcj as many sub-libraries]))
+
+if test -z "$enable_libgcj_sublibs"; then
+   enable_libgcj_sublibs=$enable_libgcj_sublibs_default
+fi
+AM_CONDITIONAL(BUILD_SUBLIBS, test "$enable_libgcj_sublibs" = yes)
+if test "$enable_libgcj_sublibs" = yes ; then
+  # In theory we could make do with only one override and simply
+  # 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"
+fi
+
+
 # See if the user has requested runtime debugging.
 LIBGCJDEBUG="disable"
 AC_SUBST(LIBGCJDEBUG)
@@ -897,6 +918,9 @@ arm*linux*eabi)
     LIBSTDCXXSPEC=-lstdc++
     LIBGCJTESTSPEC="-L`${PWDCMD-pwd}`/.libs -L`${PWDCMD-pwd}`/../libstdc++-v3/src/.libs -rpath `${PWDCMD-pwd}`/.libs:`${PWDCMD-pwd}`/../libstdc++-v3/src/.libs -lstdc++"
     ;;
+*-*-cygwin)
+    extra_ldflags_libjava=-liconv
+    ;;
 esac
 AC_SUBST(extra_ldflags_libjava)
 AC_SUBST(extra_gij_ldflags)
@@ -1075,9 +1099,17 @@ AC_CONFIG_LINKS(sysdep/locks.h:sysdep/$sysdeps_dir
 AC_CONFIG_LINKS(sysdep/backtrace.h:$fallback_backtrace_h)
 AC_CONFIG_LINKS(sysdep/descriptor.h:$descriptor_h)
 
-LIBGCJ_SPEC="%{s-bc-abi:} -lgcj"
+LIBGCJ_SPEC_LGCJ=-lgcj
+LIBGCJ_SPEC_LGCJ_BC=-lgcj_bc
+if test x"$libgcj_spec_lgcj_override" != x ; then
+  LIBGCJ_SPEC_LGCJ=$libgcj_spec_lgcj_override
+fi
+if test x"$libgcj_spec_lgcj_bc_override" != x ; then
+  LIBGCJ_SPEC_LGCJ_BC=$libgcj_spec_lgcj_bc_override
+fi
+LIBGCJ_SPEC="%{s-bc-abi:} $LIBGCJ_SPEC_LGCJ"
 if test "$use_libgcj_bc" = yes; then
-  LIBGCJ_SPEC="%{static|static-libgcj|!s-bc-abi:-lgcj;:-lgcj_bc}"
+  LIBGCJ_SPEC="%{static|static-libgcj|!s-bc-abi:$LIBGCJ_SPEC_LGCJ;:$LIBGCJ_SPEC_LGCJ_BC}"
   LIBGCJ_BC_SPEC="%{findirect-dispatch:-fPIC}"
 fi
 AC_SUBST(LIBGCJ_SPEC)
Index: libjava/sysdep/i386/backtrace.h
===================================================================
--- libjava/sysdep/i386/backtrace.h (revision 151124)
+++ libjava/sysdep/i386/backtrace.h (working copy)
@@ -13,7 +13,14 @@ details.  */
 
 #include <java-stack.h>
 
-extern int main (int, char **);
+#ifdef __CYGWIN__
+/* To allow this to link as a DLL.  */
+#define MAIN_FUNC dll_crt0__FP11per_process
+extern "C" int MAIN_FUNC () __declspec(dllimport);
+#else /* !__CYGWIN__ */
+#define MAIN_FUNC main
+extern int MAIN_FUNC (int, char **);
+#endif /* ?__CYGWIN__ */
 
 /* The context used to keep track of our position while unwinding through
    the call stack.  */
@@ -104,7 +111,7 @@ fallback_backtrace (_Unwind_Trace_Fn trace_fn, _Jv
                             const char **, bool))_Jv_RunMain;
       if (ctx.meth_addr == (_Jv_uintptr_t)jv_runmain
           || ctx.meth_addr == (_Jv_uintptr_t)_Jv_ThreadStart
-          || (ctx.meth_addr - (_Jv_uintptr_t)main) < 16)
+          || (ctx.meth_addr - (_Jv_uintptr_t)MAIN_FUNC) < 16)
         break;
     }
 
Index: libjava/Makefile.am
===================================================================
--- libjava/Makefile.am (revision 151124)
+++ libjava/Makefile.am (working copy)
@@ -45,6 +45,170 @@ libexecsubdir = $(libexecdir)/gcc/$(target_noncano
 toolexeclib_LTLIBRARIES = libgcj.la libgij.la libgcj-tools.la
 toolexecmainlib_DATA = libgcj.spec
 
+##
+## These files form a closed dependency group at the lower
+## edge of libjava's dependency graph, so can be separated out.
+## For details of how the list was generated, see the GCC wiki:
+##
+##   http://gcc.gnu.org/wiki/Internal_dependencies_of_libgcj
+##
+LOWER_PACKAGE_FILES_LO = \
+ $(propertyo_files) \
+ gnu-CORBA.lo \
+ gnu-java-awt-dnd-peer-gtk.lo \
+ gnu-java-awt-peer-gtk.lo \
+ gnu-java-awt-peer-swing.lo \
+ gnu-java-lang-management.lo \
+ gnu-javax-management.lo \
+ gnu-javax-rmi.lo \
+ gnu-javax-sound-midi.lo \
+ gnu-xml-aelfred2.lo \
+ gnu-xml-dom.lo \
+ gnu-xml-libxmlj.lo \
+ gnu-xml-pipeline.lo \
+ gnu-xml-stream.lo \
+ gnu-xml-transform.lo \
+ gnu-xml-util.lo \
+ gnu-xml-validation.lo \
+ gnu-xml-xpath.lo \
+ java-lang-management.lo \
+ javax-imageio.lo \
+ javax-rmi.lo \
+ jni-libjvm.lo \
+ org-omg-CORBA.lo \
+ org-omg-CORBA_2_3.lo \
+ org-omg-CosNaming.lo \
+ org-omg-Dynamic.lo \
+ org-omg-DynamicAny.lo \
+ org-omg-IOP.lo \
+ org-omg-Messaging.lo \
+ org-omg-PortableInterceptor.lo \
+ org-omg-PortableServer.lo \
+ org-omg-SendingContext.lo \
+ org-omg-stub.lo \
+ org-relaxng.lo \
+ org-xml.lo \
+ META-INF/services/java.util.prefs.PreferencesFactory.in.lo \
+ META-INF/services/java.util.prefs.PreferencesFactory.lo \
+ META-INF/services/javax.sound.midi.spi.MidiDeviceProvider.lo \
+ META-INF/services/javax.sound.midi.spi.MidiFileReader.lo \
+ META-INF/services/javax.sound.midi.spi.MidiFileWriter.lo \
+ META-INF/services/javax.sound.sampled.spi.AudioFileReader.lo \
+ classpath/native/jni/classpath/jcl.lo \
+ classpath/native/jni/classpath/jnilink.lo \
+ classpath/native/jni/java-math/gnu_java_math_GMP.lo \
+ classpath/tools/libgcj_tools_la-tools.lo \
+ gnu/awt.lo \
+ gnu/awt/j2d.lo \
+ gnu/gcj/io.lo \
+ gnu/gcj/io/natSimpleSHSStream.lo \
+ gnu/gcj/io/shs.lo \
+ gnu/gcj/tools/gcj_dbtool.lo \
+ gnu/gcj/util/natDebug.lo \
+ gnu/gcj/util/natGCInfo.lo \
+ gnu/java/awt/dnd.lo \
+ gnu/java/awt/font.lo \
+ gnu/java/awt/image.lo \
+ gnu/java/awt/print.lo \
+ gnu/java/awt/font/autofit.lo \
+ gnu/java/awt/font/opentype.lo \
+ gnu/java/awt/font/opentype/truetype.lo \
+ gnu/java/lang/management/natVMClassLoadingMXBeanImpl.lo \
+ gnu/java/lang/management/natVMCompilationMXBeanImpl.lo \
+ gnu/java/lang/management/natVMGarbageCollectorMXBeanImpl.lo \
+ gnu/java/lang/management/natVMMemoryMXBeanImpl.lo \
+ gnu/java/lang/management/natVMMemoryManagerMXBeanImpl.lo \
+ gnu/java/lang/management/natVMMemoryPoolMXBeanImpl.lo \
+ gnu/java/lang/management/natVMOperatingSystemMXBeanImpl.lo \
+ gnu/java/lang/management/natVMRuntimeMXBeanImpl.lo \
+ gnu/java/lang/management/natVMThreadMXBeanImpl.lo \
+ gnu/java/net/local.lo \
+ gnu/java/net/protocol/ftp.lo \
+ gnu/java/net/protocol/gcjlib.lo \
+ gnu/java/net/protocol/https.lo \
+ gnu/javax/imageio.lo \
+ gnu/javax/print.lo \
+ gnu/javax/sound.lo \
+ gnu/javax/activation/viewers.lo \
+ gnu/javax/imageio/bmp.lo \
+ gnu/javax/imageio/gif.lo \
+ gnu/javax/imageio/jpeg.lo \
+ gnu/javax/imageio/png.lo \
+ gnu/javax/naming/giop.lo \
+ gnu/javax/naming/ictxImpl/trans.lo \
+ gnu/javax/naming/jndi/url/corbaname.lo \
+ gnu/javax/naming/jndi/url/rmi.lo \
+ gnu/javax/print/ipp.lo \
+ gnu/javax/print/ipp/attribute.lo \
+ gnu/javax/print/ipp/attribute/defaults.lo \
+ gnu/javax/print/ipp/attribute/job.lo \
+ gnu/javax/print/ipp/attribute/printer.lo \
+ gnu/javax/print/ipp/attribute/supported.lo \
+ gnu/javax/security/auth/login.lo \
+ gnu/javax/sound/sampled/AU.lo \
+ gnu/javax/sound/sampled/WAV.lo \
+ gnu/javax/swing/plaf/gnu.lo \
+ gnu/javax/swing/plaf/metal.lo \
+ java/sql.lo \
+ java/awt/im.lo \
+ java/awt/print.lo \
+ java/awt/im/spi.lo \
+ java/security/acl.lo \
+ javax/activation.lo \
+ javax/activity.lo \
+ javax/management.lo \
+ javax/naming.lo \
+ javax/print.lo \
+ javax/sql.lo \
+ javax/tools.lo \
+ javax/transaction.lo \
+ javax/management/loading.lo \
+ javax/management/openmbean.lo \
+ javax/management/remote.lo \
+ javax/management/remote/rmi.lo \
+ javax/naming/directory.lo \
+ javax/naming/event.lo \
+ javax/naming/ldap.lo \
+ javax/naming/spi.lo \
+ javax/print/attribute.lo \
+ javax/print/event.lo \
+ javax/print/attribute/standard.lo \
+ javax/security/cert.lo \
+ javax/security/auth/kerberos.lo \
+ javax/security/auth/login.lo \
+ javax/security/auth/spi.lo \
+ javax/sound/midi.lo \
+ javax/sound/midi/spi.lo \
+ javax/swing/plaf/multi.lo \
+ javax/swing/plaf/synth.lo \
+ javax/swing/text/rtf.lo \
+ javax/swing/text/html/default.css.lo \
+ javax/transaction/xa.lo \
+ org/ietf/jgss.lo \
+ sun/awt.lo
+
+##
+## Lists of all .lo files, and filtered core and non-core lists.
+##
+ALL_PACKAGE_SOURCE_FILES_LO = $(all_packages_source_files:.list=.lo) $(propertyo_files) $(bc_objects)
+NONCORE_PACKAGE_SOURCE_FILES_LO = $(filter $(LOWER_PACKAGE_FILES_LO),$(ALL_PACKAGE_SOURCE_FILES_LO))
+CORE_PACKAGE_SOURCE_FILES_LO = $(filter-out $(LOWER_PACKAGE_FILES_LO),$(ALL_PACKAGE_SOURCE_FILES_LO))
+
+##
+## Assign objects to output libraries.
+##
+if BUILD_SUBLIBS
+toolexeclib_LTLIBRARIES += libgcj-noncore.la
+libgcj_noncore_la_LIBADD_SUBOBJECTS = $(NONCORE_PACKAGE_SOURCE_FILES_LO)
+libgcj_la_LIBADD_SUBOBJECTS = $(CORE_PACKAGE_SOURCE_FILES_LO)
+libgcj_la_LDFLAGS_NOUNDEF = -no-undefined -bindir $(bindir)
+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)
+libgcj_la_LDFLAGS_NOUNDEF =
+endif
+
 if USE_LIBGCJ_BC
 toolexeclib_LTLIBRARIES += libgcj_bc.la
 endif
@@ -218,10 +382,13 @@ BOOTCLASSPATH = $(srcdir)/classpath/lib
 
 libgij_la_SOURCES = gij.cc
 libgij_la_DEPENDENCIES = libgcj.la libgcj.spec
+if BUILD_SUBLIBS
+libgij_la_DEPENDENCIES += libgcj-noncore.la
+endif
 ## See jv_convert_LDADD.
 libgij_la_LIBADD = -L$(here)/.libs libgcj.la
 ## The mysterious backslash in the grep pattern is consumed by make.
-libgij_la_LDFLAGS = -rpath $(toolexeclibdir) \
+libgij_la_LDFLAGS = -rpath $(toolexeclibdir) -no-undefined -bindir $(bindir) \
         -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LIBGCJ_LD_SYMBOLIC)
 
 if INTERPRETER
@@ -277,7 +444,7 @@ xlib_nat_files = $(xlib_nat_source_files:.cc=.lo)
 # certain linuxthread functions get linked:
 ## The mysterious backslash in the grep pattern is consumed by make.
 libgcj_la_LDFLAGS = -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(extra_ldflags) $(THREADLIBS) \
- $(LIBLTDL) $(SYS_ZLIBS) \
+ $(LIBLTDL) $(SYS_ZLIBS) $(libgcj_la_LDFLAGS_NOUNDEF) \
  -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
  $(LIBGCJ_LD_SYMBOLIC_FUNCTIONS)
 libgcj_la_LIBADD = \
@@ -285,15 +452,13 @@ libgcj_la_LIBADD = \
  java/lang/Object.lo \
  java/lang/Class.lo \
  java/process-$(PLATFORM).lo \
- $(all_packages_source_files:.list=.lo) \
- $(bc_objects) \
- $(propertyo_files) \
+ $(libgcj_la_LIBADD_SUBOBJECTS) \
  $(LIBFFI) $(ZLIBS) $(GCLIBS)
 libgcj_la_DEPENDENCIES = libgcj-$(gcc_version).jar \
  java/lang/Object.lo \
  java/lang/Class.lo \
  java/process-$(PLATFORM).lo \
- $(all_packages_source_files:.list=.lo) \
+ $(ALL_PACKAGE_SOURCE_FILES_LO) \
  $(LIBLTDL) $(libgcj_la_LIBADD)
 if ANONVERSCRIPT
 libgcj_la_DEPENDENCIES += $(srcdir)/libgcj.ver
@@ -305,6 +470,19 @@ libgcj_la_LINK = $(LIBLINK) $(libgcj_la_LDFLAGS)
 ## compiled.
 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_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
+
 # 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
@@ -316,16 +494,24 @@ libgcj_tools_la_GCJFLAGS = $(AM_GCJFLAGS) -findire
  -fsource-filename=$(here)/classpath/tools/all-classes.lst
 libgcj_tools_la_LDFLAGS = -rpath $(toolexeclibdir) \
  -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
- $(LIBGCJ_LD_SYMBOLIC_FUNCTIONS)
+ $(LIBGCJ_LD_SYMBOLIC_FUNCTIONS) -no-undefined -bindir $(bindir)
+libgcj_tools_la_LIBADD = libgcj.la
 libgcj_tools_la_DEPENDENCIES = libgcj.la libgcj.spec
+if BUILD_SUBLIBS
+libgcj_tools_la_DEPENDENCIES += libgcj-noncore.la
+endif
 libgcj_tools_la_LINK = $(LIBLINK) $(libgcj_tools_la_LDFLAGS)
 
 ## libjvm.so
 libjvm_la_SOURCES = jni-libjvm.cc
 libjvm_la_DEPENDENCIES = libgcj.la libgcj.spec
+if BUILD_SUBLIBS
+libjvm_la_DEPENDENCIES += libgcj-noncore.la
+endif
 ## See jv_convert_LDADD.
 libjvm_la_LIBADD = -L$(here)/.libs libgcj.la
-libjvm_la_LDFLAGS = -avoid-version $(LIBGCJ_LD_SYMBOLIC)
+libjvm_la_LDFLAGS = -avoid-version $(LIBGCJ_LD_SYMBOLIC) \
+ -no-undefined -bindir $(bindir)
 
 ## The .db file.  This rule is only used for native builds, so it is
 ## safe to invoke gcj-dbtool.
@@ -342,6 +528,9 @@ lib_gnu_awt_xlib_la_LIBADD = gnu/awt/xlib.lo gnu/g
 lib_gnu_awt_xlib_la_DEPENDENCIES = libgcj-$(gcc_version).jar \
  libgcj.la libgcj.spec \
  $(lib_gnu_awt_xlib_la_LIBADD)
+if BUILD_SUBLIBS
+lib_gnu_awt_xlib_la_DEPENDENCIES += libgcj-noncore.la
+endif
 ## We require libstdc++-v3 to be in the same build tree.
 lib_gnu_awt_xlib_la_CPPFLAGS = \
  $(AM_CPPFLAGS) \
@@ -351,7 +540,7 @@ lib_gnu_awt_xlib_la_CPPFLAGS = \
 ## The mysterious backslash in the grep pattern is consumed by make.
 lib_gnu_awt_xlib_la_LDFLAGS = ../libstdc++-v3/src/libstdc++.la \
  @X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@ \
-        -rpath $(toolexeclibdir) \
+        -rpath $(toolexeclibdir) -no-undefined -bindir $(bindir) \
         -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LIBGCJ_LD_SYMBOLIC)
 lib_gnu_awt_xlib_la_LINK = $(LIBLINK) $(lib_gnu_awt_xlib_la_LDFLAGS)
 
@@ -361,7 +550,7 @@ lib_gnu_awt_xlib_la_LINK = $(LIBLINK) $(lib_gnu_aw
 ## This library is not linked against libgcj.
 libgcj_bc_la_SOURCES = libgcj_bc.c
 libgcj_bc_la_LDFLAGS = -rpath $(toolexeclibdir) -no-static -version-info 1:0:0 \
- $(LIBGCJ_LD_SYMBOLIC_FUNCTIONS)
+ $(LIBGCJ_LD_SYMBOLIC_FUNCTIONS) -no-undefined -bindir $(bindir)
 libgcj_bc_la_DEPENDENCIES = libgcj.la
 libgcj_bc_la_LINK = $(LIBLINK) $(libgcj_bc_la_LDFLAGS)
 ## This is specific to Linux/{Free,Net,Open}BSD/Hurd and perhaps few others.
@@ -824,6 +1013,9 @@ jv_convert_LDADD = -L$(here)/.libs libgcj.la
 ## Depend on the spec file to make sure it is up to date before
 ## linking this program.
 jv_convert_DEPENDENCIES = libgcj.la libgcj.spec
+if BUILD_SUBLIBS
+jv_convert_DEPENDENCIES += libgcj-noncore.la
+endif
 
 gcj_dbtool_SOURCES = \
 gnu/gcj/tools/gcj_dbtool/natMain.cc
@@ -845,6 +1037,9 @@ gcj_dbtool_LDADD = gnu/gcj/tools/gcj_dbtool.lo -L$
 ## Depend on the spec file to make sure it is up to date before
 ## linking this program.
 gcj_dbtool_DEPENDENCIES = gnu/gcj/tools/gcj_dbtool.lo libgcj.la libgcj.spec
+if BUILD_SUBLIBS
+gcj_dbtool_DEPENDENCIES += libgcj-noncore.la
+endif
 
 gc_analyze_SOURCES =
 
@@ -859,6 +1054,9 @@ gc_analyze_LDADD = -L$(here)/.libs libgcj-tools.la
 ## Depend on the spec file to make sure it is up to date before
 ## linking this program.
 gc_analyze_DEPENDENCIES = libgcj-tools.la libgcj.la libgcj.spec
+if BUILD_SUBLIBS
+gc_analyze_DEPENDENCIES += libgcj-noncore.la
+endif
 
 gij_SOURCES =
 ## We need -nodefaultlibs because we want to avoid gcj's `-lgcj'.  We
@@ -897,6 +1095,9 @@ endif !ENABLE_SHARED
 
 ecjx_LDADD = -L$(here)/.libs $(extra_ldflags)
 ecjx_DEPENDENCIES = libgcj.la libgcj.spec
+if BUILD_SUBLIBS
+ecjx_DEPENDENCIES += libgcj-noncore.la
+endif
 if USE_LIBGCJ_BC
 ecjx_DEPENDENCIES += libgcj_bc.la
 else

Re: [PATCH, take 2] Build java as two separate DLLs on windows.

by Kai Tietz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/8/31 Dave Korn <dave.korn.cygwin@...>:

>
>    Hi all,
>
>  Here's the final version of my libjava-as-dlls patch.  Nobody had anything
> much to say about the first draft so I take it there were no obvious massive
> flaws; this is basically the same patch, tweaked to add -lgcj-noncore to the
> specs when using -lgcj_bc as well as when using ordinary -lgcj, and adding
> dependencies on libgcj-noncore.la to the tool executables everywhere they link
> against libgcj.la, so as to guarantee both libraries are available at the time
> those modified specs get used, preventing the parallel build from breaking.
>
> gcc/ChangeLog:
>
>        * config/i386/cygming.h (TARGET_USE_JCR_SECTION): Enable.
>        * config/i386/cygwin.h (LIBGCJ_SONAME): Define.
>        * config/i386/mingw32.h (LIBGCJ_SONAME): Likewise.
>
> libjava/ChangeLog:
>
>        * configure.host (enable_libgcj_sublibs_default): New variable,
>        set for Cygwin and MinGW.
>        * configure.ac (--enable-libgcj-sublibs): New command-line switch.
>        (BUILD_SUBLIBS): New AM_CONDITIONAL relating to it.
>        (libgcj_spec_lgcj_override): New variable, define if building sublibs.
>        (libgcj_spec_lgcj_bc_override): Likewise for when USE_LIBGCJ_BC.
>        (LIBGCJ_SPEC_LGCJ): New variable to abstract "-lgcj" from specs.
>        (LIBGCJ_SPEC_LGCJ_BC): Likewise for when USE_LIBGCJ_BC.
>        (LIBGCJ_SPEC): Use them.
>        * configure: Regenerate.
>        * Makefile.am (LOWER_PACKAGE_FILES_LO): New variable.
>        (ALL_PACKAGE_SOURCE_FILES_LO): Likewise.
>        (NONCORE_PACKAGE_SOURCE_FILES_LO): Likewise.
>        (CORE_PACKAGE_SOURCE_FILES_LO): Likewise.
>        (toolexeclib_LTLIBRARIES): Add libgcj-noncore.la if building sublibs.
>        (libgcj_noncore_la_LIBADD_SUBOBJECTS): New variable.
>        (libgcj_la_LIBADD_SUBOBJECTS): Likewise.
>        (libgcj_la_LDFLAGS_NOUNDEF): Likewise.
>        (libgij_la_LDFLAGS): Add DLL-related options.
>        (libgcj_la_LDFLAGS): Use libgcj_la_LDFLAGS_NOUNDEF and
>        libgcj_la_LIBADD_SUBOBJECTS.
>        (libgcj_la_DEPENDENCIES): Adjust to match.
>        (libgcj_noncore_la_SOURCES, libgcj_noncore_la_LDFLAGS,
>        libgcj_noncore_la_LIBADD, libgcj_noncore_la_DEPENDENCIES,
>        libgcj_noncore_la_LINK): New automake variables for sublibrary.
>        (libgcj_tools_la_LDFLAGS): Add DLL-related flags.
>        (libgcj_tools_la_LIBADD): New variable.
>        (libjvm_la_LDFLAGS): Add DLL-related flags.
>        (lib_gnu_awt_xlib_la_LDFLAGS): Likewise.
>        (libgcj_bc_la_LDFLAGS): Likewise.
>        (libgij_la_DEPENDENCIES): Add dependency on libgcj-noncore.la when
>        building sublibs.
>        (libgcj_tools_la_DEPENDENCIES, libjvm_la_DEPENDENCIES,
>        lib_gnu_awt_xlib_la_DEPENDENCIES, jv_convert_DEPENDENCIES,
>        gcj_dbtool_DEPENDENCIES, gc_analyze_DEPENDENCIES, ecjx_DEPENDENCIES):
>        Likewise.
>        * Makefile.in: Regenerate.
>        * sysdep/i386/backtrace.h (MAIN_FUNC): New #define for main function,
>        set appropriately for Cygwin on that platform or to "main" elsewhere.
>        (fallback_backtrace): Use it to limit stack unwind.
>
> libjava/libltdl/ChangeLog:
>
>        * ltdl.h (LT_SCOPE): Change conditional to avoid breaking
>        auto-export during libgcj DLL linking.
>        * Makefile.am (libltdl_la_LDFLAGS): Remove -bindir switch.
>        * Makefile.in: Regenerate.
>
>  Bootstrapped at -j4 on i686-pc-cygwin.  Tests currently running, results
> anticipated in a few hours.  Assuming (as I have every reason to expect) no
> regressions, OK for HEAD?
>
>    cheers,
>      DaveK
>
>

Hi Dave,

cygwin/mingw part is ok. I tested it additional for regressions for
i686 and x86_64 mingw target.

Cheers,
Kai

--
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination

Re: [PATCH, take 2] Build java as two separate DLLs on windows.

by Dave Korn-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Kai Tietz wrote:

> cygwin/mingw part is ok. I tested it additional for regressions for
> i686 and x86_64 mingw target.

  Thanks a million Kai!  It would have taken me a long time to get a full
mingw build environment set up.

    cheers,
      DaveK


Re: [PATCH, take 2] Build java as two separate DLLs on windows.

by Dave Korn-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dave Korn wrote:

>   Bootstrapped at -j4 on i686-pc-cygwin.  Tests currently running, results
> anticipated in a few hours.  

  Completed with no regressions(*):

http://gcc.gnu.org/ml/gcc-testresults/2009-08/msg03275.html

  OK now?

    cheers,
      DaveK
--
(*) - For comparison, see sample statically linked results at:

http://gcc.gnu.org/ml/gcc-testresults/2009-08/msg02325.html
http://gcc.gnu.org/ml/gcc-testresults/2009-08/msg03258.html

... and note that we always experience a little noise in the Process_, Thread_
and Throw_ testcases, which I believe to reflect an underlying bug in Cygwin's
threading/synchronisation code somewhere, as we get similar noise in the
libstdc++ mutex_weaktoshared tests and there's a hang in one of the libgomp
testcases too.  Whatever it is, it's always been there and is unaffected by
this change.

Re: [PATCH, take 2] Build java as two separate DLLs on windows.

by Andrew Haley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dave Korn wrote:

>   Here's the final version of my libjava-as-dlls patch.  Nobody had anything
> much to say about the first draft so I take it there were no obvious massive
> flaws;

No, you take it that I was AFK for a few days and didn't have the time
to look at it.

>   Bootstrapped at -j4 on i686-pc-cygwin.  Tests currently running, results
> anticipated in a few hours.  Assuming (as I have every reason to expect) no
> regressions, OK for HEAD?

Please wait for approval.

Andrew.

Re: [PATCH, take 2] Build java as two separate DLLs on windows.

by Dave Korn-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Andrew Haley wrote:
> Dave Korn wrote:
>
>>   Here's the final version of my libjava-as-dlls patch.  Nobody had anything
>> much to say about the first draft so I take it there were no obvious massive
>> flaws;
>
> No, you take it that I was AFK for a few days and didn't have the time
> to look at it.

  Well not exactly, I had no idea where you were, I'm not following you
around, honest!  (And I was including other maintainers from both java and gcc
sides in that reference, nobody else volunteered an opinion either.  It wasn't
in any way a pointed comment directed at you personally.)

>>   Bootstrapped at -j4 on i686-pc-cygwin.  Tests currently running, results
>> anticipated in a few hours.  Assuming (as I have every reason to expect) no
>> regressions, OK for HEAD?
>
> Please wait for approval.

  Of course, I thought that went without saying.  When I write "OK for HEAD?",
it is a request for review and approval, so I thought that's exactly what I
was doing already.  (I don't actually go round checking stuff in without
permission do I?)

    cheers,
      DaveK


Re: [PATCH, take 2] Build java as two separate DLLs on windows.

by Andrew Haley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dave Korn wrote:

> Andrew Haley wrote:
>> Dave Korn wrote:
>>
>>>   Here's the final version of my libjava-as-dlls patch.  Nobody had anything
>>> much to say about the first draft so I take it there were no obvious massive
>>> flaws;
>> No, you take it that I was AFK for a few days and didn't have the time
>> to look at it.
>
>   Well not exactly, I had no idea where you were, I'm not following you
> around, honest!  (And I was including other maintainers from both java and gcc
> sides in that reference, nobody else volunteered an opinion either.  It wasn't
> in any way a pointed comment directed at you personally.)

Sure, I know.  At this time of year reviewing can get a bit slow.  :-)

>>>   Bootstrapped at -j4 on i686-pc-cygwin.  Tests currently running, results
>>> anticipated in a few hours.  Assuming (as I have every reason to expect) no
>>> regressions, OK for HEAD?
>> Please wait for approval.
>
>   Of course, I thought that went without saying.  When I write "OK for HEAD?",
> it is a request for review and approval, so I thought that's exactly what I
> was doing already.  (I don't actually go round checking stuff in without
> permission do I?)

Don't take it wrong: I'm not complaining, just explaining.

I also wanted to let the other gcj maintainers know that I am interested in
this patch and will try to review it.

Andrew.

Re: [PATCH, take 2] Build java as two separate DLLs on windows.

by Andrew Haley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Andrew Haley wrote:
> Dave Korn wrote:
>> Andrew Haley wrote:
>>> Dave Korn wrote:
>>>
>>>>   Here's the final version of my libjava-as-dlls patch.  Nobody had anything
>>>> much to say about the first draft so I take it there were no obvious massive
>>>> flaws;

> I also wanted to let the other gcj maintainers know that I am interested in
> this patch and will try to review it.

I had a look, and while it looks OK it seems to be written only for Windows.
That's a shame.  Will it work on GNU/Linux?  Can it be made to?  That would
help to keep the facility from bitrotting.

Andrew.

Re: [PATCH, take 2] Build java as two separate DLLs on windows.

by Dave Korn-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Andrew Haley wrote:

> Andrew Haley wrote:
>> Dave Korn wrote:
>>> Andrew Haley wrote:
>>>> Dave Korn wrote:
>>>>
>>>>>   Here's the final version of my libjava-as-dlls patch.  Nobody had anything
>>>>> much to say about the first draft so I take it there were no obvious massive
>>>>> flaws;
>
>> I also wanted to let the other gcj maintainers know that I am interested in
>> this patch and will try to review it.
>
> I had a look, and while it looks OK it seems to be written only for Windows.
> That's a shame.  Will it work on GNU/Linux?  Can it be made to?  That would
> help to keep the facility from bitrotting.

  I haven't tried to make it work on Linux, as I'm none too clear about the
implications of ELFs and DSOs and rpaths and how it all relates, but it ought
to be possible and not even too difficult; the principle of just dividing up
the list of .lo files into separate sublibraries built by libtool ought to
at-least-nearly almost work already.  (It might even "just work" as-is, but
that seems a couple of iotas too much to hope for.)

  I have a couple of very busy days immediately ahead but I'll try and take it
for a spin on a linux VM later this week or over the weekend.

    cheers,
      DaveK


Re: [PATCH, take 2] Build java as two separate DLLs on windows.

by Ralf Wildenhues :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Dave,

* Dave Korn wrote on Mon, Aug 31, 2009 at 09:02:37PM CEST:
> libjava/libltdl/ChangeLog:

> * Makefile.am (libltdl_la_LDFLAGS): Remove -bindir switch.
> * Makefile.in: Regenerate.

Why is this bit part of this big patch?  It could be a separate patch,
as it is a fixup of your earlier -bindir patch.  And IIUC it's obvious,
too (you are undoing part of an earlier patch of yours).

Thanks,
Ralf

> --- libjava/libltdl/Makefile.am (revision 151124)
> +++ libjava/libltdl/Makefile.am (working copy)
> @@ -22,7 +22,7 @@ endif
>  CLEANFILES = libltdl.la libltdlc.la
>  
>  libltdl_la_SOURCES = ltdl.c
> -libltdl_la_LDFLAGS = -no-undefined -bindir "$(bindir)" -version-info 4:1:1
> +libltdl_la_LDFLAGS = -no-undefined -version-info 4:1:1
>  libltdl_la_LIBADD = $(LIBADD_DL)
>  
>  libltdlc_la_SOURCES = ltdl.c

Re: [PATCH, take 2] Build java as two separate DLLs on windows.

by Dave Korn-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ralf Wildenhues wrote:

> Hello Dave,
>
> * Dave Korn wrote on Mon, Aug 31, 2009 at 09:02:37PM CEST:
>> libjava/libltdl/ChangeLog:
>
>> * Makefile.am (libltdl_la_LDFLAGS): Remove -bindir switch.
>> * Makefile.in: Regenerate.
>
> Why is this bit part of this big patch?  It could be a separate patch,
> as it is a fixup of your earlier -bindir patch.  And IIUC it's obvious,
> too (you are undoing part of an earlier patch of yours).

  Was being slightly lazy.  If this patch gets approved fairly soon I'll roll
it up in, but if it's more than a few days I guess I could commit that bit
first.  I mean, technically I could break the whole thing down into a number
of subpatches, one that builds a single broken DLL, then another that splits
it into two DLLs that don't work very well, then another to turn on JCR
sections and make them PASS a few more tests, then another to fix the
backtrace bug and PASS a few more tests - but I didn't want to do it that way
(and the extra cpu cycles of running all those tests separately one on top of
the other on top of the other would likely run over the end of stage 1), so I
figured on presenting "Here in one fell swoop is everything we need to make
libjava good on windows".

    cheers,
      DaveK


Re: [PATCH, take 2] Build java as two separate DLLs on windows.

by Dave Korn-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Andrew Haley wrote:

> I had a look, and while it looks OK it seems to be written only for
> Windows. That's a shame.  Will it work on GNU/Linux?  Can it be made to?
> That would help to keep the facility from bitrotting.

  It doesn't quite work on linux.  Builds both the libraries, but then there's
some kind of problem caused by the use of ELF visibility when it starts trying
to link the tools against them:

------------------------------------------------------------------
/bin/sh ./libtool --tag=GCJ  --mode=link /gnu/gcc/obj/./gcc/gcj
-B/gnu/gcc/obj/i686-pc-linux-gnu/libjava/ -B/gnu/gcc/obj/./gcc/
-B/opt/gcc-tools/i686-pc-linux-gnu/bin/
-B/opt/gcc-tools/i686-pc-linux-gnu/lib/ -isystem
/opt/gcc-tools/i686-pc-linux-gnu/include -isystem
/opt/gcc-tools/i686-pc-linux-gnu/sys-include
-L/gnu/gcc/obj/i686-pc-linux-gnu/libjava -ffloat-store -fomit-frame-pointer
-Usun -g -O2  -o jv-convert --main=gnu.gcj.convert.Convert -rpath
/opt/gcc-tools/lib/gcc/i686-pc-linux-gnu/4.5.0 -shared-libgcc
-L/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs libgcj.la
libtool: link: /gnu/gcc/obj/./gcc/gcj
-B/gnu/gcc/obj/i686-pc-linux-gnu/libjava/ -B/gnu/gcc/obj/./gcc/
-B/opt/gcc-tools/i686-pc-linux-gnu/bin/
-B/opt/gcc-tools/i686-pc-linux-gnu/lib/ -isystem
/opt/gcc-tools/i686-pc-linux-gnu/include -isystem
/opt/gcc-tools/i686-pc-linux-gnu/sys-include -ffloat-store
-fomit-frame-pointer -Usun -g -O2 -o .libs/jv-convert
--main=gnu.gcj.convert.Convert -shared-libgcc
-L/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs
-L/gnu/gcc/obj/i686-pc-linux-gnu/libjava ./.libs/libgcj.so -lpthread -lrt -ldl
-Wl,-rpath -Wl,/opt/gcc-tools/lib/gcc/i686-pc-linux-gnu/4.5.0
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for long long
gnu::java::lang::management::VMMemoryPoolMXBeanImpl::getUsageThresholdCount(java::lang::String*)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for JArray<java::lang::String*>*
gnu::java::lang::management::VMMemoryPoolMXBeanImpl::getMemoryManagerNames(java::lang::String*)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for bool
gnu::java::lang::management::VMMemoryMXBeanImpl::isVerbose()'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for JArray<long long>*
gnu::java::lang::management::VMThreadMXBeanImpl::findDeadlockedThreads()'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for long long
gnu::java::lang::management::VMRuntimeMXBeanImpl::getStartTime()'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for bool
gnu::java::lang::management::VMMemoryPoolMXBeanImpl::isValid(java::lang::String*)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for java::lang::management::ThreadInfo*
gnu::java::lang::management::VMThreadMXBeanImpl::getThreadInfoForId(long long,
int)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for bool
gnu::java::lang::management::VMClassLoadingMXBeanImpl::isVerbose()'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for JArray<char>*
gnu::gcj::io::SimpleSHSStream::shsFinal(JArray<char>*)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for java::lang::management::MemoryUsage*
gnu::java::lang::management::VMMemoryPoolMXBeanImpl::getCollectionUsage(java::lang::String*)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for void
gnu::java::lang::management::VMMemoryPoolMXBeanImpl::setUsageThreshold(java::lang::String*,
long long)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for void
gnu::java::lang::management::VMThreadMXBeanImpl::getLockInfo(java::lang::management::ThreadInfo*)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for JArray<char>*
gnu::gcj::io::SimpleSHSStream::shsInit()'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for long long
gnu::java::lang::management::VMThreadMXBeanImpl::getCurrentThreadUserTime()'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for int
gnu::java::lang::management::VMMemoryMXBeanImpl::getObjectPendingFinalizationCount()'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for java::lang::management::MemoryUsage*
gnu::java::lang::management::VMMemoryPoolMXBeanImpl::getUsage(java::lang::String*)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for JArray<java::lang::String*>*
gnu::java::lang::management::VMRuntimeMXBeanImpl::getInputArguments()'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for long long
gnu::java::lang::management::VMGarbageCollectorMXBeanImpl::getCollectionCount(java::lang::String*)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for long long
gnu::java::lang::management::VMMemoryPoolMXBeanImpl::getUsageThreshold(java::lang::String*)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for long long
gnu::java::lang::management::VMCompilationMXBeanImpl::getTotalCompilationTime()'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for JArray<long long>*
gnu::java::lang::management::VMThreadMXBeanImpl::findMonitorDeadlockedThreads()'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for void
gnu::java::lang::management::VMMemoryMXBeanImpl::setVerbose(bool)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for void
gnu::java::lang::management::VMThreadMXBeanImpl::getMonitorInfo(java::lang::management::ThreadInfo*)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for long long
gnu::java::lang::management::VMClassLoadingMXBeanImpl::getUnloadedClassCount()'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for int
gnu::java::lang::management::VMThreadMXBeanImpl::getPeakThreadCount()'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for int
gnu::java::lang::management::VMClassLoadingMXBeanImpl::getLoadedClassCount()'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for long long
gnu::java::lang::management::VMGarbageCollectorMXBeanImpl::getCollectionTime(java::lang::String*)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for java::lang::String*
gnu::java::lang::management::VMMemoryPoolMXBeanImpl::getType(java::lang::String*)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for java::lang::management::MemoryUsage*
gnu::java::lang::management::VMMemoryMXBeanImpl::getNonHeapMemoryUsage()'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for void
gnu::java::lang::management::VMMemoryPoolMXBeanImpl::setCollectionUsageThreshold(java::lang::String*,
long long)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for void
gnu::java::lang::management::VMClassLoadingMXBeanImpl::setVerbose(bool)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for java::lang::management::MemoryUsage*
gnu::java::lang::management::VMMemoryPoolMXBeanImpl::getPeakUsage(java::lang::String*)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for long long
gnu::java::lang::management::VMThreadMXBeanImpl::getThreadUserTime(long long)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for void
gnu::java::lang::management::VMThreadMXBeanImpl::resetPeakThreadCount()'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for long long
gnu::java::lang::management::VMMemoryPoolMXBeanImpl::getCollectionUsageThreshold(java::lang::String*)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for void
gnu::gcj::io::SimpleSHSStream::shsUpdate(JArray<char>*, JArray<char>*, int)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for long long
gnu::java::lang::management::VMThreadMXBeanImpl::getThreadCpuTime(long long)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for double
gnu::java::lang::management::VMOperatingSystemMXBeanImpl::getSystemLoadAverage()'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for void
gnu::java::lang::management::VMMemoryPoolMXBeanImpl::resetPeakUsage(java::lang::String*)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for long long
gnu::java::lang::management::VMMemoryPoolMXBeanImpl::getCollectionUsageThresholdCount(java::lang::String*)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for bool
gnu::java::lang::management::VMMemoryManagerMXBeanImpl::isValid(java::lang::String*)'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for long long
gnu::java::lang::management::VMThreadMXBeanImpl::getTotalStartedThreadCount()'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for long long
gnu::java::lang::management::VMRuntimeMXBeanImpl::getPID()'
/gnu/gcc/obj/i686-pc-linux-gnu/libjava/.libs/libgcj-noncore.so: undefined
reference to `hidden alias for long long
gnu::java::lang::management::VMThreadMXBeanImpl::getCurrentThreadCpuTime()'
collect2: ld returned 1 exit status
make[3]: *** [jv-convert] Error 1
------------------------------------------------------------------

  I would guess that when the functions were all in one library together they
could see each other even if not externally visible, and now they're in
separate libraries they can't.  PE targets don't support visibility so it
doesn't prevent the functions being imported by libgcj-noncore from libgcj.

  Not being a major ELF-head, I don't know what would be the right thing to do
about this.  Make them visible?  Is there any way of declaring a "friend library"?

    cheers,
      DaveK

Re: [PATCH, take 2] Build java as two separate DLLs on windows.

by Andrew Haley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dave Korn wrote:
> Andrew Haley wrote:
>
>> I had a look, and while it looks OK it seems to be written only for
>> Windows. That's a shame.  Will it work on GNU/Linux?  Can it be made to?
>> That would help to keep the facility from bitrotting.
>
>   It doesn't quite work on linux.  Builds both the libraries, but then there's
> some kind of problem caused by the use of ELF visibility when it starts trying
> to link the tools against them:

>   I would guess that when the functions were all in one library together they
> could see each other even if not externally visible, and now they're in
> separate libraries they can't.  PE targets don't support visibility so it
> doesn't prevent the functions being imported by libgcj-noncore from libgcj.
>
>   Not being a major ELF-head, I don't know what would be the right thing to do
> about this.  Make them visible?  Is there any way of declaring a "friend library"?

Maybe just disable the linker script when split into two libraries?  It'd still
work.

Andrew.

Re: [PATCH, take 2] Build java as two separate DLLs on windows.

by Dave Korn-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Andrew Haley wrote:

> Dave Korn wrote:
>> Andrew Haley wrote:
>>
>>> I had a look, and while it looks OK it seems to be written only for
>>> Windows. That's a shame.  Will it work on GNU/Linux?  Can it be made to?
>>> That would help to keep the facility from bitrotting.
>>   It doesn't quite work on linux.  Builds both the libraries, but then there's
>> some kind of problem caused by the use of ELF visibility when it starts trying
>> to link the tools against them:
>
>>   I would guess that when the functions were all in one library together they
>> could see each other even if not externally visible, and now they're in
>> separate libraries they can't.  PE targets don't support visibility so it
>> doesn't prevent the functions being imported by libgcj-noncore from libgcj.
>>
>>   Not being a major ELF-head, I don't know what would be the right thing to do
>> about this.  Make them visible?  Is there any way of declaring a "friend library"?
>
> Maybe just disable the linker script when split into two libraries?  It'd still
> work.

  You mean the version script?  Nope, didn't help any.  The symbols are
already marked hidden in the objects before they get linked anyway, by
hardcoded statements like "DECL_VISIBILITY (decl) = VISIBILITY_HIDDEN;" in
places like build_java_method_aliases(), java_mark_cni_decl_local() and
java_hide_decl().

  What did work, which I tried as an experiment, was commenting out the
definition of HAVE_GAS_HIDDEN in $objdir/gcc/config.h, rebuilding in
$objdir/gcc to rebuild the compiler with no ability to use hidden symbols at
all, then cleaning and remaking in $objdir/$target/libjava.  That got me two
fully-working split .so libraries, and the testsuite ran all the way through
without any failures.

  That's obviously just a crude proof-of-concept.  Would we need to do
something like add a switch to the java compiler to tell it not to use hidden
aliases and use that in the libtool compile flags when building libjava?

    cheers,
      DaveK




Re: [PATCH, take 2] Build java as two separate DLLs on windows.

by Dave Korn-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Andrew Haley wrote:
> Dave Korn wrote:
>> Andrew Haley wrote:
>>> Dave Korn wrote:
>>>
>>>>   Here's the final version of my libjava-as-dlls patch.  

>
> I also wanted to let the other gcj maintainers know that I am interested in
> this patch and will try to review it.

  Minor ping, then?  If it makes it any easier to review, I've committed it
onto a branch in the SVN repo:

svn+ssh://$USERNAME@.../svn/gcc/branches/cygwin-improvements

    cheers,
      DaveK

Re: [PATCH, take 2] Build java as two separate DLLs on windows.

by Andrew Haley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dave Korn wrote:

> Andrew Haley wrote:
>> Dave Korn wrote:
>>> Andrew Haley wrote:
>>>> Dave Korn wrote:
>>>>
>>>>>   Here's the final version of my libjava-as-dlls patch.  
>
>> I also wanted to let the other gcj maintainers know that I am interested in
>> this patch and will try to review it.
>
>   Minor ping, then?  If it makes it any easier to review, I've committed it
> onto a branch in the SVN repo:
>
> svn+ssh://$USERNAME@.../svn/gcc/branches/cygwin-improvements

I was hoping that we'd get a portable solution.  Oh well, maybe it can't
be done.

I hate this:

Index: cygwin.h
===================================================================
--- cygwin.h    (revision 151777)
+++ cygwin.h    (revision 151778)
@@ -267,3 +267,7 @@
 #define LIBGCC_EH_EXTN "-sjlj"
 #endif
 #define LIBGCC_SONAME "cyggcc_s" LIBGCC_EH_EXTN "-1.dll"
+
+/* We should find a way to not have to update this manually.  */
+#define LIBGCJ_SONAME "cyggcj" /*LIBGCC_EH_EXTN*/ "-11.dll"

Not your fault, I know: all this messing about is to make the class
registration data a bit smaller and the registration process faster.
So it goes.

The patch is OK to go in.

Andrew.

Re: [PATCH, take 2] Build java as two separate DLLs on windows.

by Dave Korn-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Andrew Haley wrote:

> Dave Korn wrote:
>> Andrew Haley wrote:
>>> Dave Korn wrote:
>>>> Andrew Haley wrote:
>>>>> Dave Korn wrote:
>>>>>
>>>>>>   Here's the final version of my libjava-as-dlls patch.  
>>> I also wanted to let the other gcj maintainers know that I am interested in
>>> this patch and will try to review it.
>>   Minor ping, then?  If it makes it any easier to review, I've committed it
>> onto a branch in the SVN repo:
>>
>> svn+ssh://$USERNAME@.../svn/gcc/branches/cygwin-improvements
>
> I was hoping that we'd get a portable solution.  Oh well, maybe it can't
> be done.

  Did you catch my other post where I tried it (on linux) after crudely
disabling visibility support and it worked?  So it has to at least be
possible, and I hope we can build it on top of this patch.

> I hate this:

  :) Me too, hence the comment.

> Not your fault, I know: all this messing about is to make the class
> registration data a bit smaller and the registration process faster.
> So it goes.

  It's worth it.  There is a benefit for all users.  There is a small cost,
and it's pretty much only on me: I have to promise to stick around and keep
these numbers up-to-date when they change, until such time as I can figure out
an automatic way of doing it in the build script.  I think I can fairly safely
commit to that small level of maintenance effort.

> The patch is OK to go in.

  TYVM, will go ahead shortly.

    cheers,
      DaveK


Re: [PATCH, take 2] Build java as two separate DLLs on windows.

by Andrew Haley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dave Korn wrote:

> Andrew Haley wrote:
>> Dave Korn wrote:
>>> Andrew Haley wrote:
>>>> Dave Korn wrote:
>>>>> Andrew Haley wrote:
>>>>>> Dave Korn wrote:
>>>>>>
>>>>>>>   Here's the final version of my libjava-as-dlls patch.  
>>>> I also wanted to let the other gcj maintainers know that I am interested in
>>>> this patch and will try to review it.
>>>   Minor ping, then?  If it makes it any easier to review, I've committed it
>>> onto a branch in the SVN repo:
>>>
>>> svn+ssh://$USERNAME@.../svn/gcc/branches/cygwin-improvements
>> I was hoping that we'd get a portable solution.  Oh well, maybe it can't
>> be done.
>
>   Did you catch my other post where I tried it (on linux) after crudely
> disabling visibility support and it worked?  So it has to at least be
> possible, and I hope we can build it on top of this patch.

OK.

Andrew.