public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Build libgcj, libgcj-tools, and libffi as shared libraries  on Windows
@ 2008-08-24  4:23 Aaron W. LaFramboise
  2008-08-24 11:07 ` Danny Smith
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Aaron W. LaFramboise @ 2008-08-24  4:23 UTC (permalink / raw)
  To: gcc-patches, java-patches

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

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?


[-- Attachment #2: gcc-4.4.0-20080823-libjava_s.patch --]
[-- Type: text/plain, Size: 3713 bytes --]

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 */

^ permalink raw reply	[flat|nested] 22+ messages in thread
[parent not found: <48B1DA69.9070306@cwilson.fastmail.fm>]

end of thread, other threads:[~2009-04-15  0:13 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-24  4:23 [PATCH] Build libgcj, libgcj-tools, and libffi as shared libraries on Windows Aaron W. LaFramboise
2008-08-24 11:07 ` Danny Smith
2008-08-24 16:54 ` Andrew Haley
2008-08-24 20:09   ` Aaron W. LaFramboise
2009-04-11  5:33 ` Dave Korn
2009-04-11  9:36   ` Andrew Haley
2009-04-11 11:20     ` Dave Korn
2009-04-11 20:13       ` Andrew Haley
2009-04-11 17:15   ` Aaron W. LaFramboise
2009-04-11 18:12     ` Dave Korn
2009-04-11 21:52       ` Aaron W. LaFramboise
2009-04-11 23:03         ` Dave Korn
2009-04-12  4:15           ` Aaron W. LaFramboise
2009-04-11 23:15       ` Pedro Alves
2009-04-11 23:17         ` Dave Korn
2009-04-11 23:58           ` Pedro Alves
2009-04-15  0:03             ` Ian Lance Taylor
2009-04-15  0:13               ` Pedro Alves
     [not found] <48B1DA69.9070306@cwilson.fastmail.fm>
2008-08-25  4:34 ` Aaron W. LaFramboise
2008-08-25  4:37   ` Charles Wilson
2008-08-25  4:57     ` Charles Wilson
2008-08-25 18:11     ` Paolo Bonzini

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