Subject: 24.4; configure script should disable PIE on all platforms

From: Adam Sampson <[email-masked]>
Date: Mon, 20 Oct 2014 23:41:37 +0100

Dear Emacs maintainers,

In the configure script for Emacs 24.4, position-independent executable
support is currently explicitly disabled for temacs on Darwin and
OpenBSD by adding options (-fno-pie, -nopie) to LD_SWITCH_SYSTEM_TEMACS.

However, it's possible to have GCC configured to use PIE by default on
other platforms -- for example, Debian, Ubuntu and Gentoo provide
"hardened" GCC configurations. If you try to build Emacs with a
PIE-ified GCC, temacs will segfault; you need to explicitly pass the
no-pie options to configure.

I ran into this on my GARstow system, but here's an example of a Gentoo
user being tripped up by the same thing:
  https://bugs.gentoo.org/494316

Would it be possible for the configure script to add the -fno-pie/-nopie
options by default to LD_SWITCH_SYSTEM_TEMACS, if they're accepted by
the toolchain? That way you could build Emacs with a PIE-ified GCC
without special treatment, and you wouldn't need the special cases for
Darwin and OpenBSD.

Thanks,
Adam

In GNU Emacs 24.4.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.25)
 of 2014-10-20 on gar-amd64
Windowing system distributor `The X.Org Foundation', version 11.0.11600000
Configured using:
 `configure --prefix=/gar --sysconfdir=/etc --localstatedir=/var
 --sharedstatedir=/var/com --with-x-toolkit=gtk2 --without-gconf
 --with-gameuser=_garstow_no_such_user CFLAGS= CPPFLAGS= LDFLAGS='

Important settings:
  value of $LC_COLLATE: C
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  shell-dirtrack-mode: t
  display-time-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  global-visual-line-mode: t
  visual-line-mode: t
  transient-mark-mode: t

Recent input:
C-x 1 M-x r e p o r t - e m <tab> <return>

Recent messages:
Loading tex-mode...done
Loading sendmail...done
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
/home/ats/.Emacs/snake hides /gar/share/emacs/24.4/lisp/play/snake
/gar/share/emacs/site-lisp/timeclock hides /gar/share/emacs/24.4/lisp/calendar/timeclock

Features:
(shadow sort gnus-util mail-extr emacsbug message idna format-spec
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader org-install warnings server sendmail
rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils
cus-edit easymenu wid-edit cl-loaddefs cl-lib tex-mode compile shell
pcomplete comint ansi-color ring cus-start cus-load time time-date
tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list
newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp
files text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind gfilenotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 103533 26209)
 (symbols 48 20482 1)
 (miscs 40 35 126)
 (strings 32 17390 21949)
 (string-bytes 1 497465)
 (vectors 16 11430)
 (vector-slots 8 404627 21346)
 (floats 8 74 57)
 (intervals 56 185 50)
 (buffers 960 13)
 (heap 1024 14884 3581))

-- 
Adam Sampson <[email-masked]>                         <http://offog.org/>