From 5d934b44b56fbf99c1c15bb72415d9fe81efc981 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 18 Dec 2019 21:23:16 -0800 Subject: configure: disable building as PIE. On some GNU/Linux distributions, the compiler is configured for PIE (position-independent executables). This is horrible garbage which causes our "make tests" to run more than 22% slower (e.g. 8.22 seconds versus 6.69) which is unacceptable. Worse, this was implicated in a crash in TXR's exception handling logic. The committed workaround for that problem stays in place for users who want to build TXR in the PIE style anyway. * configure: detect which, if any, of the known gcc and clang options are available for disabling PIE and add those to opt_flags (which turns into OPT_FLAGS in config.make). --- configure | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/configure b/configure index 36e57b1e..c24b10ac 100755 --- a/configure +++ b/configure @@ -883,6 +883,31 @@ fi rm -f conftest$exe +printf "Checking how to disable PIE ..." + +nopie_flags= + +for flag in -nopie -no-pie ; do + if conftest EXTRA_FLAGS=$flag ; then + nopie_flags=" $flag" + break + fi +done + +for flag in -fnopie -fno-pie ; do + if conftest EXTRA_FLAGS=$flag ; then + nopie_flags="$nopie_flags $flag" + break + fi +done + +if [ -n "$nopie_flags" ]; then + printf "%s\n" "$nopie_flags" + opt_flags="$opt_flags$nopie_flags" +else + printf " n/a\n" +fi + # # Check for annoying clashes from non-conforming BSD-derived systems that don't # honor Unix/POSIX feature selection macros! -- cgit v1.2.3