[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [patch/rfc] handle GNU stack markings
From: |
Paul Eggert |
Subject: |
Re: [patch/rfc] handle GNU stack markings |
Date: |
Fri, 08 Dec 2006 01:35:23 -0800 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
Mike Frysinger <address@hidden> writes:
> some people see if the toolchain supports -Wa,--noexecstack while
That's what glibc does, and that seems reasonable to me.
Thanks for mentioning this issue; it seems a good way to catch bugs of
a troublesome class. I installed the following patch.
2006-12-08 Paul Eggert <address@hidden>
* 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.
Index: configure.ac
===================================================================
RCS file: /cvsroot/gzip/gzip/configure.ac,v
retrieving revision 1.7
diff -p -u -r1.7 configure.ac
--- configure.ac 8 Dec 2006 00:20:33 -0000 1.7
+++ configure.ac 8 Dec 2006 09:29:01 -0000
@@ -64,16 +64,30 @@ AC_CACHE_CHECK([for assembler], [gzip_cv
:
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: lib/Makefile.am
===================================================================
RCS file: /cvsroot/gzip/gzip/lib/Makefile.am,v
retrieving revision 1.2
diff -p -u -r1.2 Makefile.am
--- lib/Makefile.am 7 Dec 2006 07:23:35 -0000 1.2
+++ lib/Makefile.am 8 Dec 2006 09:29:01 -0000
@@ -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