|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
[PATCH] Build libjava as two separate gorillas on Windows.[ ref thread: http://gcc.gnu.org/ml/gcc/2009-05/threads.html#00130
continued: http://gcc.gnu.org/ml/gcc/2009-08/threads.html#00404 see also: http://gcc.gnu.org/wiki/Internal_dependencies_of_libgcj ] Hi lists, Sorry, did I say "gorillas"? I meant DLLs. This patch enables building libjava as two separate DLLs on Cygwin, and potentially on MinGW as well, although I haven't tested that side of it yet. (Offers of help there would come in handy as I'm not set up for gcc development on MinGW.) The attached patch will need at least one minor respin before it's ready, but time is running out on stage 1, so I want to put a marker down that I'd like to get this in for 4.5.0, and hopefully get any points arising after review done together with the known glitches all in one single respin. The design of the patch is fairly straightforward. It adds a configure option, --enable-libgcj-sublibs, with a default settable in configure.host, and an automake conditional derived from it. If sublibs are enabled, the Makefile filters the list of libgcj libtool objects against a manually generated list of core files and builds only those into libgcj, then it builds a non-core library that depends on the core one. First off, there is one known bug and one known weakness in this patch. The bug is a missing dependency that can break parallel builds: the tools like jv-convert.exe and gcj-dbtool.exe only currently depend on the core library, and so might be built ahead of or in parallel with the noncore library. This causes the final link of the tools to fail, because both libraries are passed to LD on the command-line via the GCJ linker spec, and LD reports "cannot find -lgcj-noncore". I think that to solve this I need to add simple dependencies for them inside "if BUILD_SUBLIBS", just haven't done it in this iteration. The weakness is that it systematically ignores the whole USE_LIBGCJ_BC thing. I didn't approach that yet because I'm not 100% clear what's going on with it. I /think/ that libgcj_bc.la is basically a version of libgcj compiled with the binary abi, but there's all this stuff in the makefile about a dummy library and making a link to the real libgcj, so maybe I don't actually need to do anything except extend the specs handling a bit. Advice eagerly accepted here. 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: * libltdl/ltdl.h (LT_SCOPE): Change conditional to avoid breaking auto-export during libgcj DLL linking. * 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): New variable to abstract "-lgcj" from specs. (LIBGCJ_SPEC): Use it. * configure: 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. * 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. * Makefile.in: Regenerate. It bootstraps - modulo the parallel build bug - on i686-pc-cygwin, and passes make check with no regressions (and apparently fixes the PR16923 test compilation FAIL in passing, but I haven't looked at how or why yet, it could be some other recent change). Apart from the two known issues, what else do I need to fix up before this is good to apply? 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/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,20 @@ 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 + libgcj_spec_lgcj_override="-lgcj-noncore -lgcj" +fi + + # See if the user has requested runtime debugging. LIBGCJDEBUG="disable" AC_SUBST(LIBGCJDEBUG) @@ -897,6 +912,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 +1093,13 @@ 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 +if test x"$libgcj_spec_lgcj_override" != x ; then + LIBGCJ_SPEC_LGCJ=$libgcj_spec_lgcj_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;:-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 @@ -221,7 +385,7 @@ libgij_la_DEPENDENCIES = libgcj.la libgcj.spec ## 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 +441,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 +449,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 +467,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,7 +491,8 @@ 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 libgcj_tools_la_LINK = $(LIBLINK) $(libgcj_tools_la_LDFLAGS) @@ -325,7 +501,8 @@ libjvm_la_SOURCES = jni-libjvm.cc libjvm_la_DEPENDENCIES = libgcj.la libgcj.spec ## 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. @@ -351,7 +528,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 +538,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. |
|
|
Re: [PATCH] Build libjava as two separate gorillas on Windows.On Thu, Aug 27, 2009 at 10:45 PM, Dave
Korn<dave.korn.cygwin@...> wrote: > The weakness is that it systematically ignores the whole USE_LIBGCJ_BC > thing. I didn't approach that yet because I'm not 100% clear what's going on > with it. I /think/ that libgcj_bc.la is basically a version of libgcj > compiled with the binary abi, but there's all this stuff in the makefile about > a dummy library and making a link to the real libgcj, so maybe I don't > actually need to do anything except extend the specs handling a bit. Advice > eagerly accepted here. Dave, The libgcj_bc library is a dummy library that is needed due to the way that shared library versioning (ie soname) works on ELF systems. It contains no actual code, just a bunch of symbols that BC compiled applications can link against instead of linking libgcj.so directly. This means that those BC-compiled binaries will continue to work when the underlying libgcj is updated to a new version with a new soname. (If all applications were BC compiled, it wouldn't be necessary - we could just avoid changing libgcj's soname) I don't know a lot about DLL versioning on Windows, but I suspect that libgcj_bc may not be required and shouldn't be built on that platform. Bryce |
|
|
Re: [PATCH] Build libjava as two separate gorillas on Windows.Bryce McKinlay wrote:
> On Thu, Aug 27, 2009 at 10:45 PM, Dave Korn wrote: > >> The weakness is that it systematically ignores the whole USE_LIBGCJ_BC >> thing. I didn't approach that yet because I'm not 100% clear what's going on >> with it. I /think/ that libgcj_bc.la is basically a version of libgcj >> compiled with the binary abi, but there's all this stuff in the makefile about >> a dummy library and making a link to the real libgcj, so maybe I don't >> actually need to do anything except extend the specs handling a bit. Advice >> eagerly accepted here. > > Dave, > > The libgcj_bc library is a dummy library that is needed due to the way > that shared library versioning (ie soname) works on ELF systems. It > contains no actual code, just a bunch of symbols that BC compiled > applications can link against instead of linking libgcj.so directly. > This means that those BC-compiled binaries will continue to work when > the underlying libgcj is updated to a new version with a new soname. > (If all applications were BC compiled, it wouldn't be necessary - we > could just avoid changing libgcj's soname) TYVM Bryce :) > I don't know a lot about DLL versioning on Windows, but I suspect that > libgcj_bc may not be required and shouldn't be built on that platform. Well, we might decide it's a nice feature to use on windows as well, currently any java executable will end up with an embedded reference to cyggcj-11.dll, and the version tag will occasionally change. We deal with that by keeping old library versions around because we don't have symbol versioning, but either/and/or both of those may potentially be improved in the future, and we could probably make the same kind of proxying-through-a-library-that-doesn't-change-soname work on Windows. But that's a project for another day, and would necessitate adding a libgcj-noncore_bc.la as well as libgcj_bc.la. BTW, in case you didn't spot the new thread yet, I already respun this patch and posted the final submission: http://gcc.gnu.org/ml/gcc-patches/2009-08/threads.html#01679 cheers, DaveK |
| Free embeddable forum powered by Nabble | Forum Help |