Fix for bug 227049 . Add Windows 64 bits ( AMD64 ) support for NSS libraries. r=nelson, relyea
authorjulien.pierre.boogz%sun.com
Wed, 14 Nov 2007 22:49:44 +0000
changeset 8228 1a9550c7f5a3d4cd015db6ad63b13b97d611d8d1
parent 8225 f2aed397966bf3043910ff94c2cc9f827ae5835c
child 8231 c0ca29575a4242fbe090af1686b0ca446e0f6825
push idunknown
push userunknown
push dateunknown
reviewersnelson, relyea
bugs227049
Fix for bug 227049 . Add Windows 64 bits ( AMD64 ) support for NSS libraries. r=nelson, relyea
security/coreconf/WIN32.mk
security/coreconf/WIN954.0.mk
security/coreconf/WINNT5.2.mk
security/coreconf/WINNT6.0.mk
security/coreconf/arch.mk
security/nss/lib/freebl/Makefile
security/nss/lib/freebl/win_rand.c
--- a/security/coreconf/WIN32.mk
+++ b/security/coreconf/WIN32.mk
@@ -162,17 +162,22 @@ else # !NS_USE_GCC
 ifndef MOZ_DEBUG_SYMBOLS
 	LDFLAGS    += -PDB:NONE 
 endif
 	# Purify requires /FIXED:NO when linking EXEs.
 	LDFLAGS    += /FIXED:NO
     endif
 endif # NS_USE_GCC
 
+ifdef USE_64
+DEFINES += -DWIN64
+else
 DEFINES += -DWIN32
+endif
+
 ifdef MAPFILE
 ifndef NS_USE_GCC
 DLLFLAGS += -DEF:$(MAPFILE)
 endif
 endif
 # Change PROCESS to put the mapfile in the correct format for this platform
 PROCESS_MAP_FILE = cp $< $@
 
--- a/security/coreconf/WIN954.0.mk
+++ b/security/coreconf/WIN954.0.mk
@@ -42,17 +42,21 @@
 # OS_CFLAGS and OS_DLLFLAGS.
 
 include $(CORE_DEPTH)/coreconf/WIN32.mk
 
 ifeq ($(CPU_ARCH), x386)
 ifndef NS_USE_GCC
 	OS_CFLAGS += -W3 -nologo
 endif
+ifdef USE_64
+	DEFINES += -D_AMD64_
+else
 	DEFINES += -D_X86_
+endif
 else 
 	ifeq ($(CPU_ARCH), MIPS)
 		#OS_CFLAGS += -W3 -nologo
 		#DEFINES += -D_MIPS_
 		OS_CFLAGS  += -W3 -nologo
 	else 
 		ifeq ($(CPU_ARCH), ALPHA)
 			OS_CFLAGS += -W3 -nologo
--- a/security/coreconf/WINNT5.2.mk
+++ b/security/coreconf/WINNT5.2.mk
@@ -40,17 +40,21 @@
 #
 # This makefile defines the following variables:
 # OS_CFLAGS and OS_DLLFLAGS.
 
 include $(CORE_DEPTH)/coreconf/WIN32.mk
 
 ifeq ($(CPU_ARCH), x386)
 	OS_CFLAGS += -W3 -nologo
+ifdef USE_64
+	DEFINES += -D_AMD64_
+else
 	DEFINES += -D_X86_
+endif
 else 
 	ifeq ($(CPU_ARCH), MIPS)
 		#OS_CFLAGS += -W3 -nologo
 		#DEFINES += -D_MIPS_
 		OS_CFLAGS += -W3 -nologo
 	else 
 		ifeq ($(CPU_ARCH), ALPHA)
 			OS_CFLAGS += -W3 -nologo
--- a/security/coreconf/WINNT6.0.mk
+++ b/security/coreconf/WINNT6.0.mk
@@ -1,8 +1,86 @@
+#
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is the Netscape security libraries.
+#
+# The Initial Developer of the Original Code is
+# Netscape Communications Corporation.
+# Portions created by the Initial Developer are Copyright (C) 1994-2000
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#    Robert Longson <longsonr@gmail.com>
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+#
+# Config stuff for WINNT 6.0 (Windows Vista)
+#
+# This makefile defines the following variables:
+# OS_CFLAGS and OS_DLLFLAGS.
+
+include $(CORE_DEPTH)/coreconf/WIN32.mk
+
+ifeq ($(CPU_ARCH), x386)
+	OS_CFLAGS += -W3 -nologo
+ifdef USE_64
+	DEFINES += -D_AMD64_
+else
+	DEFINES += -D_X86_
+endif
+else 
+	ifeq ($(CPU_ARCH), MIPS)
+		#OS_CFLAGS += -W3 -nologo
+		#DEFINES += -D_MIPS_
+		OS_CFLAGS += -W3 -nologo
+	else 
+		ifeq ($(CPU_ARCH), ALPHA)
+			OS_CFLAGS += -W3 -nologo
+			DEFINES += -D_ALPHA_=1
+		endif
+	endif
+endif
+
+OS_DLLFLAGS += -nologo -DLL -SUBSYSTEM:WINDOWS
+ifndef MOZ_DEBUG_SYMBOLS
+	OS_DLLFLAGS += -PDB:NONE
+endif
+
+#
+# Win NT needs -GT so that fibers can work
+#
+OS_CFLAGS += -GT
+DEFINES += -DWINNT
+
+NSPR31_LIB_PREFIX = lib
 #
 # ***** BEGIN LICENSE BLOCK *****
 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
 #
 # The contents of this file are subject to the Mozilla Public License Version
 # 1.1 (the "License"); you may not use this file except in compliance with
 # the License. You may obtain a copy of the License at
 # http://www.mozilla.org/MPL/
--- a/security/coreconf/arch.mk
+++ b/security/coreconf/arch.mk
@@ -254,16 +254,19 @@ endif
 #
 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
 # the uname.exe in the Cygwin tools.
 #
 ifeq (CYGWIN_NT,$(findstring CYGWIN_NT,$(OS_ARCH)))
     OS_RELEASE := $(patsubst CYGWIN_NT-%,%,$(OS_ARCH))
     OS_ARCH = WINNT
     ifndef CPU_ARCH
+    ifeq (WOW64,$(findstring WOW64,$(OS_RELEASE)))
+        OS_RELEASE := $(patsubst %-WOW64,%,$(OS_RELEASE))
+    endif    
 	CPU_ARCH := $(shell uname -m)
 	#
 	# Cygwin's uname -m returns "i686" on a Pentium Pro machine.
 	#
 	ifneq (,$(findstring 86,$(CPU_ARCH)))
 	    CPU_ARCH = x386
 	endif
     endif
--- a/security/nss/lib/freebl/Makefile
+++ b/security/nss/lib/freebl/Makefile
@@ -83,16 +83,17 @@ endif
 endif
 
 ifeq ($(OS_TARGET),OSF1)
     DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_NO_MP_WORD
     MPI_SRCS += mpvalpha.c
 endif
 
 ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET)))  #omits WIN16 and WINCE
+ifndef USE_64
 ifdef NS_USE_GCC
 # Ideally, we want to use assembler
 #     ASFILES  = mpi_x86.s
 #     DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE \
 #                -DMP_ASSEMBLY_DIV_2DX1D
 # but we haven't figured out how to make it work, so we are not
 # using assembler right now.
     ASFILES  =
@@ -101,16 +102,17 @@ else
     MPI_SRCS += mpi_x86_asm.c
     DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE 
     DEFINES += -DMP_ASSEMBLY_DIV_2DX1D -DMP_USE_UINT_DIGIT -DMP_NO_MP_WORD
     ifdef BUILD_OPT
 	OPTIMIZER += -Ox  # maximum optimization for freebl
     endif
 endif
 endif
+endif
 
 ifeq ($(OS_TARGET),WINCE)
     DEFINES += -DMP_ARGCHK=0	# no assert in WinCE
     DEFINES += -DSHA_NO_LONG_LONG # avoid 64-bit arithmetic in SHA512
 endif
 
 ifeq ($(OS_TARGET),IRIX)
 ifeq ($(USE_N32),1)
--- a/security/nss/lib/freebl/win_rand.c
+++ b/security/nss/lib/freebl/win_rand.c
@@ -554,17 +554,19 @@ void RNG_FileForRNG(const char *filename
 
 /*
  * CryptoAPI requires Windows NT 4.0 or Windows 95 OSR2 and later.
  * Until we drop support for Windows 95, we need to emulate some
  * definitions and declarations in <wincrypt.h> and look up the
  * functions in advapi32.dll at run time.
  */
 
+#ifndef WIN64
 typedef unsigned long HCRYPTPROV;
+#endif
 
 #define CRYPT_VERIFYCONTEXT 0xF0000000
 
 #define PROV_RSA_FULL 1
 
 typedef BOOL
 (WINAPI *CryptAcquireContextAFn)(
     HCRYPTPROV *phProv,