summaryrefslogtreecommitdiff
path: root/editors/emacs21/patches
diff options
context:
space:
mode:
authordholland <dholland>2011-12-31 11:40:27 +0000
committerdholland <dholland>2011-12-31 11:40:27 +0000
commit4ba18390f7933c1ca44a032a2268b549da167641 (patch)
tree1c761237eefa0c9c6e2d45d78b6af93c3b8cf106 /editors/emacs21/patches
parent097798b3332dbf796ffcea13677c2ebb8da22d55 (diff)
downloadpkgsrc-4ba18390f7933c1ca44a032a2268b549da167641.tar.gz
Merge patch-bm from emacs20 (prevent gcc from optimizing out __malloc_hook)
to fix one source of SIGSEGVs during build.
Diffstat (limited to 'editors/emacs21/patches')
-rw-r--r--editors/emacs21/patches/patch-src_alloc_c48
1 files changed, 48 insertions, 0 deletions
diff --git a/editors/emacs21/patches/patch-src_alloc_c b/editors/emacs21/patches/patch-src_alloc_c
new file mode 100644
index 00000000000..3ad1ffe3eae
--- /dev/null
+++ b/editors/emacs21/patches/patch-src_alloc_c
@@ -0,0 +1,48 @@
+$NetBSD: patch-src_alloc_c,v 1.1 2011/12/31 11:40:27 dholland Exp $
+
+- use standard headers
+- add an empty asm() destroying memory that prevents gcc from
+ optimizing out __malloc_hook and friends (which leads to
+ SIGSEGV in temacs during build)
+
+--- src/alloc.c.orig 2003-01-17 13:45:13.000000000 +0000
++++ src/alloc.c
+@@ -57,6 +57,8 @@ Boston, MA 02111-1307, USA. */
+ extern POINTER_TYPE *sbrk ();
+ #endif
+
++#include <stdlib.h>
++
+ #ifdef DOUG_LEA_MALLOC
+
+ #include <malloc.h>
+@@ -685,6 +687,9 @@ emacs_blocked_free (ptr)
+ #endif /* GC_MALLOC_CHECK */
+
+ __free_hook = old_free_hook;
++#ifdef __GNUC__
++ __asm __volatile("":::"memory");
++#endif
+ free (ptr);
+
+ /* If we released our reserve (due to running out of memory),
+@@ -728,6 +733,9 @@ emacs_blocked_malloc (size)
+
+ BLOCK_INPUT;
+ __malloc_hook = old_malloc_hook;
++#ifdef __GNUC__
++ __asm __volatile("":::"memory");
++#endif
+ #ifdef DOUG_LEA_MALLOC
+ mallopt (M_TOP_PAD, malloc_hysteresis * 4096);
+ #else
+@@ -776,6 +784,9 @@ emacs_blocked_realloc (ptr, size)
+
+ BLOCK_INPUT;
+ __realloc_hook = old_realloc_hook;
++#ifdef __GNUC__
++ __asm __volatile("":::"memory");
++#endif
+
+ #ifdef GC_MALLOC_CHECK
+ if (ptr)