APPROVE COMMIT
NOTE: This patch has been committed.
The heart of every traditionalist is heavy, Catholics eat fish on Friday, the
Anglicans have female priests, and this patch removes the need for a one-line
commit to configure.ac every time there’s a new macOS release. Some of the old
ones:
https://bitbucket.org/xemacs/xemacs/commits/e9f58d024c3ce7ea82f7061ac3ac3...
https://bitbucket.org/xemacs/xemacs/commits/bc51e191aaea4eb05a348806436eb...
https://bitbucket.org/xemacs/xemacs/commits/a58070ee1f31f90bdeb9dea88a9f4...
https://bitbucket.org/xemacs/xemacs/commits/acf69029482524b7228b90e932dff...
https://bitbucket.org/xemacs/xemacs/commits/423c4a0027f1a40c22422b76bdfe3...
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1510787139 0
# Wed Nov 15 23:05:39 2017 +0000
# Node ID 1f4ff44e16576d064e9f7955ae59ce86428fd635
# Parent 1a2f697b59a7e7443133636304f4dd62c5303120
Be more general in checking for ASLR, Linux, Darwin.
ChangeLog addition:
2017-11-15 Aidan Kehoe <kehoea(a)parhasard.net>
* configure: Regenerate.
* configure.ac:
Take a more general approach to checking for ASLR; check for the
technique itself initially, don't just examine the operating
system or the compile-time #defines. Then to work around it try a
list of techniques, using the first one that compiles.
This may bring an end to the XEmacs tradition of a single-line
configure.ac commit every time a new Mac OS version is released.
src/ChangeLog addition:
2017-11-15 Aidan Kehoe <kehoea(a)parhasard.net>
* Makefile.in.in ($(RAW_EXE)):
Place $start_flags after $ldflags in this make target, for that
minority of cases where the user has specified LDFLAGS and,
e.g. -no-pie in $start_flags is necessary to build.
diff -r 1a2f697b59a7 -r 1f4ff44e1657 ChangeLog
--- a/ChangeLog Wed Nov 15 00:44:17 2017 +0000
+++ b/ChangeLog Wed Nov 15 23:05:39 2017 +0000
@@ -1,3 +1,15 @@
+2017-11-15 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * configure: Regenerate.
+ * configure.ac:
+ Take a more general approach to checking for ASLR; check for the
+ technique itself initially, don't just examine the operating
+ system or the compile-time #defines. Then to work around it try a
+ list of techniques, using the first one that compiles.
+
+ This may bring an end to the XEmacs tradition of a single-line
+ configure.ac commit every time a new Mac OS version is released.
+
2017-11-14 Aidan Kehoe <kehoea(a)parhasard.net>
* configure: Regenerate.
diff -r 1a2f697b59a7 -r 1f4ff44e1657 configure
--- a/configure Wed Nov 15 00:44:17 2017 +0000
+++ b/configure Wed Nov 15 23:05:39 2017 +0000
@@ -824,7 +824,6 @@
docdir
oldincludedir
includedir
-runstatedir
localstatedir
sharedstatedir
sysconfdir
@@ -1111,7 +1110,6 @@
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1364,15 +1362,6 @@
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
- -runstatedir | --runstatedir | --runstatedi | --runstated \
- | --runstate | --runstat | --runsta | --runst | --runs \
- | --run | --ru | --r)
- ac_prev=runstatedir ;;
- -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
- | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
- | --run=* | --ru=* | --r=*)
- runstatedir=$ac_optarg ;;
-
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1510,7 +1499,7 @@
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir runstatedir
+ libdir localedir mandir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@@ -1663,7 +1652,6 @@
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
- --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -11826,7 +11814,7 @@
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31)
<< 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -11872,7 +11860,7 @@
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31)
<< 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -11896,7 +11884,7 @@
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31)
<< 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -11941,7 +11929,7 @@
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31)
<< 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -11965,7 +11953,7 @@
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31)
<< 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -12261,14 +12249,7 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ASLR needs to be
disabled" >&5
$as_echo_n "checking whether ASLR needs to be disabled... " >&6; }
-case `uname -s`:`uname -r` in
- Darwin:1[123456].*)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- start_flags="$start_flags -Wl,-no_pie" && if test
"$verbose" = "yes"; then echo " Appending
\"-Wl,-no_pie\" to \$start_flags"; fi
- ;;
- *)
- if test "$cross_compiling" = yes; then :
+if test "$cross_compiling" = yes; then :
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':"
>&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
@@ -12276,43 +12257,43 @@
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-int main () {
-#if defined __GNUC__ && defined __pie__
- return __pie__;
-#else
- return 0;
-#endif
-}
+#include <stdio.h>
+static int test_func(void) { return 42; }
+int main (int c, char **v) { if (--c) { printf ("%p", &test_func); } return
0; }
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-else
- __pie__="$?";
-case "$__pie__" in
- 2)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, disabling -fPIE"
>&5
-$as_echo "yes, disabling -fPIE" >&6; }
- start_flags="$start_flags -no-pie" && if test "$verbose"
= "yes"; then echo " Appending \"-no-pie\" to
\$start_flags"; fi
- ;;
- 1)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, disabling -fpie"
>&5
-$as_echo "yes, disabling -fpie" >&6; }
- start_flags="$start_flags -no-pie" && if test "$verbose" =
"yes"; then echo " Appending \"-no-pie\" to
\$start_flags"; fi
- ;;
- *)
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized __pie__ define
$__pie__, attempting to disable ASLR with -no-pie" >&5
-$as_echo "$as_me: WARNING: unrecognized __pie__ define $__pie__, attempting to
disable ASLR with -no-pie" >&2;}
- start_flags="$start_flags -no-pie" && if test "$verbose" =
"yes"; then echo " Appending \"-no-pie\" to
\$start_flags"; fi
- ;;
-esac
+ test_func_address=`./conftest t`
+if test "$test_func_address" = `./conftest t` \
+ -a "$test_func_address" = `./conftest t` \
+ -a "$test_func_address" = `./conftest t` \
+ -a "$test_func_address" = `./conftest t`; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no"
>&5
+$as_echo "no" >&6; }
+ else
+ for try_no_pie in "-no-pie" "-Wl,-no_pie" "-nopie"; do
+ xe_check_libs="${try_no_pie}"
+ if ac_fn_c_try_link "$LINENO"; then :
+ no_pie="${try_no_pie}"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ xe_check_libs=""
+ if test -n "$no_pie"; then
+ start_flags="$start_flags $no_pie" && if
test "$verbose" = "yes"; then echo " Appending
\"$no_pie\" to \$start_flags"; fi
+ break;
+ fi
+ done
+ if test -z "$no_pie"; then
+ as_fn_error $? "don't know how to disable ASLR on $ac_cv_build"
"$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, disabling address space
layout randomization, xemacs binary" >&5
+$as_echo "yes, disabling address space layout randomization, xemacs binary"
>&6; }
+ fi
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
- ;;
-esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for specified window system"
>&5
diff -r 1a2f697b59a7 -r 1f4ff44e1657 configure.ac
--- a/configure.ac Wed Nov 15 00:44:17 2017 +0000
+++ b/configure.ac Wed Nov 15 23:05:39 2017 +0000
@@ -2839,45 +2839,43 @@
fi
fi
-dnl Disable ASLR on systems where it breaks pdump. Use $start_flags for this
-dnl rather than $LDFLAGS, so it's only done for the XEmacs binary, and
+dnl Disable ASLR on systems where it breaks pdump. Use start_flags for this
+dnl rather than LDFLAGS, so it's only done for the XEmacs binary, and
dnl gnuclient, movemail and so on get ASLR if the system defaults to it.
-AC_MSG_CHECKING([whether ASLR needs to be disabled])
-case `uname -s`:`uname -r` in
- dnl Mac OS X 10.7 Lion, 10.8 Mountain Lion, 10.9 Mavericks,
- dnl 10.10 Yosemite, 10.11 El Capitan, 10.12 Sierra
- Darwin:1[[123456]].*)
- AC_MSG_RESULT(yes)
- XE_APPEND([-Wl,-no_pie], start_flags)
- ;;
- *)
- AC_RUN_IFELSE([AC_LANG_SOURCE([int main () {
-#if defined __GNUC__ && defined __pie__
- return __pie__;
-#else
- return 0;
-#endif
-}])], [AC_MSG_RESULT(no)],
-[__pie__="$?";
-case "$__pie__" in
- 2)
- AC_MSG_RESULT([yes, disabling -fPIE])
- dnl We need to do this after the XE_PROTECT_LINKER_FLAGS() call,
- dnl above. On Debian 9.2 Stretch the linker does not recognise
- dnl -no-pie, it needs to be handled by the GCC invocation.
- XE_APPEND([-no-pie], start_flags)
- ;;
- 1)
- AC_MSG_RESULT([yes, disabling -fpie])
- XE_APPEND([-no-pie], start_flags)
- ;;
- *)
- AC_MSG_WARN([unrecognized __pie__ define $__pie__, attempting to disable ASLR with
-no-pie])
- XE_APPEND([-no-pie], start_flags)
- ;;
-esac])
- ;;
-esac
+AC_MSG_CHECKING([whether ASLR needs to be disabled])
+AC_RUN_IFELSE([AC_LANG_SOURCE([#include <stdio.h>
+static int test_func(void) { return 42; }
+int main (int c, char **v) { if (--c) { printf ("%p", &test_func); } return
0; }])],
+[test_func_address=`./conftest t`
+if test "$test_func_address" = `./conftest t` \
+ -a "$test_func_address" = `./conftest t` \
+ -a "$test_func_address" = `./conftest t` \
+ -a "$test_func_address" = `./conftest t`; then
+ dnl If your implementation of ASLR gives the same address for the same
+ dnl function five times in a row within the lifetime of the universe,
+ dnl your implementation of ASLR needs significant revision.
+ dnl (Yes, yes, if someone sat down and ran ./configure a huge number of
+ dnl times on XEmacs code with the intention of making this give the wrong
+ dnl answer, they might manage it, but there is no payoff for doing this.)
+ AC_MSG_RESULT(no)
+ else
+ for try_no_pie in "-no-pie" "-Wl,-no_pie" "-nopie"; do
+ xe_check_libs="${try_no_pie}"
+ AC_LINK_IFELSE([], no_pie="${try_no_pie}")
+ xe_check_libs=""
+ if test -n "$no_pie"; then
+ dnl Don't be tempted to apply XE_PROTECT_LINKER_FLAGS() to this.
+ dnl On Debian 9.2 Stretch the linker does not recognise -no-pie, it
+ dnl needs to be handled by the GCC invocation.
+ XE_APPEND($no_pie, start_flags)
+ break;
+ fi
+ done
+ if test -z "$no_pie"; then
+ AC_MSG_ERROR([don't know how to disable ASLR on $ac_cv_build])
+ fi
+ AC_MSG_RESULT([yes, disabling address space layout randomization, xemacs binary])
+ fi])
dnl ----------------------
dnl Choose a window system
diff -r 1a2f697b59a7 -r 1f4ff44e1657 src/ChangeLog
--- a/src/ChangeLog Wed Nov 15 00:44:17 2017 +0000
+++ b/src/ChangeLog Wed Nov 15 23:05:39 2017 +0000
@@ -1,3 +1,10 @@
+2017-11-15 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * Makefile.in.in ($(RAW_EXE)):
+ Place $start_flags after $ldflags in this make target, for that
+ minority of cases where the user has specified LDFLAGS and,
+ e.g. -no-pie in $start_flags is necessary to build.
+
2017-11-15 Aidan Kehoe <kehoea(a)parhasard.net>
* specifier.c (print_specifier):
diff -r 1a2f697b59a7 -r 1f4ff44e1657 src/Makefile.in.in
--- a/src/Makefile.in.in Wed Nov 15 00:44:17 2017 +0000
+++ b/src/Makefile.in.in Wed Nov 15 23:05:39 2017 +0000
@@ -544,7 +544,7 @@
#if !defined(PDUMP) || !defined(DUMP_IN_EXEC) || defined(WIN32_NATIVE)
$(RAW_EXE): $(link_deps) $(DUMP_ID)
- $(LD) $(start_flags) $(ldflags) -o $@ $(start_files) $(objs) $(otherobjs) $(DUMP_ID)
$(LIBES)
+ $(LD) $(ldflags) $(start_flags) -o $@ $(start_files) $(objs) $(otherobjs) $(DUMP_ID)
$(LIBES)
#else
$(RAW_EXE): $(link_deps) $(DUMP_ID)
if test -f dump-size ; then \
@@ -552,7 +552,7 @@
else \
$(CC) -c $(cflags) -DMAX_SIZE=0 $(SRC)/dump-data.c ;\
fi
- $(LD) $(start_flags) $(ldflags) -o $@ $(start_files) $(objs) $(otherobjs) $(DUMP_ID)
dump-data.o $(LIBES)
+ $(LD) $(ldflags) $(start_flags) -o $@ $(start_files) $(objs) $(otherobjs) $(DUMP_ID)
dump-data.o $(LIBES)
#endif
## (3) Update the .elc's needed for dumping
--
‘As I sat looking up at the Guinness ad, I could never figure out /
How your man stayed up on the surfboard after forty pints of stout’
(C. Moore)