summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--devel/electric-fence/Makefile3
-rw-r--r--devel/electric-fence/distinfo3
-rw-r--r--devel/electric-fence/patches/patch-efence_c46
3 files changed, 50 insertions, 2 deletions
diff --git a/devel/electric-fence/Makefile b/devel/electric-fence/Makefile
index 440642ac632..34aec81230b 100644
--- a/devel/electric-fence/Makefile
+++ b/devel/electric-fence/Makefile
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.3 2010/11/13 21:08:56 shattered Exp $
+# $NetBSD: Makefile,v 1.4 2012/06/16 07:46:55 dholland Exp $
DISTNAME= electric-fence_2.1.13-0.1
PKGNAME= electric-fence-2.1.13.0.1
+PKGREVISION= 1
CATEGORIES= devel
MASTER_SITES= http://perens.com/works/software/ElectricFence/
diff --git a/devel/electric-fence/distinfo b/devel/electric-fence/distinfo
index ea952a1a9fe..ae55aab0e5b 100644
--- a/devel/electric-fence/distinfo
+++ b/devel/electric-fence/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.1.1.1 2010/02/14 00:06:16 reed Exp $
+$NetBSD: distinfo,v 1.2 2012/06/16 07:46:55 dholland Exp $
SHA1 (electric-fence_2.1.13-0.1.tar.gz) = e6765bcb1543272040b806eea706fc7ae9b60524
RMD160 (electric-fence_2.1.13-0.1.tar.gz) = 75e41de7bef263007f24a1053528959f9f7fe1fa
@@ -6,3 +6,4 @@ Size (electric-fence_2.1.13-0.1.tar.gz) = 29991 bytes
SHA1 (patch-aa) = 9b2f1720a92c805d8d4b36631317493124c2f2d7
SHA1 (patch-ab) = 64c503ce8d2ea9b55432d59a187e644af38e257b
SHA1 (patch-ac) = 4c56eeea0b8e53cdf260b61aa8fdef16f601b186
+SHA1 (patch-efence_c) = 2d97cf8a643b2b1c63c0a039267f4cf63b1a854a
diff --git a/devel/electric-fence/patches/patch-efence_c b/devel/electric-fence/patches/patch-efence_c
new file mode 100644
index 00000000000..8f98e772f3e
--- /dev/null
+++ b/devel/electric-fence/patches/patch-efence_c
@@ -0,0 +1,46 @@
+$NetBSD: patch-efence_c,v 1.1 2012/06/16 07:46:55 dholland Exp $
+
+Add memory barriers for gcc around recursive calls to malloc and free
+with "internalUse" set to 1. gcc fervently believes that malloc and
+free do not interact with anything else, and so it freely reorders code
+around calls to malloc. This causes internalUse to not be set to 1
+during the recursive call, which results in an infinite recursion.
+
+Compare patch-bm in editors/emacs20.
+
+--- efence.c~ 2002-02-19 22:10:46.000000000 +0000
++++ efence.c
+@@ -377,7 +377,16 @@ allocateMoreSlots(void)
+ noAllocationListProtection = 1;
+ internalUse = 1;
+
++#ifdef __GNUC__
++ __asm __volatile("":::"memory");
++#endif
++
+ newAllocation = malloc(newSize);
++
++#ifdef __GNUC__
++ __asm __volatile("":::"memory");
++#endif
++
+ memcpy(newAllocation, allocationList, allocationListSize);
+ memset(&(((char *)newAllocation)[allocationListSize]), 0, bytesPerPage);
+
+@@ -386,8 +395,16 @@ allocateMoreSlots(void)
+ slotCount += slotsPerPage;
+ unUsedSlots += slotsPerPage;
+
++#ifdef __GNUC__
++ __asm __volatile("":::"memory");
++#endif
++
+ free(oldAllocation);
+
++#ifdef __GNUC__
++ __asm __volatile("":::"memory");
++#endif
++
+ /*
+ * Keep access to the allocation list open at this point, because
+ * I am returning to memalign(), which needs that access.