bug 405523 - add dynamicbase flag (build with ASLR when available). r=bsmedberg

This commit is contained in:
ted.mielczarek@gmail.com 2008-03-05 07:10:26 -08:00
Родитель 9024f71dfe
Коммит f8f1c67b51
1 изменённых файлов: 21 добавлений и 7 удалений

Просмотреть файл

@ -431,16 +431,18 @@ case "$target" in
AC_LANG_RESTORE
changequote(,)
_MSVC_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
_MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
changequote([,])
# Determine compiler version
CC_VERSION=`"${CC}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
_CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
_CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
_CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
_CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
_MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
CXX_VERSION=`"${CXX}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
_CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
@ -453,11 +455,20 @@ case "$target" in
elif test "$_CC_MAJOR_VERSION" = "14"; then
_CC_SUITE=8
CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
dnl so be very specific here!
dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
if test $_CC_RELEASE -gt 50727; then
_USE_DYNAMICBASE=1
elif test $_CC_BUILD -ge 762; then
_USE_DYNAMICBASE=1
fi
AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
elif test "$_CC_MAJOR_VERSION" = "15"; then
_CC_SUITE=9
CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
_USE_DYNAMICBASE=1
AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
else
@ -494,7 +505,7 @@ case "$target" in
fi
# Check linker version
_LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
_LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
_LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
@ -502,7 +513,7 @@ case "$target" in
INCREMENTAL_LINKER=1
# Check midl version
_MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
_MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
_MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
_MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
_MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
@ -1908,12 +1919,15 @@ case "$target" in
MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
if test $_MSC_VER -ge 1400; then
LDFLAGS="$LDFLAGS -NXCOMPAT -SAFESEH"
# For profile-guided optimization
dnl For profile-guided optimization
PROFILE_GEN_CFLAGS="-GL"
PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
PROFILE_USE_CFLAGS="-GL"
#XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul
dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul
PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
if test -n "$_USE_DYNAMICBASE"; then
LDFLAGS="$LDFLAGS -DYNAMICBASE"
fi
fi
fi
MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg$(MOZ_BITS)$(VERSION_NUMBER),$(DEPTH)/jpeg)'