NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/35235



On Wednesday 04 January 2012 23:00:08 Sergey Svishchev wrote:
[...]

>  temacs segfaults in emacs_blocked_malloc (w/o cpuflags) or $$dyncall (with
> cpuflags) -- another case of 45405?

It would appear so. I applied dh's fix to emacs21 to emacs22 and it build (w/o 
cpuflags) on my b160l.

Nick
$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    2008-08-12 18:35:44.000000000 +0000
+++ src/alloc.c 2012-01-05 08:36:58.000000000 +0000
@@ -84,6 +84,8 @@
 #include "w32.h"
 #endif
 
+#include <stdlib.h>
+
 #ifdef DOUG_LEA_MALLOC
 
 #include <malloc.h>
@@ -1205,6 +1207,9 @@
 #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),
@@ -1236,6 +1241,9 @@
 
   BLOCK_INPUT_ALLOC;
   __malloc_hook = old_malloc_hook;
+#ifdef __GNUC__
+  __asm __volatile("":::"memory");
+#endif
 #ifdef DOUG_LEA_MALLOC
     mallopt (M_TOP_PAD, malloc_hysteresis * 4096);
 #else
@@ -1285,6 +1293,9 @@
 
   BLOCK_INPUT_ALLOC;
   __realloc_hook = old_realloc_hook;
+#ifdef __GNUC__
+  __asm __volatile("":::"memory");
+#endif
 
 #ifdef GC_MALLOC_CHECK
   if (ptr)


Home | Main Index | Thread Index | Old Index