* configure.ac (for assembler): Set ASFLAGS_config to
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 8 Dec 2006 09:30:30 +0000 (09:30 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 8 Dec 2006 09:30:30 +0000 (09:30 +0000)
-Wa,--noexecstack if this seems advisable on this platform.
Problem reported by Mike Frysinger in
<http://lists.gnu.org/archive/html/bug-gzip/2006-12/msg00018.html>.
* lib/Makefile.am (match.$(OBJEXT)): Use ASFLAGS_config.

ChangeLog
configure.ac
lib/Makefile.am

index 3b8017e5d303ee745f204c3555eec7b718460ca6..6b459df661339e32135e3a39777f33640e929c51 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-12-08  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * configure.ac (for assembler): Set ASFLAGS_config to
+       -Wa,--noexecstack if this seems advisable on this platform.
+       Problem reported by Mike Frysinger in
+       <http://lists.gnu.org/archive/html/bug-gzip/2006-12/msg00018.html>.
+       * lib/Makefile.am (match.$(OBJEXT)): Use ASFLAGS_config.
+
 2006-12-07  Paul Eggert  <eggert@cs.ucla.edu>
 
        * Makefile.am (install-exec-hook): Fix bug when installing
index 9dcaa33dd11d48fce0cffce1e5baad63cbc71b86..955c7e1e79663abb437998c0cca83de0853f302b 100644 (file)
@@ -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
index f97ca3b8c86edbf8ce828d0b296e4994e159e9cc..95017370c100289ad847a56d5bb5d7426cf8e292 100644 (file)
@@ -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