configure: enable PIE and RELRO by default if compiler supports it.
(cherry picked from commit d79e3a641de934cd7546b2e628a8c6ea175b6c37)
This commit is contained in:
parent
6ece895957
commit
886807687e
2
NEWS
2
NEWS
@ -1,5 +1,7 @@
|
|||||||
xbps-0.17 (???):
|
xbps-0.17 (???):
|
||||||
|
|
||||||
|
* configure: if compiler supports PIE and RELRO, enable them by default.
|
||||||
|
|
||||||
* xbps-repo(8): the 'show-deps' target does not show the repository from
|
* xbps-repo(8): the 'show-deps' target does not show the repository from
|
||||||
the matching target package, just the list of dependencies.
|
the matching target package, just the list of dependencies.
|
||||||
|
|
||||||
|
29
configure
vendored
29
configure
vendored
@ -14,7 +14,6 @@ TARGET=
|
|||||||
DEBUG=
|
DEBUG=
|
||||||
BUILD_TESTS=
|
BUILD_TESTS=
|
||||||
BUILD_API_DOCS=
|
BUILD_API_DOCS=
|
||||||
BUILD_PIE=
|
|
||||||
BUILD_STATIC=
|
BUILD_STATIC=
|
||||||
SILENT=yes
|
SILENT=yes
|
||||||
HAVE_VISIBILITY=no
|
HAVE_VISIBILITY=no
|
||||||
@ -43,7 +42,6 @@ for instance \`--prefix=\$HOME'.
|
|||||||
--debug Build with debugging code and symbols
|
--debug Build with debugging code and symbols
|
||||||
--verbose Disable silent build to see compilation details
|
--verbose Disable silent build to see compilation details
|
||||||
--with-api-docs Install XBPS API Library documentation (default disabled)
|
--with-api-docs Install XBPS API Library documentation (default disabled)
|
||||||
--with-pie Build XBPS programs as PIE (default disabled)
|
|
||||||
--with-static Build XBPS static utils (default disabled)
|
--with-static Build XBPS static utils (default disabled)
|
||||||
--with-tests Build and install Kyua tests (default disabled)
|
--with-tests Build and install Kyua tests (default disabled)
|
||||||
Needs atf >= 0.15 (http://code.google.com/p/kyua)
|
Needs atf >= 0.15 (http://code.google.com/p/kyua)
|
||||||
@ -70,7 +68,6 @@ for x; do
|
|||||||
--datadir|--infodir) ;; # ignore autotools
|
--datadir|--infodir) ;; # ignore autotools
|
||||||
--with-api-docs) BUILD_API_DOCS=$var;;
|
--with-api-docs) BUILD_API_DOCS=$var;;
|
||||||
--verbose) unset SILENT;;
|
--verbose) unset SILENT;;
|
||||||
--with-pie) BUILD_PIE=$var;;
|
|
||||||
--pkgconfigdir) PKGCONFIGDIR=$var;;
|
--pkgconfigdir) PKGCONFIGDIR=$var;;
|
||||||
--with-tests) BUILD_TESTS=yes;;
|
--with-tests) BUILD_TESTS=yes;;
|
||||||
--with-static) BUILD_STATIC=yes;;
|
--with-static) BUILD_STATIC=yes;;
|
||||||
@ -159,7 +156,6 @@ ETCDIR="${ETCDIR}/xbps"
|
|||||||
echo "ETCDIR ?= $ETCDIR" >>$CONFIG_MK
|
echo "ETCDIR ?= $ETCDIR" >>$CONFIG_MK
|
||||||
|
|
||||||
[ -z "$DEBUG" ] && DEBUG=no
|
[ -z "$DEBUG" ] && DEBUG=no
|
||||||
[ -z "$BUILD_PIE" ] && BUILD_PIE_VALUE=no
|
|
||||||
|
|
||||||
if [ -z "$CC" ]; then
|
if [ -z "$CC" ]; then
|
||||||
printf "Looking for compiler ... "
|
printf "Looking for compiler ... "
|
||||||
@ -212,7 +208,6 @@ linux)
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
# Add CPPFLAGS/CFLAGS/LDFLAGS to CC for testing features
|
# Add CPPFLAGS/CFLAGS/LDFLAGS to CC for testing features
|
||||||
XCC="$CC `$SED -n -e 's/CPPLAGS+=*\(.*\)/\1/p' $CONFIG_MK`"
|
XCC="$CC `$SED -n -e 's/CPPLAGS+=*\(.*\)/\1/p' $CONFIG_MK`"
|
||||||
XCC="$XCC `$SED -n -e 's/CFLAGS+=*\(.*\)/\1/p' $CONFIG_MK`"
|
XCC="$XCC `$SED -n -e 's/CFLAGS+=*\(.*\)/\1/p' $CONFIG_MK`"
|
||||||
@ -295,20 +290,22 @@ if [ $? -ne 0 ]; then
|
|||||||
check_compiler_flag dynamic r LIBXBPS_LDFLAGS
|
check_compiler_flag dynamic r LIBXBPS_LDFLAGS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Check for -Wl,-z,relro,-z,now
|
||||||
|
check_compiler_flag "l,-z,relro,-z,now" W LDFLAGS
|
||||||
|
|
||||||
#
|
#
|
||||||
# Check if -fPIE and -pie are supported if --build-pie is set.
|
# Check if -fPIE and -pie are supported if --build-pie is set.
|
||||||
#
|
#
|
||||||
if [ -n "$BUILD_PIE" ]; then
|
check_compiler_flag PIE f PROG_CFLAGS
|
||||||
check_compiler_flag PIE f PROG_CFLAGS
|
if [ $? -eq 0 ]; then
|
||||||
if [ $? -eq 0 ]; then
|
check_compiler_flag pie "" PROG_LDFLAGS
|
||||||
check_compiler_flag pie "" PROG_LDFLAGS
|
fi
|
||||||
fi
|
if [ $? -eq 0 ]; then
|
||||||
if [ $? -eq 0 ]; then
|
echo "Building programs as PIE (Position Independent Executable)."
|
||||||
echo "Building programs as PIE (Position Independent Executable)."
|
BUILD_PIE_VALUE=yes
|
||||||
BUILD_PIE_VALUE=yes
|
else
|
||||||
else
|
BUILD_PIE_VALUE=no
|
||||||
BUILD_PIE_VALUE=no
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user