From 64bcceb29c213b709c595ef88684a630640c8602 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 8 Dec 2006 09:30:30 +0000 Subject: [PATCH] * configure.ac (for assembler): Set ASFLAGS_config to -Wa,--noexecstack if this seems advisable on this platform. Problem reported by Mike Frysinger in . * lib/Makefile.am (match.$(OBJEXT)): Use ASFLAGS_config. --- ChangeLog | 8 ++++++++ configure.ac | 18 ++++++++++++++++-- lib/Makefile.am | 2 +- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3b8017e..6b459df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-12-08 Paul Eggert + + * configure.ac (for assembler): Set ASFLAGS_config to + -Wa,--noexecstack if this seems advisable on this platform. + Problem reported by Mike Frysinger in + . + * lib/Makefile.am (match.$(OBJEXT)): Use ASFLAGS_config. + 2006-12-07 Paul Eggert * Makefile.am (install-exec-hook): Fix bug when installing diff --git a/configure.ac b/configure.ac index 9dcaa33..955c7e1 100644 --- a/configure.ac +++ b/configure.ac @@ -64,16 +64,30 @@ AC_CACHE_CHECK([for assembler], [gzip_cv_assembler], : elif eval "$CC -c match_.s >/dev/null 2>&1" && test -f match_.$OBJEXT; then + rm -f match_.$OBJEXT gzip_cv_assembler=yes + if echo 'void foo (void) {}' > conftest.c && + eval "$CC -S conftest.c >/dev/null 2>&1" && + grep '\.note\.GNU-stack' conftest.s >/dev/null 2>&1 && + eval "$CC -c -Wa,--noexecstack match_.s >/dev/null 2>&1" && + test -f match_.$OBJEXT; then + gzip_cv_assembler='yes, with -Wa,--noexecstack' + fi fi fi - rm -f _match.S match_.s match_.$OBJEXT;; + rm -f conftest* _match.S match_.s match_.$OBJEXT;; esac]) -if test $gzip_cv_assembler = yes; then +if test "$gzip_cv_assembler" != no; then AC_DEFINE(ASMV, , [Define if an assembler version of longest_match is available.]) AC_LIBOBJ(match) fi +if test "$gzip_cv_assembler" = 'yes, with -Wa,--noexecstack'; then + ASFLAGS_config='-Wa,--noexecstack' +else + ASFLAGS_config= +fi +AC_SUBST([ASFLAGS_config]) AC_ISC_POSIX AC_C_CONST diff --git a/lib/Makefile.am b/lib/Makefile.am index f97ca3b..9501737 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -28,7 +28,7 @@ LN_S = @LN_S@ match.$(OBJEXT): match.c cp $(srcdir)/match.c _match.S $(ASCPP) _match.S > match_.s - $(CC) -c $(CFLAGS) match_.s + $(CC) -c $(CFLAGS) $(ASFLAGS_config) match_.s mv match_.$(OBJEXT) $@ rm -f _match.S match_.s -- 2.47.2