This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Build libgcj, libgcj-tools, and libffi as shared libraries on Windows


This patch builds libgcj, libgcj-tools, and libffi as DLLs on Windows.

Autoimport is used in the final link of some of the tools. This is OK for now, but suboptimal in the long run. I'll address this later by adding the proper decorations.

This massively reduces the size of a full GCC installation on Windows. Most of the tools go from being about 44 MB to about 20 KB.

The DLL itself is pretty massive, weighing in at 70 MB (29 MB stripped), and a massive 82217 exports. In the future, it might possible to improve this situation by linking by ordinal.

I tested this by a bootstrap on i386-pc-mingw32.

OK to commit?

2008-08-23  Aaron W. LaFramboise  <aaronavay62@aaronwl.com>

	<libffi>
	* libffi/Makefile.am (LTLDFLAGS): Add -no-undefined.
	* Makefile.in: Regenerate.
	* include/Makefile.in: Regenerated.
	* libffi/testsuite/Makefile.in: Regenerated.

	<libjava>
	* configure.ac [mingw|cygwin] (extra_ldflags_libjava): Add -lws2_32.
	* Makefile.am (extra_cppflags_libjava): New.
	(AM_CPPFLAGS): Use extra_cppflags_libjava.
	* Makefile.in: Regenerated.
	* configure: Regenerated.
	* gcj/Makefile.in: Regenerated.
	* include/Makefile.in: Regenerated.
	* testsuite/Makefile.in: Regenerated.

	<libjava/libltdl>
	* ltdl.c (DLL_EXPORT): Rename to LIBLTDL_DLL_EXPORT.
	* ltdl.h (DLL_EXPORT): Rename to LIBLTDL_DLL_EXPORT.

Index: libffi/Makefile.am
===================================================================
--- libffi/Makefile.am	(revision 139510)
+++ libffi/Makefile.am	(working copy)
@@ -156,7 +156,8 @@ nodist_libffi_convenience_la_SOURCES = $
 
 AM_CFLAGS = -Wall -g -fexceptions
 
-LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
+LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) \
+        -no-undefined
 
 libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS)
 
Index: libjava/configure.ac
===================================================================
--- libjava/configure.ac	(revision 139510)
+++ libjava/configure.ac	(working copy)
@@ -811,6 +811,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++"
     ;;
+*-*-mingw*|*-*-cygwin)
+    extra_ldflags_libjava=-lws2_32
+    ;;
 esac
 AC_SUBST(extra_ldflags_libjava)
 AC_SUBST(extra_gij_ldflags)
Index: libjava/Makefile.am
===================================================================
--- libjava/Makefile.am	(revision 139510)
+++ libjava/Makefile.am	(working copy)
@@ -123,7 +123,8 @@ GCJLINK = $(LIBTOOL) --tag=GCJ --mode=li
 GCJ_FOR_ECJX = @GCJ_FOR_ECJX@
 GCJ_FOR_ECJX_LINK = $(GCJ_FOR_ECJX) -o $@
 LIBLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXX) -L$(here) $(JC1FLAGS) \
-          $(LDFLAGS) $(extra_ldflags_libjava) $(extra_ldflags) -o $@
+          $(LDFLAGS) $(extra_ldflags_libjava) $(extra_ldflags) -no-undefined \
+                    -o $@
 
 GCC_UNWIND_INCLUDE = @GCC_UNWIND_INCLUDE@
 
@@ -292,6 +293,7 @@ libgcj_tools_la_LDFLAGS = -rpath $(toole
  -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
  $(LIBGCJ_LD_SYMBOLIC_FUNCTIONS)
 libgcj_tools_la_DEPENDENCIES = libgcj.la libgcj.spec
+libgcj_tools_la_LIBADD = -L$(here)/.libs libgcj.la
 libgcj_tools_la_LINK = $(LIBLINK)
 
 ## libjvm.so
Index: libjava/libltdl/ltdl.c
===================================================================
--- libjava/libltdl/ltdl.c	(revision 139510)
+++ libjava/libltdl/ltdl.c	(working copy)
@@ -142,7 +142,7 @@ Foundation, Inc., 51 Franklin Street, Fi
 /* --- WINDOWS SUPPORT --- */
 
 
-#ifdef DLL_EXPORT
+#ifdef LIBLTDL_DLL_EXPORT
 #  define LT_GLOBAL_DATA	__declspec(dllexport)
 #else
 #  define LT_GLOBAL_DATA
Index: libjava/libltdl/ltdl.h
===================================================================
--- libjava/libltdl/ltdl.h	(revision 139510)
+++ 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		/* defined by libtool (if required) */
 #      define LT_SCOPE	__declspec(dllexport)
 #    endif
 #    ifdef LIBLTDL_DLL_IMPORT	/* define if linking with this dll */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]