Bug 567134: turn on -dynamicbase for optimized Windows NSS builds. r=khuey.
authorWan-Teh Chang <wtc@google.com>
Wed, 21 Jul 2010 17:13:16 -0700
changeset 48049 ab7618bb5c484834d4f36b29700e61c93afdc541
parent 48048 3ccadf6033017152b6f59592fc95fcb9064b7eee
child 48050 cb331799ada73f79fb9124d68b12e203550dac49
push idunknown
push userunknown
push dateunknown
reviewerskhuey
bugs567134
milestone2.0b3pre
Bug 567134: turn on -dynamicbase for optimized Windows NSS builds. r=khuey.
security/coreconf/WIN32.mk
security/patches/README
security/patches/msvc-aslr.patch
--- a/security/coreconf/WIN32.mk
+++ b/security/coreconf/WIN32.mk
@@ -126,17 +126,17 @@ else # !NS_USE_GCC
     ifdef BUILD_OPT
 	OS_CFLAGS  += -MD
 	ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE))
 		OPTIMIZER += -O1
 	else
 		OPTIMIZER += -O2
 	endif
 	DEFINES    += -UDEBUG -U_DEBUG -DNDEBUG
-	DLLFLAGS   += -OUT:"$@"
+	DLLFLAGS   += -DYNAMICBASE -OUT:"$@"
 	ifdef MOZ_DEBUG_SYMBOLS
 		OPTIMIZER += -Zi -Fd$(OBJDIR)/
 		DLLFLAGS += -DEBUG -OPT:REF
 		LDFLAGS += -DEBUG -OPT:REF
 	endif
     else
 	#
 	# Define USE_DEBUG_RTL if you want to use the debug runtime library
--- a/security/patches/README
+++ b/security/patches/README
@@ -1,2 +1,6 @@
 This directory contains patches that were added locally
 on top of the NSS release.
+
+File: msvc-aslr.patch
+https://bugzilla.mozilla.org/show_bug.cgi?id=567134
+Use the -DYNAMICBASE linker option to enable ASLR on Windows.
new file mode 100644
--- /dev/null
+++ b/security/patches/msvc-aslr.patch
@@ -0,0 +1,22 @@
+diff --git a/security/coreconf/WIN32.mk b/security/coreconf/WIN32.mk
+--- a/security/coreconf/WIN32.mk
++++ b/security/coreconf/WIN32.mk
+@@ -126,17 +126,17 @@ else # !NS_USE_GCC
+     ifdef BUILD_OPT
+ 	OS_CFLAGS  += -MD
+ 	ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE))
+ 		OPTIMIZER += -O1
+ 	else
+ 		OPTIMIZER += -O2
+ 	endif
+ 	DEFINES    += -UDEBUG -U_DEBUG -DNDEBUG
+-	DLLFLAGS   += -OUT:"$@"
++	DLLFLAGS   += -DYNAMICBASE -OUT:"$@"
+ 	ifdef MOZ_DEBUG_SYMBOLS
+ 		OPTIMIZER += -Zi -Fd$(OBJDIR)/
+ 		DLLFLAGS += -DEBUG -OPT:REF
+ 		LDFLAGS += -DEBUG -OPT:REF
+ 	endif
+     else
+ 	#
+ 	# Define USE_DEBUG_RTL if you want to use the debug runtime library