[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patches] Use a compile-time test for -fstack-protector



Hello!

On 2009-11-11 01:17, Joseph S. Myers wrote:
> On Sun, 8 Nov 2009, Thomas Schwinge wrote:
>
>>  if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -Werror -fstack-protector
>> -			    -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
>> +			    -o /dev/null -c -x c /dev/null 1>&AS_MESSAGE_LOG_FD])
>
> Does this still work if you remove $LDFLAGS from the compilation line?  

Sorry, I simply forgot to remove them.  LDFLAGS are indeed not needed
here (and should usually be empty, anyway).


2009-11-11  Thomas Schwinge  <thomas@xxxxxxxxxxxxxxxx>

	* configure.in (libc_cv_ssp): Make this a compile-time check.  Avoid
	creating temporary files.

Index: configure.in
===================================================================
--- configure.in	(revision 9207)
+++ configure.in	(working copy)
@@ -1741,18 +1741,13 @@
 AC_SUBST(fno_unit_at_a_time)
 
 AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
-cat > conftest.c <<EOF
-int foo;
-main () { return 0;}
-EOF
-if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -Werror -fstack-protector
-			    -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Werror -fstack-protector
+			    -o /dev/null -c -x c /dev/null 1>&AS_MESSAGE_LOG_FD])
 then
   libc_cv_ssp=yes
 else
   libc_cv_ssp=no
-fi
-rm -f conftest*])
+fi])
 AC_SUBST(libc_cv_ssp)
 
 AC_CACHE_CHECK(for -fgnu89-inline, libc_cv_gnu89_inline, [dnl


Regards,
 Thomas

Attachment: pgpnyPiODKdt7.pgp
Description: PGP signature