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, 3/4] Enable libstdc++ as a DLL on windows platforms.


  This is patch #3 in the series.  It enables libtool to build a DLL version
of libstdc++ by passing it the -no-undefined option, and adds the necessary
#defines to Cygwin's os-dependent header to configure the libstdc++ build
correctly for Cygwin.


libstdc++-v3/ChangeLog:

	* src/Makefile.am (LTLDFLAGS): Add -no-undefined.
	* libsupc++/Makefile.am (LTLDFLAGS): Likewise.
	* src/Makefile.in: Regenerate.
	* libsupc++/Makefile.in: Regenerate.
	* config/os/newlib/os_defines.h (__GXX_MERGED_TYPEINFO_NAMES): Add
	definition to disable on Cygwin.
	(__GXX_TYPEINFO_EQUALITY_INLINE): Likewise.
	(_GLIBCXX_IMPORT): Define to dllimport when needed.
	* testsuite/lib/libstdc++.exp (proc libstdc++_init): Adjust
	DEFAULT_CXXFLAGS and ld_library_path_tmp for Cygwin.

  Ok?

    cheers,
      DaveK
libstdc++-v3/ChangeLog:

	* src/Makefile.am (LTLDFLAGS): Add -no-undefined.
	* libsupc++/Makefile.am (LTLDFLAGS): Likewise.
	* src/Makefile.in: Regenerate.
	* libsupc++/Makefile.in: Regenerate.
	* config/os/newlib/os_defines.h (__GXX_MERGED_TYPEINFO_NAMES): Add
	definition to disable on Cygwin.
	(__GXX_TYPEINFO_EQUALITY_INLINE): Likewise.
	(_GLIBCXX_IMPORT): Define to dllimport when needed.
	* testsuite/lib/libstdc++.exp (proc libstdc++_init): Adjust
	DEFAULT_CXXFLAGS and ld_library_path_tmp for Cygwin.

Index: libstdc++-v3/src/Makefile.am
===================================================================
--- libstdc++-v3/src/Makefile.am	(revision 149338)
+++ libstdc++-v3/src/Makefile.am	(working copy)
@@ -345,7 +345,7 @@ AM_CXXFLAGS = \
 LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \
 	       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) 
 
-LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
+LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) -no-undefined
 
 # 3) We'd have a problem when building the shared libstdc++ object if
 # the rules automake generates would be used.  We cannot allow g++ to
Index: libstdc++-v3/libsupc++/Makefile.am
===================================================================
--- libstdc++-v3/libsupc++/Makefile.am	(revision 149338)
+++ libstdc++-v3/libsupc++/Makefile.am	(working copy)
@@ -154,7 +154,7 @@ LTCXXCOMPILE = $(LIBTOOL) --tag CXX --tag disable-
 	       --mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \
 	       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) 
 
-LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
+LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) -no-undefined
 
 # 3) We'd have a problem when building the shared libstdc++ object if
 # the rules automake generates would be used.  We cannot allow g++ to
Index: libstdc++-v3/testsuite/lib/libstdc++.exp
===================================================================
--- libstdc++-v3/testsuite/lib/libstdc++.exp	(revision 149338)
+++ libstdc++-v3/testsuite/lib/libstdc++.exp	(working copy)
@@ -114,6 +114,9 @@ proc libstdc++_init { testfile } {
 	if { [string match "powerpc-*-darwin*" $target_triplet] } {
 	    append DEFAULT_CXXFLAGS " -multiply_defined suppress"
 	} 
+	if { [string match "*-*-cygwin*" $target_triplet] } {
+	    append DEFAULT_CXXFLAGS " -Wl,--enable-auto-import"
+	} 
     }
     v3track DEFAULT_CXXFLAGS 2
 
@@ -133,6 +136,9 @@ proc libstdc++_init { testfile } {
     if {$gccdir != ""} {
         set gccdir [file dirname $gccdir]
     }
+    if { [string match "*-*-cygwin*" $target_triplet] } {
+	append ld_library_path_tmp ":${blddir}/../libgcc"
+    }
     v3track gccdir 3
 
     # Locate libgomp. This is only required for parallel mode.
Index: libstdc++-v3/config/os/newlib/os_defines.h
===================================================================
--- libstdc++-v3/config/os/newlib/os_defines.h	(revision 149338)
+++ libstdc++-v3/config/os/newlib/os_defines.h	(working copy)
@@ -35,9 +35,18 @@
 
 #ifdef __CYGWIN__
 #define _GLIBCXX_GTHREAD_USE_WEAK 0
+#define __GXX_MERGED_TYPEINFO_NAMES 0
+#define __GXX_TYPEINFO_EQUALITY_INLINE 0
 
 // See libstdc++/20806.
 #define _GLIBCXX_HAVE_DOS_BASED_FILESYSTEM 1
+
+#ifdef _DLL
+#define _GLIBCXX_IMPORT __attribute__((dllimport))
+#else
+#define _GLIBCXX_IMPORT
 #endif
 
 #endif
+
+#endif

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