summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2007-05-17 18:20:16 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:22:12 -0500
commit04e62ae6350e30e6293be8e62cff169cd4509b2a (patch)
tree4fa46fe5d9cb3ff452f6233d3c112313f40198da
parent5d26d56e0f228eec9ba32a06510fb93054b393c5 (diff)
downloadsamba-04e62ae6350e30e6293be8e62cff169cd4509b2a.tar.gz
samba-04e62ae6350e30e6293be8e62cff169cd4509b2a.tar.bz2
samba-04e62ae6350e30e6293be8e62cff169cd4509b2a.zip
r22974: enable relro with PIE if available, this gives extra protection to the ELF segment
(This used to be commit 708a9cb08ea8ffd0aee8ed5d8d8d14193306ce9a)
-rw-r--r--source3/configure.in23
1 files changed, 23 insertions, 0 deletions
diff --git a/source3/configure.in b/source3/configure.in
index 2f763b0c02..592fc6a1f6 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -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"