Subject: Re: bug#18784: Coultdn't compile emacs-24.4

From: Ulrich Mueller <[email-masked]>
Date: Mon, 16 Mar 2015 10:16:37 +0100

>>>>> On Fri, 13 Mar 2015, Stefan Monnier wrote:

> Indeed, looks right. And 18780's diagnostic looks right as well.
> Could someone look at fixing our configure script accordingly?

Find my attempt of a patch below. Please review.

>From 30678f8b5cba82b4ca9841fd1c8760b48cf12b59 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ulrich=20M=C3=BCller?= <[email-masked]>
Date: Mon, 16 Mar 2015 10:02:51 +0100
Subject: [PATCH] configure.ac: Add -nopie to LD_SWITCH_SYSTEM_TEMACS.

* configure.ac (LD_SWITCH_SYSTEM_TEMACS): Add -nopie option,
in order to avoid segfaults in temacs.  (Bug#18780)
---
 ChangeLog    | 5 +++++
 configure.ac | 7 +++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4f6523e..fd99ff9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-16  Ulrich Müller  <[email-masked]>
+
+	* configure.ac (LD_SWITCH_SYSTEM_TEMACS): Add -nopie option,
+	in order to avoid segfaults in temacs.  (Bug#18780)
+
 2015-03-02  Robert Pluim  <[email-masked]>  (tiny change)
 
 	* configure.ac: Error out if with-file-notification=w32 is
diff --git a/configure.ac b/configure.ac
index d65494a..0c0c5b6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4989,11 +4989,14 @@ case "$opsys" in
    esac
    ;;
 
-  openbsd) LD_SWITCH_SYSTEM_TEMACS='-nopie' ;;
-
   *) LD_SWITCH_SYSTEM_TEMACS= ;;
 esac
 
+if test "$GCC" = yes; then
+  # Disable PIE to avoid segfaults in temacs (bug#18780)
+  LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS -nopie"
+fi
+
 if test x$ac_enable_profiling != x ; then
   case $opsys in
     *freebsd | gnu-linux) ;;
-- 
2.3.2