Mercurial > pub > dyncall > dyncall
changeset 262:edbada931b3f
configure:
- don't accidentally override set vars when checking for nonexecstack build flags
- comment cleanup
author | Tassilo Philipp |
---|---|
date | Tue, 23 May 2017 00:08:26 +0200 |
parents | b625f2e11911 |
children | a8c9e3654062 |
files | configure |
diffstat | 1 files changed, 13 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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 - <<MAKEFILE include $C $f @@ -232,6 +232,7 @@ # 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