2015-11-17 17:13:12 +01:00
|
|
|
# Enable SSP and FORITFY_SOURCE=2 by default.
|
2015-11-17 17:24:54 +01:00
|
|
|
CFLAGS=" -fstack-protector-strong -D_FORTIFY_SOURCE=2 $CFLAGS"
|
|
|
|
CXXFLAGS="-fstack-protector-strong -D_FORTIFY_SOURCE=2 $CXXFLAGS"
|
2015-11-17 17:13:12 +01:00
|
|
|
# Enable as-needed and relro by default.
|
2015-11-17 17:24:54 +01:00
|
|
|
LDFLAGS="-Wl,--as-needed -Wl,-z,relro $LDFLAGS"
|
2015-11-17 17:13:12 +01:00
|
|
|
|
2015-11-27 12:02:13 +01:00
|
|
|
if [ -z "$nopie" ] && [ "$XBPS_TARGET_ARCH" != mipsel-musl ]; then
|
2015-11-17 17:13:12 +01:00
|
|
|
_GCCSPECSDIR=${XBPS_COMMONDIR}/environment/configure/gccspecs
|
2015-11-17 17:24:54 +01:00
|
|
|
CFLAGS="-specs=${_GCCSPECSDIR}/hardened-cc1 $CFLAGS"
|
|
|
|
CXXFLAGS="-specs=${_GCCSPECSDIR}/hardened-cc1 $CXXFLAGS"
|
2015-11-17 17:13:12 +01:00
|
|
|
# We pass -z relro -z now here too, because libtool drops -specs...
|
2015-11-17 17:24:54 +01:00
|
|
|
LDFLAGS="-specs=${_GCCSPECSDIR}/hardened-ld -Wl,-z,relro -Wl,-z,now $LDFLAGS"
|
2015-11-17 17:13:12 +01:00
|
|
|
fi
|