GNU bug report logs - #18784
Coultdn't compile emacs-24.4

Previous Next

Package: emacs;

Reported by: Gangræna Gorgeous <trupanka <at> gmail.com>

Date: Tue, 21 Oct 2014 12:34:01 UTC

Severity: normal

Tags: fixed

Merged with 13847, 18780

Found in versions 24.4, 25.0.50

Fixed in version 25.1

Done: Ulrich Mueller <ulm <at> gentoo.org>

Bug is archived. No further changes may be made.

Full log


Message #43 received at 18784 <at> debbugs.gnu.org (full text, mbox):

From: Ulrich Mueller <ulm <at> gentoo.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 18784 <at> debbugs.gnu.org
Subject: Re: 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 <at> 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 <at> 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 <at> 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





This bug report was last modified 10 years and 91 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.