emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master b8b960e: Minor CANNOT_DUMP cleanups


From: Paul Eggert
Subject: [Emacs-diffs] master b8b960e: Minor CANNOT_DUMP cleanups
Date: Fri, 15 Jun 2018 18:52:00 -0400 (EDT)

branch: master
commit b8b960e5e1520874b0a59575d31368f96b7f8b47
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Minor CANNOT_DUMP cleanups
    
    Mostly, this avoids munging executables when CANNOT_DUMP = yes,
    as the munging is needed only for unexec.
    * configure.ac (PAXCTL_dumped, PAXCTL_notdumped) [CANNOT_DUMP]:
    Leave these empty.
    (LD_SWITCH_SYSTEM_TEMACS) [CANNOT_DUMP]:
    Do not append -no-pie or -nopie.
    * src/alloc.c (my_heap_start) [CANNOT_DUMP]: Omit; not used.
---
 configure.ac | 116 +++++++++++++++++++++++++++++++----------------------------
 src/alloc.c  |   2 +-
 2 files changed, 63 insertions(+), 55 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4fcb846..e33b1f1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1226,50 +1226,52 @@ AC_SUBST([FIND_DELETE])
 
 PAXCTL_dumped=
 PAXCTL_notdumped=
-if test $opsys = gnu-linux; then
-  if test "${SETFATTR+set}" != set; then
-    AC_CACHE_CHECK([for setfattr],
-      [emacs_cv_prog_setfattr],
-      [touch conftest.tmp
-       if (setfattr -n user.pax.flags conftest.tmp) >/dev/null 2>&1; then
-        emacs_cv_prog_setfattr=yes
-       else
-        emacs_cv_prog_setfattr=no
-       fi])
-    if test "$emacs_cv_prog_setfattr" = yes; then
-      PAXCTL_notdumped='$(SETFATTR) -n user.pax.flags -v er'
-      SETFATTR=setfattr
-    else
-      SETFATTR=
+if test "$CANNOT_DUMP" != yes; then
+  if test $opsys = gnu-linux; then
+    if test "${SETFATTR+set}" != set; then
+      AC_CACHE_CHECK([for setfattr],
+       [emacs_cv_prog_setfattr],
+       [touch conftest.tmp
+        if (setfattr -n user.pax.flags conftest.tmp) >/dev/null 2>&1; then
+          emacs_cv_prog_setfattr=yes
+        else
+          emacs_cv_prog_setfattr=no
+        fi])
+      if test "$emacs_cv_prog_setfattr" = yes; then
+       PAXCTL_notdumped='$(SETFATTR) -n user.pax.flags -v er'
+       SETFATTR=setfattr
+      else
+       SETFATTR=
+      fi
+      rm -f conftest.tmp
+      AC_SUBST([SETFATTR])
     fi
-    rm -f conftest.tmp
-    AC_SUBST([SETFATTR])
   fi
-fi
-case $opsys,$PAXCTL_notdumped,$emacs_uname_r in
-  gnu-linux,,* | netbsd,,[0-7].*)
-    AC_PATH_PROG([PAXCTL], [paxctl], [],
-      [$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/usr/sbin])
-    if test -n "$PAXCTL"; then
-      if test "$opsys" = netbsd; then
-       PAXCTL_dumped='$(PAXCTL) +a'
-       PAXCTL_notdumped=$PAXCTL_dumped
-      else
-       AC_MSG_CHECKING([whether binaries have a PT_PAX_FLAGS header])
-       AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
-         [if $PAXCTL -v conftest$EXEEXT >/dev/null 2>&1; then
-            AC_MSG_RESULT([yes])
-          else
-            AC_MSG_RESULT([no])
-            PAXCTL=
-          fi])
-       if test -n "$PAXCTL"; then
-         PAXCTL_dumped='$(PAXCTL) -zex'
-         PAXCTL_notdumped='$(PAXCTL) -r'
+  case $opsys,$PAXCTL_notdumped,$emacs_uname_r in
+    gnu-linux,,* | netbsd,,[0-7].*)
+      AC_PATH_PROG([PAXCTL], [paxctl], [],
+       [$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/usr/sbin])
+      if test -n "$PAXCTL"; then
+       if test "$opsys" = netbsd; then
+         PAXCTL_dumped='$(PAXCTL) +a'
+         PAXCTL_notdumped=$PAXCTL_dumped
+       else
+         AC_MSG_CHECKING([whether binaries have a PT_PAX_FLAGS header])
+         AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
+           [if $PAXCTL -v conftest$EXEEXT >/dev/null 2>&1; then
+              AC_MSG_RESULT([yes])
+            else
+              AC_MSG_RESULT([no])
+              PAXCTL=
+            fi])
+         if test -n "$PAXCTL"; then
+           PAXCTL_dumped='$(PAXCTL) -zex'
+           PAXCTL_notdumped='$(PAXCTL) -r'
+         fi
        fi
-      fi
-    fi;;
-esac
+      fi;;
+  esac
+fi
 AC_SUBST([PAXCTL_dumped])
 AC_SUBST([PAXCTL_notdumped])
 
@@ -5287,19 +5289,25 @@ esac
 AC_CACHE_CHECK(
   [for $CC option to disable position independent executables],
   [emacs_cv_prog_cc_no_pie],
-  [emacs_save_c_werror_flag=$ac_c_werror_flag
-   emacs_save_LDFLAGS=$LDFLAGS
-   ac_c_werror_flag=yes
-   for emacs_cv_prog_cc_no_pie in -no-pie -nopie no; do
-     test $emacs_cv_prog_cc_no_pie = no && break
-     LDFLAGS="$emacs_save_LDFLAGS $emacs_cv_prog_cc_no_pie"
-     AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [break])
-   done
-   ac_c_werror_flag=$emacs_save_c_werror_flag
-   LDFLAGS=$emacs_save_LDFLAGS])
-if test "$emacs_cv_prog_cc_no_pie" != no; then
-  LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS $emacs_cv_prog_cc_no_pie"
-fi
+  [if test "$CANNOT_DUMP" = yes; then
+     emacs_cv_prog_cc_no_pie='not needed'
+   else
+     emacs_save_c_werror_flag=$ac_c_werror_flag
+     emacs_save_LDFLAGS=$LDFLAGS
+     ac_c_werror_flag=yes
+     for emacs_cv_prog_cc_no_pie in -no-pie -nopie no; do
+       test $emacs_cv_prog_cc_no_pie = no && break
+       LDFLAGS="$emacs_save_LDFLAGS $emacs_cv_prog_cc_no_pie"
+       AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [break])
+     done
+     ac_c_werror_flag=$emacs_save_c_werror_flag
+     LDFLAGS=$emacs_save_LDFLAGS
+   fi])
+case $emacs_cv_prog_cc_no_pie in
+  -*)
+    LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS $emacs_cv_prog_cc_no_pie"
+    ;;
+esac
 
 if test x$ac_enable_profiling != x ; then
   case $opsys in
diff --git a/src/alloc.c b/src/alloc.c
index 7b21405..2863586 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -104,7 +104,7 @@ static bool valgrind_p;
 #include "w32heap.h"   /* for sbrk */
 #endif
 
-#ifdef GNU_LINUX
+#if defined GNU_LINUX && !defined CANNOT_DUMP
 /* The address where the heap starts.  */
 void *
 my_heap_start (void)



reply via email to

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