bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#18784: Coultdn't compile emacs-24.4


From: Ulrich Mueller
Subject: bug#18784: Coultdn't compile emacs-24.4
Date: Mon, 16 Mar 2015 17:26:32 +0100

>>>>> On Mon, 16 Mar 2015, Stefan Monnier wrote:

> Hmm... is `-nopie' a linker-option or a compiler-option?
> IOW what about systems which use gcc to compile but something else
> to link or vice-versa?

Right. Also it seems that not all configurations of gcc will recognise
the -nopie option, so we must laboriously test for it. Updated patch
below.


>From b3d5b10c10d7062b0da5c8316e787ae554f5c81a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ulrich=20M=C3=BCller?= <ulm@gentoo.org>
Date: Mon, 16 Mar 2015 17:09:54 +0100
Subject: [PATCH] configure.ac: Add -nopie to LD_SWITCH_SYSTEM_TEMACS.

* configure.ac (LD_SWITCH_SYSTEM_TEMACS): Add -nopie option if it
is supported, in order to avoid segfaults in temacs.  (Bug#18780)
---
 ChangeLog    |  5 +++++
 configure.ac | 15 +++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4f6523e..308b889 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-16  Ulrich Müller  <ulm@gentoo.org>
+
+       * configure.ac (LD_SWITCH_SYSTEM_TEMACS): Add -nopie option if it
+       is supported, in order to avoid segfaults in temacs.  (Bug#18780)
+
 2015-03-02  Robert Pluim  <rpluim@gmail.com>  (tiny change)
 
        * configure.ac: Error out if with-file-notification=w32 is
diff --git a/configure.ac b/configure.ac
index d65494a..40ea5cb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4989,11 +4989,22 @@ case "$opsys" in
    esac
    ;;
 
-  openbsd) LD_SWITCH_SYSTEM_TEMACS='-nopie' ;;
-
   *) LD_SWITCH_SYSTEM_TEMACS= ;;
 esac
 
+AC_CACHE_CHECK([whether the linker accepts -nopie],
+  [emacs_cv_prog_cc_nopie],
+  [emacs_save_LDFLAGS=$LDFLAGS
+  LDFLAGS="$LDFLAGS -nopie"
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
+    [emacs_cv_prog_cc_nopie=yes],
+    [emacs_cv_prog_cc_nopie=no])
+  LDFLAGS=$emacs_save_LDFLAGS])
+if test "$emacs_cv_prog_cc_nopie" = 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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]