From 97cb4383a34dbf29a2decbc14f826a9ee1e573cd Mon Sep 17 00:00:00 2001 From: "wtc%google.com" Date: Wed, 18 Aug 2010 01:16:12 +0000 Subject: [PATCH] Bug 567134: use the -DYNAMICBASE linker option for Visual C++ 8 (2005) SP1 or later. Adapted from the code in NSPR's configure.in. r=Christophe. git-svn-id: svn://10.0.0.236/trunk@261058 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/security/coreconf/WIN32.mk | 34 ++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/mozilla/security/coreconf/WIN32.mk b/mozilla/security/coreconf/WIN32.mk index fee3f7a2a37..6f880169840 100644 --- a/mozilla/security/coreconf/WIN32.mk +++ b/mozilla/security/coreconf/WIN32.mk @@ -63,9 +63,36 @@ else RC = rc.exe MT = mt.exe # Determine compiler version + CC_VERSION := $(shell $(CC) 2>&1 | sed -ne \ + 's|.* \([0-9]\+\.[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?\).*|\1|p') + # Change the dots to spaces. + _CC_VERSION_WORDS := $(subst ., ,$(CC_VERSION)) + _CC_VMAJOR := $(word 1,$(_CC_VERSION_WORDS)) + _CC_VMINOR := $(word 2,$(_CC_VERSION_WORDS)) + _CC_RELEASE := $(word 3,$(_CC_VERSION_WORDS)) + _CC_BUILD := $(word 4,$(_CC_VERSION_WORDS)) + _MSC_VER = $(_CC_VMAJOR)$(_CC_VMINOR) _MSC_VER_6 = 1200 - _MSC_VER := $(shell $(CC) 2>&1 | sed -ne \ - 's/.*[^0-9.]\([0-9]\{1,\}\)\.\([0-9]\{1,\}\).*/\1\2/p' ) + ifeq ($(_CC_VMAJOR),14) + # -DYNAMICBASE is only supported on VC8SP1 or newer, + # so be very specific here! + # VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762 + ifeq ($(_CC_RELEASE).$(_CC_BUILD),50727.42) + USE_DYNAMICBASE = + else + ifeq ($(_CC_RELEASE).$(_CC_BUILD),50727.762) + USE_DYNAMICBASE = 1 + else + _LOSER := $(error Unknown compiler version $(CC_VERSION)) + endif + endif + endif + # if $(_CC_VMAJOR) >= 15 + # NOTE: 'sort' sorts the words in lexical order, so this test works + # only if $(_CC_VMAJOR) is two digits. + ifeq ($(firstword $(sort $(_CC_VMAJOR) 15)),15) + USE_DYNAMICBASE = 1 + endif endif ifdef BUILD_TREE @@ -123,6 +150,9 @@ else # !NS_USE_GCC OS_DLLFLAGS += -PDB:NONE endif endif + ifdef USE_DYNAMICBASE + OS_DLLFLAGS += -DYNAMICBASE + endif ifdef BUILD_OPT OS_CFLAGS += -MD ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE))