1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

r22974: enable relro with PIE if available, this gives extra protection to the ELF segment

(This used to be commit 708a9cb08e)
This commit is contained in:
Simo Sorce 2007-05-17 18:20:16 +00:00 committed by Gerald (Jerry) Carter
parent 5d26d56e0f
commit 04e62ae635

View 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"