* configure.in: Check for -fstack-protector gcc option.
authorUlrich Drepper <drepper@redhat.com>
Tue, 19 Jul 2005 15:35:50 +0000 (15:35 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 19 Jul 2005 15:35:50 +0000 (15:35 +0000)
* config.make.in (have-ssp): Add template.
* nscd/Makefile (nscd-cflags): Add -fstack-protector if supported.

* nscd/nscd.c (main): Don't ignore result of chdir call.

ChangeLog
config.make.in
configure.in
nscd/Makefile

index a3edf5d..72659d6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-07-19  Ulrich Drepper  <drepper@redhat.com>
+
+       * configure.in: Check for -fstack-protector gcc option.
+       * config.make.in (have-ssp): Add template.
+       * nscd/Makefile (nscd-cflags): Add -fstack-protector if supported.
+
+       * nscd/nscd.c (main): Don't ignore result of chdir call.
+
 2005-07-18  Roland McGrath  <roland@redhat.com>
 
        [BZ #869]
index 1ab4bfb..3687507 100644 (file)
@@ -58,6 +58,7 @@ have-cpp-asm-debuginfo = @libc_cv_cpp_asm_debuginfo@
 enable-check-abi = @enable_check_abi@
 have-forced-unwind = @libc_cv_forced_unwind@
 have-fpie = @libc_cv_fpie@
+have-ssp = @libc_cv_ssp@
 have-selinux = @have_selinux@
 have-libaudit = @have_libaudit@
 have-cc-with-libunwind = @libc_cv_cc_with_libunwind@
index 4396891..21756e0 100644 (file)
@@ -1508,6 +1508,21 @@ if test $libc_cv_fno_unit_at_a_time = yes; then
 fi
 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 -fstack-protector
+                           -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
+then
+  libc_cv_ssp=yes
+else
+  libc_cv_ssp=no
+fi
+rm -f conftest*])
+AC_SUBST(libc_cv_ssp)
+
 if test $elf != yes; then
   AC_CACHE_CHECK(for .init and .fini sections, libc_cv_have_initfini,
                 [AC_TRY_COMPILE(, [asm (".section .init");
index 4b6f296..5a2d29a 100644 (file)
@@ -88,6 +88,9 @@ nscd-cflags = -DIS_IN_nscd=1 -D_FORTIFY_SOURCE=2
 ifeq (yesyes,$(have-fpie)$(build-shared))
 nscd-cflags += -fpie
 endif
+ifeq (yes,$(have-ssp))
+nscd-cflags += -fstack-protector
+endif
 
 CFLAGS-nscd.c += $(nscd-cflags)
 CFLAGS-connections.c += $(nscd-cflags)