pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/editors/emacs20 Add __asm __volatile("":::"memory") at...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/a9bb11f7db8b
branches:  trunk
changeset: 596192:a9bb11f7db8b
user:      dholland <dholland%pkgsrc.org@localhost>
date:      Thu Dec 01 05:07:22 2011 +0000

description:
Add __asm __volatile("":::"memory") at a critical point in alloc.c.

gcc thinks it knows the semantics of malloc and so it thinks it can
optimize out the manipulation of __malloc_hook; however, doing so causes
the subsequent malloc call to come back to itself, leading to an infinite
recursion and SIGSEGV in temacs.

This fixes the remaining part of PR 45669.

Someone(TM) should check if this issue affects other Emacs versions
and/or XEmacs.

diffstat:

 editors/emacs20/distinfo         |   4 ++--
 editors/emacs20/patches/patch-bm |  18 ++++++++++++++----
 2 files changed, 16 insertions(+), 6 deletions(-)

diffs (48 lines):

diff -r 42858c5a494c -r a9bb11f7db8b editors/emacs20/distinfo
--- a/editors/emacs20/distinfo  Thu Dec 01 04:51:30 2011 +0000
+++ b/editors/emacs20/distinfo  Thu Dec 01 05:07:22 2011 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.20 2011/12/01 04:51:30 dholland Exp $
+$NetBSD: distinfo,v 1.21 2011/12/01 05:07:22 dholland Exp $
 
 SHA1 (emacs-20.7-mule-4.1b-elc.tar.gz) = 3894fb2b81bb326545f6ccc3bf0a8405c23004ff
 RMD160 (emacs-20.7-mule-4.1b-elc.tar.gz) = c675b31dafaa4321a453af9d87eddf051ee71b1f
@@ -47,7 +47,7 @@
 SHA1 (patch-bj) = 6dba88723ee632b67fcf6a2dd2918e69034837e2
 SHA1 (patch-bk) = 7582e915a5bd9778259961e7fa842d5cdce3e85c
 SHA1 (patch-bl) = f2cd03713d7cdb6cb41119569031249d7d708b13
-SHA1 (patch-bm) = 792c692e23bfcbd154214152f90511e3e750b56d
+SHA1 (patch-bm) = b493e6d24bc3940da004322651ee24a25eda46e5
 SHA1 (patch-bn) = 247c04ae1accf3bc6b07b22767eb3cf2cdb55013
 SHA1 (patch-bo) = f9b8b73af91a445dbf50f9e862b84c7abc2b730e
 SHA1 (patch-bp) = 9091134cf50e17ce58976c3193666e716345a124
diff -r 42858c5a494c -r a9bb11f7db8b editors/emacs20/patches/patch-bm
--- a/editors/emacs20/patches/patch-bm  Thu Dec 01 04:51:30 2011 +0000
+++ b/editors/emacs20/patches/patch-bm  Thu Dec 01 05:07:22 2011 +0000
@@ -1,8 +1,8 @@
-$NetBSD: patch-bm,v 1.2 2011/12/01 04:51:30 dholland Exp $
+$NetBSD: patch-bm,v 1.3 2011/12/01 05:07:23 dholland Exp $
 
---- ./src/alloc.c.orig Thu Sep 16 00:20:15 1999
-+++ ./src/alloc.c      Tue Sep 26 11:54:24 2000
-@@ -53,12 +53,13 @@
+--- src/alloc.c.orig   1999-09-16 07:20:15.000000000 +0000
++++ src/alloc.c
+@@ -53,12 +53,13 @@ extern char *sbrk ();
  
  #if defined (__STDC__) && __STDC__
  #include <stddef.h>
@@ -17,3 +17,13 @@
  #endif /* !defined(DOUG_LEA_MALLOC) */
  
  #define max(A,B) ((A) > (B) ? (A) : (B))
+@@ -420,6 +421,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



Home | Main Index | Thread Index | Old Index