# HG changeset patch # User Tassilo Philipp # Date 1495490906 -7200 # Node ID edbada931b3fa8a736248ae280c0e2aa2b07c416 # Parent b625f2e11911499992c7f02b9e433cb4e9cf7015 configure: - don't accidentally override set vars when checking for nonexecstack build flags - comment cleanup diff -r b625f2e11911 -r edbada931b3f configure --- a/configure Mon May 22 16:49:59 2017 +0200 +++ b/configure Tue May 23 00:08:26 2017 +0200 @@ -203,14 +203,14 @@ # Assure objects not asking for an execstack (or binary that links dyncall might end # up with one, for no reason). -# We run our .s and .S files through $CC. GCC and others might (annoyingly) assume that -# an executable stack may be required for those, if not told explicitly that it isn't. -# Trying to specify this per source via .section .note.GNU-stack,"",... turned out to -# be not consistently implemented across our supported platforms and toolchains, and -# thus not being portable (on some platforms even resulting in the opposite, the mere -# presence of this section, no matter the flags, creating an rwx stack). -# So, let's set the needed build flags by running a few tests, if we find any that -# work (as those also don't always have the intended effect). +# .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 ( @@ -218,10 +218,10 @@ # 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 used, ... - for f in "ASFLAGS=-Wa,--noexecstack" "ACFLAGS=-Wa,--noexecstack" "AFLAGS=--noexecstack" "CFLAGS+=-Wa,--noexecstack"; do - # Build a dummy makefile that triggers inference rules that dyncall's build also uses + # 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 used, ... Check makes use of the config written so far, so use '+='. + for f in "ASFLAGS+=-Wa,--noexecstack" "ACFLAGS+=-Wa,--noexecstack" "AFLAGS+=--noexecstack" "CFLAGS+=-Wa,--noexecstack"; do + # dummy makefile triggering inference rules, reflecting dyncall's build make -f - <