r22974: enable relro with PIE if available, this gives extra protection to the ELF...
authorSimo Sorce <idra@samba.org>
Thu, 17 May 2007 18:20:16 +0000 (18:20 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:22:12 +0000 (12:22 -0500)
(This used to be commit 708a9cb08ea8ffd0aee8ed5d8d8d14193306ce9a)

source3/configure.in

index 2f763b0c02d435f9c0e097b1bd8513e6af16cd55..592fc6a1f6d2027b344e1e99a5024a0c57c9efd9 100644 (file)
@@ -1763,6 +1763,29 @@ EOF
        fi
 fi
 
+#Check if we can enable relro as well
+if test x"${samba_cv_fpie}" = x"yes"
+then
+       AC_CACHE_CHECK(for relro, samba_cv_fpie_relro,
+       [
+               cat > conftest.c <<EOF
+int foo;
+main () { return 0;}
+EOF
+                if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -pie -fPIE -Wl,z,relro -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
+               then
+                       samba_cv_fpie_relro=yes
+               else
+                       samba_cv_fpie_relro=no
+               fi
+               rm -f conftest*
+       ])
+       if test x"${samba_cv_fpie_relro}" = x"yes"
+       then
+               PIE_LDFLAGS="-pie -Wl,z,relro"
+       fi
+fi
+
 # Assume non-shared by default and override below
 BLDSHARED="false"