From a539ff32358ad60d5db411a357179c50540a11a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Tue, 21 Feb 2012 10:37:09 +0100 Subject: [PATCH] add upstream fix for emacs bug 10780, revert the workaround --- emacs-bug10780.patch | 74 ++++++++++++++++++++++++++++++++++++++++++++ emacs.spec | 12 ++++--- 2 files changed, 81 insertions(+), 5 deletions(-) create mode 100644 emacs-bug10780.patch diff --git a/emacs-bug10780.patch b/emacs-bug10780.patch new file mode 100644 index 0000000..db80e10 --- /dev/null +++ b/emacs-bug10780.patch @@ -0,0 +1,74 @@ +commit a40c73351c7aa2b990274122539a36fd3506cf79 +Author: Paul Eggert +Date: Mon Feb 20 15:09:58 2012 -0800 + + Fix crash due to non-contiguous EMACS_INT (Bug#10780). + + * lisp.h (VALBITS): Move definition up, so that USE_LSB_TAG can use it. + (USE_LSB_TAG): Do not define if UINTPTR_MAX >> VALBITS == 0. + It's useless in that case, and it can cause problems on hosts + that allocate halves of EMACS_INT values separately. + Reported by Dan Horák. Diagnosed by Andreas Schwab in + . + * mem-limits.h (EXCEEDS_LISP_PTR): Define to 0 on hosts where + UINTPTR_MAX >> VALBITS == 0. This is required by the above change; + it avoids undefined behavior on hosts where shifting right by more + than the word width has undefined behavior. + +diff --git a/src/lisp.h b/src/lisp.h +index 366d24a..8bfd707 100644 +--- a/src/lisp.h ++++ b/src/lisp.h +@@ -168,6 +168,10 @@ extern int suppress_checking EXTERNALLY_VISIBLE; + #define GCTYPEBITS 3 + #endif + ++#ifndef VALBITS ++#define VALBITS (BITS_PER_EMACS_INT - GCTYPEBITS) ++#endif ++ + #ifndef NO_DECL_ALIGN + # ifndef DECL_ALIGN + # if HAVE_ATTRIBUTE_ALIGNED +@@ -191,7 +195,15 @@ extern int suppress_checking EXTERNALLY_VISIBLE; + || defined DARWIN_OS || defined __sun) + /* We also need to be able to specify mult-of-8 alignment on static vars. */ + # if defined DECL_ALIGN +-# define USE_LSB_TAG ++/* mark_maybe_object assumes that EMACS_INT values are contiguous, ++ but this is not true on some hosts where EMACS_INT is wider than a pointer, ++ as they may allocate the halves of an EMACS_INT separately. ++ On these hosts USE_LSB_TAG is not needed because the top bits of an ++ EMACS_INT are unused, so define USE_LSB_TAG only on hosts where it ++ might be useful. */ ++# if UINTPTR_MAX >> VALBITS != 0 ++# define USE_LSB_TAG ++# endif + # endif + #endif + +@@ -309,11 +321,6 @@ enum Lisp_Fwd_Type + Lisp_Fwd_Kboard_Obj, /* Fwd to a Lisp_Object field of kboards. */ + }; + +-/* These values are overridden by the m- file on some machines. */ +-#ifndef VALBITS +-#define VALBITS (BITS_PER_EMACS_INT - GCTYPEBITS) +-#endif +- + #ifdef USE_LISP_UNION_TYPE + + #ifndef WORDS_BIGENDIAN +diff --git a/src/mem-limits.h b/src/mem-limits.h +index 472e591..244592a 100644 +--- a/src/mem-limits.h ++++ b/src/mem-limits.h +@@ -34,7 +34,7 @@ extern int etext; + #endif + + extern char *start_of_data (void); +-#if defined USE_LSB_TAG ++#if defined USE_LSB_TAG || UINTPTR_MAX >> VALBITS == 0 + #define EXCEEDS_LISP_PTR(ptr) 0 + #elif defined DATA_SEG_BITS + #define EXCEEDS_LISP_PTR(ptr) \ diff --git a/emacs.spec b/emacs.spec index 1b7b0b2..9654ce3 100644 --- a/emacs.spec +++ b/emacs.spec @@ -3,7 +3,7 @@ Summary: GNU Emacs text editor Name: emacs Epoch: 1 Version: 24.0.93 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/emacs/ Group: Applications/Editors @@ -29,6 +29,8 @@ Patch2: rpm-spec-mode-utc.patch Patch3: rpm-spec-mode-changelog.patch # rhbz#713600 Patch7: emacs-spellchecker.patch +# emacs#10780 +Patch8: emacs-bug10780.patch BuildRequires: atk-devel, cairo-devel, freetype-devel, fontconfig-devel, dbus-devel, giflib-devel, glibc-devel, gtk2-devel, libpng-devel BuildRequires: libjpeg-devel, libtiff-devel, libX11-devel, libXau-devel, libXdmcp-devel, libXrender-devel, libXt-devel @@ -150,6 +152,7 @@ packages that add functionality to Emacs. %patch0 -p1 -b .glibc-open-macro %patch7 -p1 -b .spellchecker +%patch8 -p1 -b .bug10780 # Install site-lisp files cp %SOURCE7 %SOURCE10 site-lisp @@ -203,11 +206,7 @@ ln -s ../configure . %configure --with-dbus --with-gif --with-jpeg --with-png --with-rsvg \ --with-tiff --with-xft --with-xpm --with-x-toolkit=gtk --with-gpm=no \ -%ifnarch ppc s390 --with-wide-int -%else - %{nil} -%endif make bootstrap %{setarch} make %{?_smp_mflags} cd .. @@ -434,6 +433,9 @@ update-desktop-database &> /dev/null || : %dir %{_datadir}/emacs/site-lisp/site-start.d %changelog +* Tue Feb 21 2012 Dan Horák - 1:24.0.93-4 +- add upstream fix for emacs bug 10780, revert the workaround + * Mon Feb 13 2012 Dan Horák - 1:24.0.93-3 - workaround build failure on ppc and s390 (http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10780)