changeset 267:f8fe0f87b7c1

- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c: * braindead defaults (e.g. ASFLAGS on pretty much everything GNU, used in default suffix rules with *both* cc for .S and as for .s) * often took decisions on bogus private STACK headers in ELF files, set on platforms that lack any implementation, so pointless * tests have shown that only some GNU/* platforms and FreeBSD actually make use of this, if at all, that is... and for those, will switch back to .section .note.GNU-stack (next commit)
author Tassilo Philipp
date Sat, 27 May 2017 19:18:23 +0200
parents 91fd7be165f1
children 03f0b683918a
files configure
diffstat 1 files changed, 49 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Thu May 25 02:13:32 2017 +0200
+++ b/configure	Sat May 27 19:18:23 2017 +0200
@@ -200,52 +200,54 @@
 esac
 
 
-# Assure objects not asking for an execstack (or binary that links dyncall might end
-# up with one, for no reason).
-
-# .s.o/.S.o rules often use ${CC} which then invokes the tools needed. GCC and
-# others might (annoyingly) assume that an executable stack may be required for
-# those sources, if not told explicitly that it isn't.
-# Neither specifying this per source (e.g. via .section .note.GNU-stack,"",...), nor
-# per toolchain flags (e.g. as' --noexecstack) turned out to be portable across our
-# supported platforms, toolchains, and different versions of the latter (some even
-# producing the opposite result).
-# Find needed build flags by running a few tests; use default if none result in "rw-".
-
-RWXTESTPREFIX="rwxtest" # @@@ put this maybe all in Makefile.generic? out of source builds?
-for s in S s ; do (
-  cd "$BLDTOP"
-  # asm test file, with main and _main for portability.
-  (echo '.text';(echo '.globl main';echo 'main:') | sed 'p;s/m/_m/') > $RWXTESTPREFIX.$s
-
-  # Check var to be used, which depends on inference rules of this platform. E.g. ASFLAGS is only common on GNU, and
-  # on some other platforms only CFLAGS is the only one used, others use AFLAGS with cc and thus need -Wa,... Check
-  # makes use of the config written so far, so use '+=' to not overwrite vars.
-  for f in "" "ASFLAGS+=-Wa,--noexecstack" "ACFLAGS+=-Wa,--noexecstack" "AFLAGS+=--noexecstack" "AFLAGS+=-Wa,--noexecstack" "CFLAGS+=-Wa,--noexecstack"; do
-    # dummy makefile triggering inference rules, reflecting dyncall's build
-    make -f - <<MAKEFILE
-include $C
-$f
-# Force dependency via .o, to avoid .[sS].out rules that might be set - also set command as not all platforms set .o.out
-$RWXTESTPREFIX.out: $RWXTESTPREFIX.o
-	\${CC} \${CFLAGS} \${LDFLAGS} $RWXTESTPREFIX.o \${LDLIBS} -o $RWXTESTPREFIX.out
-MAKEFILE
-
-    # Check what stack of a built test binary would result in.
-# @@@ add xxd hexdump based versions for when objdump is not available; also check for those if we deal with ELF files
-# @@@ maybe also limit to ELF files
-    STACKFLAGS=`(which objdump && objdump -p $RWXTESTPREFIX.out) | sed -e '/STACK/bx' -e 'd' -e ':x' -e 'N' -e 's/^.*flags[ \t]\([^ \t]*\).*/\1/'`
-    rm $RWXTESTPREFIX.out $RWXTESTPREFIX.o
-    if [ "$STACKFLAGS" = "rw-" ]; then
-      printf "$f\n"
-      break
-    fi
-
-  done
-
-  rm $RWXTESTPREFIX.$s
-
-) done 2>&1 | grep '^[ASC]\+FLAGS.*noexecstack$' | uniq >>$C
+# removed, b/c platform support not consistent and ELF flags checked often not having any result
+#
+## Assure objects not asking for an execstack (or binary that links dyncall might end
+## up with one, for no reason).
+#
+## .s.o/.S.o rules often use ${CC} which then invokes the tools needed. GCC and
+## others might (annoyingly) assume that an executable stack may be required for
+## those sources, if not told explicitly that it isn't.
+## Neither specifying this per source (e.g. via .section .note.GNU-stack,"",...), nor
+## per toolchain flags (e.g. as' --noexecstack) turned out to be portable across our
+## supported platforms, toolchains, and different versions of the latter (some even
+## producing the opposite result).
+## Find needed build flags by running a few tests; use default if none result in "rw-".
+#
+#RWXTESTPREFIX="rwxtest" # @@@ put this maybe all in Makefile.generic? out of source builds?
+#for s in S s ; do (
+#  cd "$BLDTOP"
+#  # asm test file, with main and _main for portability.
+#  (echo '.text';(echo '.globl main';echo 'main:') | sed 'p;s/m/_m/') > $RWXTESTPREFIX.$s
+#
+#  # Check var to be used, which depends on inference rules of this platform. E.g. ASFLAGS is only common on GNU, and
+#  # on some other platforms only CFLAGS is the only one used, others use AFLAGS with cc and thus need -Wa,... Check
+#  # makes use of the config written so far, so use '+=' to not overwrite vars.
+#  for f in "" "ASFLAGS+=-Wa,--noexecstack" "ACFLAGS+=-Wa,--noexecstack" "AFLAGS+=--noexecstack" "AFLAGS+=-Wa,--noexecstack" "CFLAGS+=-Wa,--noexecstack"; do
+#    # dummy makefile triggering inference rules, reflecting dyncall's build
+#    make -f - <<MAKEFILE
+#include $C
+#$f
+## Force dependency via .o, to avoid .[sS].out rules that might be set - also set command as not all platforms set .o.out
+#$RWXTESTPREFIX.out: $RWXTESTPREFIX.o
+#	\${CC} \${CFLAGS} \${LDFLAGS} $RWXTESTPREFIX.o \${LDLIBS} -o $RWXTESTPREFIX.out
+#MAKEFILE
+#
+#    # Check what stack of a built test binary would result in.
+## @@@ add xxd hexdump based versions for when objdump is not available; also check for those if we deal with ELF files
+## @@@ maybe also limit to ELF files
+#    STACKFLAGS=`(which objdump && objdump -p $RWXTESTPREFIX.out) | sed -e '/STACK/bx' -e 'd' -e ':x' -e 'N' -e 's/^.*flags[ \t]\([^ \t]*\).*/\1/'`
+#    rm $RWXTESTPREFIX.out $RWXTESTPREFIX.o
+#    if [ "$STACKFLAGS" = "rw-" ]; then
+#      printf "$f\n"
+#      break
+#    fi
+#
+#  done
+#
+#  rm $RWXTESTPREFIX.$s
+#
+#) done 2>&1 | grep '^[ASC]\+FLAGS.*noexecstack$' | uniq >>$C
 
 
 
@@ -265,5 +267,5 @@
 EOF
 done
 
-echo "Configuration written do $C"
+echo "Configuration written to $C"