2ef3a951f5
to fix one source of SIGSEGVs during build.
48 lines
1.2 KiB
Text
48 lines
1.2 KiB
Text
$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)
|