[ecl] backport GC_start_call_back fixes

Rex Dieter rdieter at fedoraproject.org
Sun May 18 05:02:41 UTC 2014


commit d4c9d1c58f72dd6693be4c590b8ae687d538c704
Author: Rex Dieter <rdieter at math.unl.edu>
Date:   Sun May 18 00:02:38 2014 -0500

    backport GC_start_call_back fixes

 ...ll_back-disappeared-in-recent-versions-of.patch |  102 ++++++++++++++++++++
 ...86_64-deactivate-the-assembly-code-in-GMP.patch |   96 ++++++++++++++++++
 ...-GMP-with-C-with-c-gmp-was-broken-due-to-.patch |   62 ++++++++++++
 0041-Fixed-declaration-of-GC_start_call_back.patch |   37 +++++++
 ...s-for-the-detection-of-GC_start_call_back.patch |   73 ++++++++++++++
 ...tion-that-was-activated-by-commit-285eb31.patch |   26 +++++
 ecl.spec                                           |   15 +++-
 7 files changed, 410 insertions(+), 1 deletions(-)
---
diff --git a/0024-GC_start_call_back-disappeared-in-recent-versions-of.patch b/0024-GC_start_call_back-disappeared-in-recent-versions-of.patch
new file mode 100644
index 0000000..4fe13fc
--- /dev/null
+++ b/0024-GC_start_call_back-disappeared-in-recent-versions-of.patch
@@ -0,0 +1,102 @@
+From 6b754564f1d1a2d320b1fd46f0c0da2e623862c1 Mon Sep 17 00:00:00 2001
+From: Juanjo Garcia-Ripoll <jjgarcia at users.sf.net>
+Date: Sun, 6 Oct 2013 10:08:50 +0200
+Subject: [PATCH 24/92] GC_start_call_back disappeared in recent versions of
+ the GC library
+
+---
+ src/aclocal.m4    |  4 ++++
+ src/c/alloc_2.d   | 18 ++++++++++++++++--
+ src/h/config.h.in |  3 +++
+ 3 files changed, 23 insertions(+), 2 deletions(-)
+
+diff --git a/src/aclocal.m4 b/src/aclocal.m4
+index 1de1e92..28dce65 100644
+--- a/src/aclocal.m4
++++ b/src/aclocal.m4
+@@ -940,6 +940,10 @@ if test "${enable_boehm}" = auto -o "${enable_boehm}" = system; then
+      AC_CHECK_HEADER([gc/gc.h],[ECL_BOEHM_GC_HEADER='gc/gc.h'],[system_boehm=no],[])
+    fi
+  fi
++ if test "${system_boehm}" = "yes"; then
++   AC_CHECK_LIB( [gc], [GC_set_start_callback],
++                 [AC_DEFINE(HAVE_GC_SET_START_CALLBACK)], [] )
++ fi
+  AC_MSG_CHECKING( [whether we can use the existing Boehm-Weiser library] )
+  AC_MSG_RESULT( [${system_boehm}] )
+  if test "${system_boehm}" = "no"; then
+diff --git a/src/c/alloc_2.d b/src/c/alloc_2.d
+index 7bb4f52..5bc3572 100644
+--- a/src/c/alloc_2.d
++++ b/src/c/alloc_2.d
+@@ -31,6 +31,13 @@
+ 
+ #ifdef GBC_BOEHM
+ 
++static void (*GC_old_start_callback)(void) = NULL;
++#ifdef HAVE_GC_START_CALLBACK
++extern void GC_set_start_callback(void *);
++extern void *GC_get_start_callback(void *);
++#else
++extern void *GC_start_call_back(void);
++#endif
+ static void gather_statistics();
+ static void ecl_mark_env(struct cl_env_struct *env);
+ 
+@@ -750,7 +757,6 @@ ecl_dealloc(void *ptr)
+ static int alloc_initialized = FALSE;
+ 
+ extern void (*GC_push_other_roots)();
+-extern void (*GC_start_call_back)();
+ static void (*old_GC_push_other_roots)();
+ static void stacks_scanner();
+ 
+@@ -1090,7 +1096,13 @@ init_alloc(void)
+ #endif /* GBC_BOEHM_PRECISE */
+ 	old_GC_push_other_roots = GC_push_other_roots;
+ 	GC_push_other_roots = stacks_scanner;
++#ifdef HAVE_GC_SET_START_CALLBACK
++	GC_old_start_callback = GC_get_start_callback();
++	GC_set_start_callback(gather_statistics);
++#else
++	GC_old_start_callback = GC_start_call_back;
+ 	GC_start_call_back = (void (*)())gather_statistics;
++#endif
+ 	GC_java_finalization = 1;
+         GC_oom_fn = out_of_memory;
+         GC_set_warn_proc(no_warnings);
+@@ -1198,7 +1210,7 @@ si_set_finalizer(cl_object o, cl_object finalizer)
+ /* If we do not build our own version of the library, we do not have
+  * control over the existence of this variable.
+  */
+-#if 1 /*GBC_BOEHM == 0*/
++#if GBC_BOEHM == 0
+ extern int GC_print_stats;
+ #else
+ static int GC_print_stats;
+@@ -1277,6 +1289,8 @@ gather_statistics()
+ 			   cl_core.gc_counter->big.big_num,
+ 			   1);
+ 	}
++	if (GC_old_start_callback)
++		GC_old_start_callback();
+ }
+ 
+ 
+diff --git a/src/h/config.h.in b/src/h/config.h.in
+index 5dc851f..f6b6b8d 100644
+--- a/src/h/config.h.in
++++ b/src/h/config.h.in
+@@ -308,6 +308,9 @@ typedef unsigned char ecl_base_char;
+ #define ECL_WEAK_HASH
+ #endif
+ 
++/* GC_set_start_callback						*/
++#define HAVE_GC_SET_START_CALLBACK
++
+ /*
+  * SYSTEM FEATURES:
+  */
+-- 
+1.9.0
+
diff --git a/0025-In-Cygwin-x86_64-deactivate-the-assembly-code-in-GMP.patch b/0025-In-Cygwin-x86_64-deactivate-the-assembly-code-in-GMP.patch
new file mode 100644
index 0000000..f8f780d
--- /dev/null
+++ b/0025-In-Cygwin-x86_64-deactivate-the-assembly-code-in-GMP.patch
@@ -0,0 +1,96 @@
+From bf0f15d702d077544cebd522f7da43068daf818b Mon Sep 17 00:00:00 2001
+From: Juanjo Garcia-Ripoll <jjgarcia at users.sf.net>
+Date: Sun, 6 Oct 2013 15:26:42 +0200
+Subject: [PATCH 25/92] In Cygwin x86_64, deactivate the assembly code in GMP,
+ which is obsolete and does not support Windows calling conventions.
+
+---
+ src/aclocal.m4 |  5 +++++
+ src/configure  | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 53 insertions(+)
+
+diff --git a/src/aclocal.m4 b/src/aclocal.m4
+index 28dce65..19c4115 100644
+--- a/src/aclocal.m4
++++ b/src/aclocal.m4
+@@ -359,6 +359,11 @@ case "${host_os}" in
+ 		SHAREDPREFIX=''
+ 		SHAREDEXT='dll'
+ 		PICFLAG=''
++		if test "x$host_cpu" = "xx86_64" ; then
++		   # Our GMP library is too old and does not support
++		   # Windows64 calling conventions.
++		   with_c_gmp=yes
++		fi
+ 		;;
+ 	mingw*)
+ 		thehost='mingw32'
+diff --git a/src/configure b/src/configure
+index eb30da6..cceb7a3 100755
+--- a/src/configure
++++ b/src/configure
+@@ -4977,6 +4977,11 @@ case "${host_os}" in
+ 		SHAREDPREFIX=''
+ 		SHAREDEXT='dll'
+ 		PICFLAG=''
++		if test "x$host_cpu" = "xx86_64" ; then
++		   # Our GMP library is too old and does not support
++		   # Windows64 calling conventions.
++		   with_c_gmp=yes
++		fi
+ 		;;
+ 	mingw*)
+ 		thehost='mingw32'
+@@ -5919,6 +5924,49 @@ fi
+ 
+    fi
+  fi
++ if test "${system_boehm}" = "yes"; then
++   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GC_set_start_callback in -lgc" >&5
++$as_echo_n "checking for GC_set_start_callback in -lgc... " >&6; }
++if ${ac_cv_lib_gc_GC_set_start_callback+:} false; then :
++  $as_echo_n "(cached) " >&6
++else
++  ac_check_lib_save_LIBS=$LIBS
++LIBS="-lgc  $LIBS"
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++
++/* Override any GCC internal prototype to avoid an error.
++   Use char because int might match the return type of a GCC
++   builtin and then its argument prototype would still apply.  */
++#ifdef __cplusplus
++extern "C"
++#endif
++char GC_set_start_callback ();
++int
++main ()
++{
++return GC_set_start_callback ();
++  ;
++  return 0;
++}
++_ACEOF
++if ac_fn_c_try_link "$LINENO"; then :
++  ac_cv_lib_gc_GC_set_start_callback=yes
++else
++  ac_cv_lib_gc_GC_set_start_callback=no
++fi
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
++LIBS=$ac_check_lib_save_LIBS
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gc_GC_set_start_callback" >&5
++$as_echo "$ac_cv_lib_gc_GC_set_start_callback" >&6; }
++if test "x$ac_cv_lib_gc_GC_set_start_callback" = xyes; then :
++  $as_echo "#define HAVE_GC_SET_START_CALLBACK 1" >>confdefs.h
++
++fi
++
++ fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can use the existing Boehm-Weiser library " >&5
+ $as_echo_n "checking whether we can use the existing Boehm-Weiser library ... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${system_boehm} " >&5
+-- 
+1.9.0
+
diff --git a/0026-Configuring-GMP-with-C-with-c-gmp-was-broken-due-to-.patch b/0026-Configuring-GMP-with-C-with-c-gmp-was-broken-due-to-.patch
new file mode 100644
index 0000000..ca00060
--- /dev/null
+++ b/0026-Configuring-GMP-with-C-with-c-gmp-was-broken-due-to-.patch
@@ -0,0 +1,62 @@
+From ad0263b76de76823dc627edb9e6e4345d47246e3 Mon Sep 17 00:00:00 2001
+From: Juanjo Garcia-Ripoll <jjgarcia at users.sf.net>
+Date: Sun, 6 Oct 2013 15:46:37 +0200
+Subject: [PATCH 26/92] Configuring GMP with C (--with-c-gmp) was broken due to
+ m4 escape character issues.
+
+---
+ src/configure    | 12 ++++++++----
+ src/configure.in | 12 ++++++++----
+ 2 files changed, 16 insertions(+), 8 deletions(-)
+
+diff --git a/src/configure b/src/configure
+index cceb7a3..6d55f37 100755
+--- a/src/configure
++++ b/src/configure
+@@ -5554,11 +5554,15 @@ if test "x${with_system_gmp}" = "xno" ; then
+ $as_echo "$as_me: Configuring included GMP library:" >&6;}
+   test -d gmp && rm -rf gmp
+   if test -z "$gmp_build"; then
+-    gmp_build="${build_alias}"
++    gmp_build="${build}"
+   fi
+-  if test "w$with_c_gmp" = "xyes"; then
+-    gmp_build=`echo ${gmp_build} | sed 's,^-\(-.*\),none-\1,'`
+-    echo BUILDING WITH C $gmp_build
++  if test "x$with_c_gmp" = "xyes"; then
++    gmp_build=`echo ${gmp_build} | sed 's,[^-]*\(-.*\),none\1,'`
++    echo ***
++    echo *** BUILDING GMP WITH C!
++    echo *** This is a last resort, either because of license or
++    echo *** porting issues.
++    echo ***
+   fi
+   ECL_GMP_HEADER='ecl/gmp.h'
+   if test "x$ABI" = "x"; then
+diff --git a/src/configure.in b/src/configure.in
+index 62ac268..0a914ef 100644
+--- a/src/configure.in
++++ b/src/configure.in
+@@ -419,11 +419,15 @@ if test "x${with_system_gmp}" = "xno" ; then
+   AC_MSG_NOTICE(Configuring included GMP library:)
+   test -d gmp && rm -rf gmp
+   if test -z "$gmp_build"; then
+-    gmp_build="${build_alias}"
++    gmp_build="${build}"
+   fi
+-  if test "w$with_c_gmp" = "xyes"; then
+-    gmp_build=`echo ${gmp_build} | sed 's,[^-]\(-.*\),none-\1,'`
+-    echo BUILDING WITH C $gmp_build
++  if test "x$with_c_gmp" = "xyes"; then
++    gmp_build=`echo ${gmp_build} | sed 's,@<:@^-@:>@*\(-.*\),none\1,'`
++    echo ***
++    echo *** BUILDING GMP WITH C!
++    echo *** This is a last resort, either because of license or
++    echo *** porting issues.
++    echo ***
+   fi
+   ECL_GMP_HEADER='ecl/gmp.h'
+   if test "x$ABI" = "x"; then
+-- 
+1.9.0
+
diff --git a/0041-Fixed-declaration-of-GC_start_call_back.patch b/0041-Fixed-declaration-of-GC_start_call_back.patch
new file mode 100644
index 0000000..5948e42
--- /dev/null
+++ b/0041-Fixed-declaration-of-GC_start_call_back.patch
@@ -0,0 +1,37 @@
+From f0e31ded051c21af2763c61a1218a7cc6e6b5ccd Mon Sep 17 00:00:00 2001
+From: Juanjo Garcia-Ripoll <jjgarcia at users.sf.net>
+Date: Sun, 6 Oct 2013 22:39:11 +0200
+Subject: [PATCH 41/92] Fixed declaration of GC_start_call_back
+
+---
+ src/c/alloc_2.d | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/c/alloc_2.d b/src/c/alloc_2.d
+index 5bc3572..75e7080 100644
+--- a/src/c/alloc_2.d
++++ b/src/c/alloc_2.d
+@@ -36,9 +36,9 @@ static void (*GC_old_start_callback)(void) = NULL;
+ extern void GC_set_start_callback(void *);
+ extern void *GC_get_start_callback(void *);
+ #else
+-extern void *GC_start_call_back(void);
++extern void (*GC_start_call_back)(void);
+ #endif
+-static void gather_statistics();
++static void gather_statistics(void);
+ static void ecl_mark_env(struct cl_env_struct *env);
+ 
+ /* We need these prototypes because private/gc.h is not available
+@@ -1101,7 +1101,7 @@ init_alloc(void)
+ 	GC_set_start_callback(gather_statistics);
+ #else
+ 	GC_old_start_callback = GC_start_call_back;
+-	GC_start_call_back = (void (*)())gather_statistics;
++	GC_start_call_back = (void (*)(void))gather_statistics;
+ #endif
+ 	GC_java_finalization = 1;
+         GC_oom_fn = out_of_memory;
+-- 
+1.9.0
+
diff --git a/0066-fixes-for-the-detection-of-GC_start_call_back.patch b/0066-fixes-for-the-detection-of-GC_start_call_back.patch
new file mode 100644
index 0000000..10c838f
--- /dev/null
+++ b/0066-fixes-for-the-detection-of-GC_start_call_back.patch
@@ -0,0 +1,73 @@
+From 285eb31812bc7c2c48a8b1bbe14e01084ba92b05 Mon Sep 17 00:00:00 2001
+From: D Herring <dherring at at.tentpost.dot.com>
+Date: Fri, 20 Dec 2013 01:15:59 -0500
+Subject: [PATCH 66/92] fixes for the detection of GC_start_call_back
+
+- HAVE_GC_SET_START_CALLBACK was defined unconditionally
+- there was no AC_DEFINE if system_boehm was false
+- there was a typo in one usage site of this macro
+
+see 6b754564f1d1a2d320b1fd46f0c0da2e623862c1
+---
+ src/aclocal.m4    | 2 ++
+ src/c/alloc_2.d   | 2 +-
+ src/configure     | 3 +++
+ src/h/config.h.in | 2 +-
+ 4 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/src/aclocal.m4 b/src/aclocal.m4
+index 19c4115..d49321a 100644
+--- a/src/aclocal.m4
++++ b/src/aclocal.m4
+@@ -948,6 +948,8 @@ if test "${enable_boehm}" = auto -o "${enable_boehm}" = system; then
+  if test "${system_boehm}" = "yes"; then
+    AC_CHECK_LIB( [gc], [GC_set_start_callback],
+                  [AC_DEFINE(HAVE_GC_SET_START_CALLBACK)], [] )
++ else
++  AC_DEFINE(HAVE_GC_SET_START_CALLBACK)
+  fi
+  AC_MSG_CHECKING( [whether we can use the existing Boehm-Weiser library] )
+  AC_MSG_RESULT( [${system_boehm}] )
+diff --git a/src/c/alloc_2.d b/src/c/alloc_2.d
+index 75e7080..51366fd 100644
+--- a/src/c/alloc_2.d
++++ b/src/c/alloc_2.d
+@@ -32,7 +32,7 @@
+ #ifdef GBC_BOEHM
+ 
+ static void (*GC_old_start_callback)(void) = NULL;
+-#ifdef HAVE_GC_START_CALLBACK
++#ifdef HAVE_GC_SET_START_CALLBACK
+ extern void GC_set_start_callback(void *);
+ extern void *GC_get_start_callback(void *);
+ #else
+diff --git a/src/configure b/src/configure
+index 999231a..159f82f 100755
+--- a/src/configure
++++ b/src/configure
+@@ -5970,6 +5970,9 @@ if test "x$ac_cv_lib_gc_GC_set_start_callback" = xyes; then :
+ 
+ fi
+ 
++ else
++  $as_echo "#define HAVE_GC_SET_START_CALLBACK 1" >>confdefs.h
++
+  fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can use the existing Boehm-Weiser library " >&5
+ $as_echo_n "checking whether we can use the existing Boehm-Weiser library ... " >&6; }
+diff --git a/src/h/config.h.in b/src/h/config.h.in
+index f6b6b8d..169049e 100644
+--- a/src/h/config.h.in
++++ b/src/h/config.h.in
+@@ -309,7 +309,7 @@ typedef unsigned char ecl_base_char;
+ #endif
+ 
+ /* GC_set_start_callback						*/
+-#define HAVE_GC_SET_START_CALLBACK
++#undef HAVE_GC_SET_START_CALLBACK
+ 
+ /*
+  * SYSTEM FEATURES:
+-- 
+1.9.0
+
diff --git a/0069-Fix-declaration-that-was-activated-by-commit-285eb31.patch b/0069-Fix-declaration-that-was-activated-by-commit-285eb31.patch
new file mode 100644
index 0000000..231bd05
--- /dev/null
+++ b/0069-Fix-declaration-that-was-activated-by-commit-285eb31.patch
@@ -0,0 +1,26 @@
+From 3e9f5cafe1c2a1f8c3c259aec5b74948bcd85f56 Mon Sep 17 00:00:00 2001
+From: Philipp Marek <philipp at marek.priv.at>
+Date: Thu, 27 Feb 2014 20:47:53 +0100
+Subject: [PATCH 69/92] Fix declaration that was activated by commit 285eb318, 
+  "fixes for the detection of GC_start_call_back"
+
+---
+ src/c/alloc_2.d | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/c/alloc_2.d b/src/c/alloc_2.d
+index 51366fd..727539a 100644
+--- a/src/c/alloc_2.d
++++ b/src/c/alloc_2.d
+@@ -34,7 +34,7 @@
+ static void (*GC_old_start_callback)(void) = NULL;
+ #ifdef HAVE_GC_SET_START_CALLBACK
+ extern void GC_set_start_callback(void *);
+-extern void *GC_get_start_callback(void *);
++extern void *GC_get_start_callback();
+ #else
+ extern void (*GC_start_call_back)(void);
+ #endif
+-- 
+1.9.0
+
diff --git a/ecl.spec b/ecl.spec
index d6b6dbc..2cf9ede 100644
--- a/ecl.spec
+++ b/ecl.spec
@@ -36,6 +36,13 @@ Patch1:         %{name}-13.5.1-signal_handling_thread.patch
 Patch2:         %{name}-12.12.1-xsltproc.patch
 # GCC does not implement support for #pragma STDC FENV_ACCESS
 Patch3:         %{name}-13.5.1-fenv-access.patch
+# upstream GC_start_call_back fixes (0025, 0026 only included so later patches apply without modification)
+Patch5:         0024-GC_start_call_back-disappeared-in-recent-versions-of.patch
+Patch6:         0025-In-Cygwin-x86_64-deactivate-the-assembly-code-in-GMP.patch
+Patch7:         0026-Configuring-GMP-with-C-with-c-gmp-was-broken-due-to-.patch
+Patch8:         0041-Fixed-declaration-of-GC_start_call_back.patch
+Patch9:         0066-fixes-for-the-detection-of-GC_start_call_back.patch
+Patch10:        0069-Fix-declaration-that-was-activated-by-commit-285eb31.patch
 
 BuildRequires:  libX11-devel
 BuildRequires:  pkgconfig
@@ -76,6 +83,12 @@ Gray streams.
 %patch1
 %patch2
 %patch3
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+%patch8 -p1
+%patch9 -p1
+%patch10 -p1
 
 # Remove spurious executable bits
 chmod a-x src/CHANGELOG
@@ -159,7 +172,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor >&/dev/null ||:
 
 %changelog
 * Wed May 14 2014 Rex Dieter <rdieter at fedoraproject.org> 13.5.1-4
-- rebuild (gc/libatomic_ops)
+- backport GC_start_call_back fixes
 
 * Sat Aug 03 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 13.5.1-3
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild


More information about the scm-commits mailing list