diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/browser/app/Makefile.in mozilla/browser/app/Makefile.in
--- mozilla.orig/browser/app/Makefile.in	2008-11-19 06:36:19 +0900
+++ mozilla/browser/app/Makefile.in	2010-05-21 19:45:19 +0900
@@ -162,6 +162,7 @@
 # Always enter a Windows program through wmain, whether or not we're
 # a console application.
 WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
+WIN7_MANIFEST = 1
 endif
 
 ifndef BUILD_STATIC_LIBS
@@ -371,7 +372,7 @@
 
 ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
 
-APP_NAME = $(MOZ_APP_DISPLAYNAME)
+APP_NAME = $(MOZ_APP_NAME)
 
 ifdef MOZ_DEBUG
 APP_NAME := $(APP_NAME)Debug
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/browser/app/profile/firefox.js mozilla/browser/app/profile/firefox.js
--- mozilla.orig/browser/app/profile/firefox.js	2009-01-02 02:57:29 +0900
+++ mozilla/browser/app/profile/firefox.js	2010-03-18 20:48:05 +0900
@@ -174,6 +174,7 @@
 pref("general.useragent.locale", "@AB_CD@");
 pref("general.skins.selectedSkin", "classic/1.0");
 pref("general.useragent.extra.firefox", "@APP_UA_NAME@/@APP_VERSION@");
+pref("general.useragent.extra.firefox.rayflood", "(rayflood)");
 
 pref("general.smoothScroll", false);
 #ifdef UNIX_BUT_NOT_MAC
@@ -192,7 +193,7 @@
 pref("browser.startup.homepage",            "resource:/browserconfig.properties");
 
 pref("browser.cache.disk.capacity",         50000);
-pref("browser.enable_automatic_image_resizing", true);
+pref("browser.enable_automatic_image_resizing", false);
 pref("browser.chrome.site_icons", true);
 pref("browser.chrome.favicons", true);
 pref("browser.formfill.enable", true);
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/browser/branding/nightly/configure.sh mozilla/browser/branding/nightly/configure.sh
--- mozilla.orig/browser/branding/nightly/configure.sh	2006-11-29 00:37:40 +0900
+++ mozilla/browser/branding/nightly/configure.sh	2010-03-18 20:48:05 +0900
@@ -1 +1 @@
-MOZ_APP_DISPLAYNAME=Minefield
+MOZ_APP_DISPLAYNAME=Firefox
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/browser/branding/unofficial/branding.nsi mozilla/browser/branding/unofficial/branding.nsi
--- mozilla.orig/browser/branding/unofficial/branding.nsi	2007-11-10 05:22:17 +0900
+++ mozilla/browser/branding/unofficial/branding.nsi	2010-03-18 20:48:05 +0900
@@ -37,17 +37,17 @@
 # NSIS branding defines for unofficial builds.
 # The official release build branding.nsi is located in other-license/branding/firefox/
 # The nightly build branding.nsi is located in browser/installer/windows/nsis/
-!define BrandShortName        "Gran Paradiso"
+!define BrandShortName        "firefox"
 # BrandFullNameInternal is used for some registry and file system values
 # instead of BrandFullName and typically should not be modified.
-!define BrandFullNameInternal "Gran Paradiso"
+!define BrandFullNameInternal "firefox"
 !define CompanyName           "mozilla.org"
 !define URLInfoAbout          "http://www.mozilla.org"
 !define URLUpdateInfo         "http://www.mozilla.org/projects/firefox"
 !define SurveyURL             "https://survey.mozilla.com/1/Mozilla%20Firefox/${AppVersion}/${AB_CD}/exit.html"
 
 # Everything below this line may be modified for Alpha / Beta releases.
-!define BrandFullName         "Gran Paradiso"
+!define BrandFullName         "firefox"
 
 # Add !define NO_INSTDIR_FROM_REG to prevent finding a non-default installation
 # directory in the registry and using that as the default. This prevents
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/browser/branding/unofficial/configure.sh mozilla/browser/branding/unofficial/configure.sh
--- mozilla.orig/browser/branding/unofficial/configure.sh	2006-11-22 11:21:19 +0900
+++ mozilla/browser/branding/unofficial/configure.sh	2010-03-18 20:48:05 +0900
@@ -1 +1 @@
-MOZ_APP_DISPLAYNAME="GranParadiso"
\ No newline at end of file
+MOZ_APP_DISPLAYNAME="Firefox"
\ No newline at end of file
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/browser/branding/unofficial/locales/en-US/brand.dtd mozilla/browser/branding/unofficial/locales/en-US/brand.dtd
--- mozilla.orig/browser/branding/unofficial/locales/en-US/brand.dtd	2006-11-22 11:21:20 +0900
+++ mozilla/browser/branding/unofficial/locales/en-US/brand.dtd	2010-03-18 20:48:05 +0900
@@ -1,5 +1,5 @@
-<!ENTITY  brandShortName        "Gran Paradiso">
-<!ENTITY  brandFullName         "Gran Paradiso">            
+<!ENTITY  brandShortName        "firefox">
+<!ENTITY  brandFullName         "firefox">            
 <!ENTITY  vendorShortName       "mozilla.org">
 
 <!-- LOCALIZATION NOTE (releaseBaseURL): The about: page appends __MOZ_APP_VERSION__.html, e.g. 2.0.html -->
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/browser/branding/unofficial/locales/en-US/brand.properties mozilla/browser/branding/unofficial/locales/en-US/brand.properties
--- mozilla.orig/browser/branding/unofficial/locales/en-US/brand.properties	2006-11-22 11:21:20 +0900
+++ mozilla/browser/branding/unofficial/locales/en-US/brand.properties	2010-03-18 20:48:05 +0900
@@ -1,3 +1,3 @@
-brandShortName=Gran Paradiso
-brandFullName=Gran Paradiso
+brandShortName=firefox
+brandFullName=firefox
 vendorShortName=mozilla.org
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/browser/installer/Makefile.in mozilla/browser/installer/Makefile.in
--- mozilla.orig/browser/installer/Makefile.in	2008-11-19 06:36:21 +0900
+++ mozilla/browser/installer/Makefile.in	2010-03-18 20:48:05 +0900
@@ -66,8 +66,6 @@
 MOZ_PKG_MANIFEST_P = $(srcdir)/unix/packages-static
 endif
 endif
-else
-$(error you need a "--enable-static or --enable-libxul" build to package a build)
 endif
 
 MOZ_NONLOCALIZED_PKG_LIST = \
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/browser/locales/en-US/chrome/branding/brand.dtd mozilla/browser/locales/en-US/chrome/branding/brand.dtd
--- mozilla.orig/browser/locales/en-US/chrome/branding/brand.dtd	2006-08-22 04:14:29 +0900
+++ mozilla/browser/locales/en-US/chrome/branding/brand.dtd	2010-03-18 20:48:05 +0900
@@ -1,3 +1,3 @@
-<!ENTITY  brandShortName        "Minefield">
-<!ENTITY  brandFullName         "Minefield">            
+<!ENTITY  brandShortName        "firefox">
+<!ENTITY  brandFullName         "firefox">
 <!ENTITY  vendorShortName       "Mozilla">
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/browser/locales/en-US/chrome/branding/brand.properties mozilla/browser/locales/en-US/chrome/branding/brand.properties
--- mozilla.orig/browser/locales/en-US/chrome/branding/brand.properties	2006-04-11 08:58:24 +0900
+++ mozilla/browser/locales/en-US/chrome/branding/brand.properties	2010-03-18 20:48:05 +0900
@@ -1,3 +1,3 @@
-brandShortName=Minefield
-brandFullName=Minefield
+brandShortName=firefox
+brandFullName=firefox
 vendorShortName=Mozilla
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/build/pgo/Makefile.in mozilla/build/pgo/Makefile.in
--- mozilla.orig/build/pgo/Makefile.in	2008-05-07 02:52:26 +0900
+++ mozilla/build/pgo/Makefile.in	2010-03-18 20:48:05 +0900
@@ -67,9 +67,9 @@
 else
 ifeq ($(OS_ARCH),Darwin)
 ifdef MOZ_DEBUG
-browser_path = \"$(DIST)/$(MOZ_APP_DISPLAYNAME)Debug.app/Contents/MacOS/$(PROGRAM)\"
+browser_path = \"$(DIST)/$(MOZ_APP_NAME)Debug.app/Contents/MacOS/$(PROGRAM)\"
 else
-browser_path = \"$(DIST)/$(MOZ_APP_DISPLAYNAME).app/Contents/MacOS/$(PROGRAM)\"
+browser_path = \"$(DIST)/$(MOZ_APP_NAME).app/Contents/MacOS/$(PROGRAM)\"
 endif
 else
 browser_path = \"$(DIST)/bin/$(PROGRAM)\"
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/client.mk mozilla/client.mk
--- mozilla.orig/client.mk	2010-03-13 10:25:52 +0900
+++ mozilla/client.mk	2010-03-18 20:48:05 +0900
@@ -520,7 +520,7 @@
         $(CVSCO) $(MOZCONFIG_FINDER) $(MOZCONFIG_LOADER) $(MOZCONFIG_MODULES); \
      else true; \
      fi; \
-     $(MOZCONFIG_LOADER) $(TOPSRCDIR) mozilla/.mozconfig.mk > mozilla/.mozconfig.out)
+     $(CONFIG_SHELL) $(MOZCONFIG_LOADER) $(TOPSRCDIR) mozilla/.mozconfig.mk > mozilla/.mozconfig.out)
 include $(TOPSRCDIR)/.mozconfig.mk
 
 ####################################
@@ -1072,8 +1072,8 @@
 endif
 	@if test ! -d $(OBJDIR); then $(MKDIR) $(OBJDIR); else true; fi
 	@echo cd $(OBJDIR);
-	@echo $(CONFIGURE) $(CONFIGURE_ARGS)
-	@cd $(OBJDIR) && $(BUILD_PROJECT_ARG) $(CONFIGURE_ENV_ARGS) $(CONFIGURE) $(CONFIGURE_ARGS) \
+	@echo $(CONFIG_SHELL) $(CONFIGURE) $(CONFIGURE_ARGS)
+	@cd $(OBJDIR) && $(BUILD_PROJECT_ARG) $(CONFIGURE_ENV_ARGS) $(CONFIG_SHELL) $(CONFIGURE) $(CONFIGURE_ARGS) \
 	  || ( echo "*** Fix above errors and then restart with\
                \"$(MAKE) -f client.mk build\"" && exit 1 )
 	@touch $(OBJDIR)/Makefile
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/config/autoconf.mk.in mozilla/config/autoconf.mk.in
--- mozilla.orig/config/autoconf.mk.in	2008-09-19 07:00:51 +0900
+++ mozilla/config/autoconf.mk.in	2010-03-18 20:48:05 +0900
@@ -344,6 +344,9 @@
 CC		    = @CC@
 CXX		    = @CXX@
 
+CC_VERSION	= @CC_VERSION@
+CXX_VERSION	= @CXX_VERSION@
+
 GNU_AS		= @GNU_AS@
 GNU_LD		= @GNU_LD@
 GNU_CC		= @GNU_CC@
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/config/config.mk mozilla/config/config.mk
--- mozilla.orig/config/config.mk	2008-08-14 19:00:34 +0900
+++ mozilla/config/config.mk	2010-08-31 22:21:58 +0900
@@ -365,8 +365,10 @@
 OS_CXXFLAGS += $(PROFILE_GEN_CFLAGS)
 OS_LDFLAGS += $(PROFILE_GEN_LDFLAGS)
 ifeq (WINNT,$(OS_ARCH))
+ifeq (,$(GNU_CC))
 AR_FLAGS += -LTCG
 endif
+endif
 endif # INTERNAL_TOOLS
 endif # MOZ_PROFILE_GENERATE
 
@@ -376,8 +378,10 @@
 OS_CXXFLAGS += $(PROFILE_USE_CFLAGS)
 OS_LDFLAGS += $(PROFILE_USE_LDFLAGS)
 ifeq (WINNT,$(OS_ARCH))
+ifeq (,$(GNU_CC))
 AR_FLAGS += -LTCG
 endif
+endif
 endif # INTERNAL_TOOLS
 endif # MOZ_PROFILE_USE
 endif # NO_PROFILE_GUIDED_OPTIMIZE
@@ -867,10 +871,6 @@
 LOCALE_SRCDIR = $(call EXPAND_LOCALE_SRCDIR,$(relativesrcdir))
 endif
 
-ifdef LOCALE_SRCDIR
-MAKE_JARS_FLAGS += -c $(LOCALE_SRCDIR)
-endif
-
 ifeq (,$(filter WINCE WINNT OS2,$(OS_ARCH)))
 RUN_TEST_PROGRAM = $(DIST)/bin/run-mozilla.sh
 endif
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/config/rules.mk mozilla/config/rules.mk
--- mozilla.orig/config/rules.mk	2009-12-03 16:18:55 +0900
+++ mozilla/config/rules.mk	2010-05-21 17:49:43 +0900
@@ -801,9 +801,15 @@
 # The compiler would do this for us automatically if they were in the right
 # place, but they're in dist/bin.
 ifdef BINARY_BASENAME
+ifdef IS_COMPONENT
+export::
+	$(PYTHON) $(topsrcdir)/build/win32/pgomerge.py \
+	  $(BINARY_BASENAME) $(DIST)/bin/components
+else
 export::
 	$(PYTHON) $(topsrcdir)/build/win32/pgomerge.py \
 	  $(BINARY_BASENAME) $(DIST)/bin
+endif # IS_COMPONENT
 endif
 endif # MOZ_PROFILE_USE
 endif # WINNT_
@@ -862,13 +868,12 @@
 	$(LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
 ifdef MSMANIFEST_TOOL
 	@if test -f $@.manifest; then \
-		if test -f "$(srcdir)/$@.manifest"; then \
-			mt.exe -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" $@.manifest -OUTPUTRESOURCE:$@\;1; \
-		else \
 			mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
-		fi; \
-		rm -f $@.manifest; \
+		mt.exe -NOLOGO -INPUTRESOURCE:$@\;1 -MANIFEST $(WIN_TOP_SRC)/config/uiAccess.manifest -OUTPUTRESOURCE:$@\;1; \
 	fi
+ifdef WIN7_MANIFEST
+	mt.exe -NOLOGO -INPUTRESOURCE:$@\;1 -MANIFEST $(WIN_TOP_SRC)/config/win7.manifest -OUTPUTRESOURCE:$@\;1
+endif # WIN7_MANIFEST
 endif	# MSVC with manifest tool
 else
 ifeq ($(CPP_PROG_LINK),1)
@@ -1784,11 +1789,28 @@
 	if test -f $(JAR_MANIFEST); then \
 	  if test ! -d $(FINAL_TARGET)/chrome; then $(NSINSTALL) -D $(FINAL_TARGET)/chrome; fi; \
 	  if test ! -d $(MAKE_JARS_TARGET)/chrome; then $(NSINSTALL) -D $(MAKE_JARS_TARGET)/chrome; fi; \
+	MOZ_UI_LOCALE="CVS" ; \
+	if test "$(relativesrcdir)" ; then \
+		MOZ_UI_LOCALE="en-US `ls $(L10NBASEDIR) | tr -d CVS`" ; \
+	fi ; \
+	for AB_CD in $${MOZ_UI_LOCALE} ; do \
+		if test "$${AB_CD}" != "CVS" ; then \
+			if test "$${AB_CD}" = "en-US" ; then \
+				LOCALE_SRCDIR=$(topsrcdir)/$(relativesrcdir)/en-US ; \
+			else \
+				LOCALE_SRCDIR=$(L10NBASEDIR)/$${AB_CD}/$(subst /locales,,$(relativesrcdir)) ; \
+			fi ; \
+			DEFINES=-DAB_CD=$${AB_CD} ; \
+			MAKE_JARS_FLAGS="-c $${LOCALE_SRCDIR}" ; \
+		fi ; \
 	  $(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py $(XULPPFLAGS) $(DEFINES) $(ACDEFINES) \
+	    $${DEFINES} \
 	    $(JAR_MANIFEST) | \
 	  $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/make-jars.pl \
 	    -d $(MAKE_JARS_TARGET)/chrome -j $(FINAL_TARGET)/chrome \
+	    $${MAKE_JARS_FLAGS} \
 	    $(MAKE_JARS_FLAGS) -- "$(XULPPFLAGS) $(DEFINES) $(ACDEFINES)"; \
+	done ; \
 	fi
 endif
 
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/config/uiAccess.manifest mozilla/config/uiAccess.manifest
--- mozilla.orig/config/uiAccess.manifest	1970-01-01 09:00:00 +0900
+++ mozilla/config/uiAccess.manifest	2010-03-18 20:48:06 +0900
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+  <ms_asmv3:trustInfo xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3">
+    <ms_asmv3:security>
+      <ms_asmv3:requestedPrivileges>
+        <ms_asmv3:requestedExecutionLevel level="asInvoker" uiAccess="false">
+        </ms_asmv3:requestedExecutionLevel>
+      </ms_asmv3:requestedPrivileges>
+    </ms_asmv3:security>
+  </ms_asmv3:trustInfo>
+</assembly>
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/config/win7.manifest mozilla/config/win7.manifest
--- mozilla.orig/config/win7.manifest	1970-01-01 09:00:00 +0900
+++ mozilla/config/win7.manifest	2010-03-18 20:48:06 +0900
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+    <application>
+      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
+      <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />
+    </application>
+  </compatibility>
+</assembly>
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/configure mozilla/configure
--- mozilla.orig/configure	2009-07-23 05:41:04 +0900
+++ mozilla/configure	2010-09-01 17:36:49 +0900
@@ -3070,6 +3070,19 @@
 #define _CRT_NONSTDC_NO_WARNINGS 1
 EOF
 
+        elif test "$_CC_MAJOR_VERSION" = "16"; then
+            _CC_SUITE=10
+            CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
+            LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
+            _USE_DYNAMICBASE=1
+            cat >> confdefs.h <<\EOF
+#define _CRT_SECURE_NO_WARNINGS 1
+EOF
+
+            cat >> confdefs.h <<\EOF
+#define _CRT_NONSTDC_NO_WARNINGS 1
+EOF
+
         else
             { echo "configure: error: This version of the MSVC compiler, $CC_VERSION , is unsupported." 1>&2; exit 1; }
         fi
@@ -3136,6 +3149,7 @@
         unset _MSVC_VER_FILTER
         
     else
+        GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
         # Check w32api version
         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
@@ -6427,7 +6441,7 @@
         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
         DLL_PREFIX=
-        IMPORT_LIB_SUFFIX=dll.a
+        IMPORT_LIB_SUFFIX=a
     else
         TARGET_COMPILER_ABI=msvc
         HOST_CC='$(CC)'
@@ -16914,7 +16928,14 @@
       _CRT_BASE_DIR=`basename "$WIN32_CRT_SRC_DIR"`
       _WIN_UNIX_CRT_PATH="$_objdir/memory/jemalloc/$_CRT_BASE_DIR/build/intel"
     fi
+    case "$host" in
+    *-mingw*)
             _WIN_CRT_PATH=`$PYTHON -c 'import sys, os.path; print os.path.normpath(sys.argv[1])' "$_WIN_UNIX_CRT_PATH"`
+    ;;
+    *-cygwin*|*-msvc*|*-mks*)
+            _WIN_CRT_PATH=`$CYGPATH_W "$_WIN_UNIX_CRT_PATH"`
+    ;;
+    esac
     MOZ_LIB="$_WIN_CRT_PATH;$LIB"
             MOZ_PATH="$PATH:$_WIN_UNIX_CRT_PATH"
         cat >> confdefs.h <<\EOF
@@ -17792,7 +17813,7 @@
 
 
 _SAVE_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -fprofile-generate"
+CFLAGS="$CFLAGS -fprofile-generate -fprofile-arcs -ftest-coverage"
 
 echo $ac_n "checking whether C compiler supports -fprofile-generate""... $ac_c" 1>&6
 echo "configure:17799: checking whether C compiler supports -fprofile-generate" >&5
@@ -17806,7 +17827,7 @@
 EOF
 if { (eval echo configure:17808: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-   PROFILE_GEN_CFLAGS="-fprofile-generate"
+   PROFILE_GEN_CFLAGS="-fprofile-generate -fprofile-arcs -ftest-coverage"
                  result="yes" 
 else
   echo "configure: failed program was:" >&5
@@ -17818,9 +17839,17 @@
 echo "$ac_t""$result" 1>&6
 
 if test $result = "yes"; then
-  PROFILE_GEN_LDFLAGS="-fprofile-generate"
+  PROFILE_GEN_LDFLAGS="-fprofile-generate -fprofile-arcs -ftest-coverage"
   PROFILE_USE_CFLAGS="-fprofile-use"
   PROFILE_USE_LDFLAGS="-fprofile-use"
+  case "$GCC_VERSION" in
+  4.4.*|4.5.*)
+    PROFILE_GEN_CFLAGS="$PROFILE_GEN_CFLAGS -fprofile-correction"
+    PROFILE_GEN_LDFLAGS="$PROFILE_GEN_LDFLAGS -fprofile-correction"
+    PROFILE_USE_CFLAGS="$PROFILE_USE_CFLAGS -fprofile-correction"
+    PROFILE_USE_LDFLAGS="$PROFILE_USE_LDFLAGS -fprofile-correction"
+  ;;
+  esac
 else
   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
   echo $ac_n "checking whether C compiler supports -fprofile-arcs""... $ac_c" 1>&6
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/db/sqlite3/src/sqlite3.c mozilla/db/sqlite3/src/sqlite3.c
--- mozilla.orig/db/sqlite3/src/sqlite3.c	2009-06-18 02:55:45 +0900
+++ mozilla/db/sqlite3/src/sqlite3.c	2010-09-02 16:33:25 +0900
@@ -287,9 +287,24 @@
  * case, but that type is not available on all compilers, or 
  * requires the #include of specific headers which differs between
  * platforms.
+ *
+ * Ticket #3860:  The llvm-gcc-4.2 compiler from Apple chokes on
+ * the ((void*)&((char*)0)[X]) construct.  But MSVC chokes on ((void*)(X)).
+ * So we have to define the macros in different ways depending on the
+ * compiler.
  */
-#define SQLITE_INT_TO_PTR(X)   ((void*)&((char*)0)[X])
-#define SQLITE_PTR_TO_INT(X)   ((int)(((char*)X)-(char*)0))
+#if defined(__GNUC__)
+# if defined(HAVE_STDINT_H)
+#   define SQLITE_INT_TO_PTR(X)  ((void*)(intptr_t)(X))
+#   define SQLITE_PTR_TO_INT(X)  ((int)(intptr_t)(X))
+# else
+#   define SQLITE_INT_TO_PTR(X)  ((void*)(X))
+#   define SQLITE_PTR_TO_INT(X)  ((int)(X))
+# endif
+#else
+# define SQLITE_INT_TO_PTR(X)   ((void*)&((char*)0)[X])
+# define SQLITE_PTR_TO_INT(X)   ((int)(((char*)X)-(char*)0))
+#endif
 
 /*
 ** These #defines should enable >2GB file support on POSIX if the
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/embedding/browser/activex/src/common/StdAfx.h mozilla/embedding/browser/activex/src/common/StdAfx.h
--- mozilla.orig/embedding/browser/activex/src/common/StdAfx.h	2007-01-03 00:24:08 +0900
+++ mozilla/embedding/browser/activex/src/common/StdAfx.h	2010-05-21 05:53:38 +0900
@@ -79,7 +79,7 @@
 #include "nsIDOMElement.h"
 
 #undef _WIN32_WINNT
-#define _WIN32_WINNT 0x0400
+#define _WIN32_WINNT 0x0403
 #define _ATL_APARTMENT_THREADED
 #define _ATL_STATIC_REGISTRY
 // #define _ATL_DEBUG_INTERFACES
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/embedding/browser/activex/src/control/DropTarget.cpp mozilla/embedding/browser/activex/src/control/DropTarget.cpp
--- mozilla.orig/embedding/browser/activex/src/control/DropTarget.cpp	2004-04-19 07:00:27 +0900
+++ mozilla/embedding/browser/activex/src/control/DropTarget.cpp	2010-03-18 20:48:06 +0900
@@ -216,7 +216,7 @@
     FORMATETC formatetc;
     STGMEDIUM stgmedium;
     memset(&formatetc, 0, sizeof(formatetc));
-    memset(&stgmedium, 0, sizeof(formatetc));
+    memset(&stgmedium, 0, sizeof(stgmedium));
 
     formatetc.dwAspect = DVASPECT_CONTENT;
     formatetc.lindex = -1;
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/embedding/browser/activex/src/control/StdAfx.h mozilla/embedding/browser/activex/src/control/StdAfx.h
--- mozilla.orig/embedding/browser/activex/src/control/StdAfx.h	2008-01-01 19:11:02 +0900
+++ mozilla/embedding/browser/activex/src/control/StdAfx.h	2010-05-21 05:53:56 +0900
@@ -113,7 +113,7 @@
 #include "nsIDOMEventTarget.h"
 
 #undef _WIN32_WINNT
-#define _WIN32_WINNT 0x0400
+#define _WIN32_WINNT 0x0403
 #define _ATL_APARTMENT_THREADED
 #define _ATL_STATIC_REGISTRY
 // #define _ATL_DEBUG_INTERFACES
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/embedding/browser/activex/src/plugin/StdAfx.h mozilla/embedding/browser/activex/src/plugin/StdAfx.h
--- mozilla.orig/embedding/browser/activex/src/plugin/StdAfx.h	2007-01-03 00:24:08 +0900
+++ mozilla/embedding/browser/activex/src/plugin/StdAfx.h	2010-05-21 05:54:14 +0900
@@ -50,7 +50,7 @@
 #define STRICT
 
 #undef _WIN32_WINNT
-#define _WIN32_WINNT 0x0400
+#define _WIN32_WINNT 0x0403
 #define _ATL_APARTMENT_THREADED
 #define _ATL_STATIC_REGISTRY
 
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/embedding/browser/activex/src/pluginhostctrl/StdAfx.h mozilla/embedding/browser/activex/src/pluginhostctrl/StdAfx.h
--- mozilla.orig/embedding/browser/activex/src/pluginhostctrl/StdAfx.h	2005-09-14 03:39:31 +0900
+++ mozilla/embedding/browser/activex/src/pluginhostctrl/StdAfx.h	2010-05-21 05:54:34 +0900
@@ -48,7 +48,7 @@
 
 #define STRICT
 #ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0400
+#define _WIN32_WINNT 0x0403
 #endif
 #define _ATL_APARTMENT_THREADED
 
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/embedding/browser/activex/src/pluginhostctrl/pluginhostctrlps.mk mozilla/embedding/browser/activex/src/pluginhostctrl/pluginhostctrlps.mk
--- mozilla.orig/embedding/browser/activex/src/pluginhostctrl/pluginhostctrlps.mk	2001-09-13 21:36:15 +0900
+++ mozilla/embedding/browser/activex/src/pluginhostctrl/pluginhostctrlps.mk	2010-05-21 05:54:50 +0900
@@ -4,7 +4,7 @@
 		kernel32.lib rpcndr.lib rpcns4.lib rpcrt4.lib oleaut32.lib uuid.lib \
 
 .c.obj:
-	cl /c /Ox /DWIN32 /D_WIN32_WINNT=0x0400 /DREGISTER_PROXY_DLL \
+	cl /c /Ox /DWIN32 /D_WIN32_WINNT=0x0403 /DREGISTER_PROXY_DLL \
 		$<
 
 clean:
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/embedding/browser/activex/src/xml/StdAfx.h mozilla/embedding/browser/activex/src/xml/StdAfx.h
--- mozilla.orig/embedding/browser/activex/src/xml/StdAfx.h	2000-03-22 07:22:22 +0900
+++ mozilla/embedding/browser/activex/src/xml/StdAfx.h	2010-05-21 05:55:03 +0900
@@ -11,7 +11,7 @@
 
 #define STRICT
 #ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0400
+#define _WIN32_WINNT 0x0403
 #endif
 #define _ATL_APARTMENT_THREADED
 
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/extensions/python/dom/src/nsPyContext.cpp mozilla/extensions/python/dom/src/nsPyContext.cpp
--- mozilla.orig/extensions/python/dom/src/nsPyContext.cpp	2008-03-20 09:42:48 +0900
+++ mozilla/extensions/python/dom/src/nsPyContext.cpp	2010-03-18 20:48:06 +0900
@@ -52,9 +52,15 @@
 
 #include "nsPyDOM.h"
 #include "nsPyContext.h"
+#if defined(__GNUC__) && __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
 #include "compile.h"
 #include "eval.h"
 #include "marshal.h"
+#if defined(__GNUC__) && __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
 
 #ifdef NS_DEBUG
 nsPyDOMObjectLeakStats gLeakStats;
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/extensions/python/dom/test/pyxultest/Makefile.in mozilla/extensions/python/dom/test/pyxultest/Makefile.in
--- mozilla.orig/extensions/python/dom/test/pyxultest/Makefile.in	2006-06-20 08:13:14 +0900
+++ mozilla/extensions/python/dom/test/pyxultest/Makefile.in	2010-03-18 20:48:06 +0900
@@ -55,6 +55,8 @@
 #INSTALL_EXTENSION_ID   = pyxultest@mozilla.org
 #XPI_PKGNAME            = pyxultest-$(MOZ_APP_VERSION)
 DIST_FILES      = application.ini
+BUILD_ID = $(shell $(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/platform.ini Build BuildID)
+DEFINES += -DBUILD_ID=$(BUILD_ID)
 endif
 
 PREF_JS_EXPORTS = $(srcdir)/pyxultest-prefs.js
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/gfx/cairo/cairo/src/Makefile.in mozilla/gfx/cairo/cairo/src/Makefile.in
--- mozilla.orig/gfx/cairo/cairo/src/Makefile.in	2008-04-07 14:08:31 +0900
+++ mozilla/gfx/cairo/cairo/src/Makefile.in	2010-03-18 20:48:06 +0900
@@ -59,11 +59,6 @@
 ifeq ($(OS_ARCH),SunOS)
 MODULE_OPTIMIZE_FLAGS = -xO5
 endif
-ifeq ($(OS_ARCH),WINNT)
-# FIXME: bug 413019
-OS_COMPILE_CFLAGS += -GL-
-MODULE_OPTIMIZE_FLAGS = -O2
-endif
 endif
 
 REQUIRES        = $(PNG_REQUIRES) \
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/gfx/cairo/libpixman/src/Makefile.in mozilla/gfx/cairo/libpixman/src/Makefile.in
--- mozilla.orig/gfx/cairo/libpixman/src/Makefile.in	2008-04-07 14:07:39 +0900
+++ mozilla/gfx/cairo/libpixman/src/Makefile.in	2010-03-18 20:48:06 +0900
@@ -58,11 +58,6 @@
 ifeq ($(OS_ARCH),SunOS)
 MODULE_OPTIMIZE_FLAGS = -xO5
 endif
-ifeq ($(OS_ARCH),WINNT)
-# FIXME: bug 413019
-OS_COMPILE_CFLAGS += -GL-
-MODULE_OPTIMIZE_FLAGS = -O2
-endif
 endif
 
 # Build MMX code either with VC or with gcc-on-x86
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/jpeg/Makefile.in mozilla/jpeg/Makefile.in
--- mozilla.orig/jpeg/Makefile.in	2008-01-19 10:09:37 +0900
+++ mozilla/jpeg/Makefile.in	2010-03-18 20:48:06 +0900
@@ -47,10 +47,6 @@
 
 ifeq ($(OS_ARCH),WINNT)
 LIBRARY_NAME	= jpeg$(MOZ_BITS)$(VERSION_NUMBER)
-# FIXME: bug 413019
-ifndef GNU_CC
-OS_COMPILE_CFLAGS += -GL-
-endif
 endif
 
 GRE_MODULE	= 1
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/memory/jemalloc/Makefile.in mozilla/memory/jemalloc/Makefile.in
--- mozilla.orig/memory/jemalloc/Makefile.in	2008-05-08 18:20:45 +0900
+++ mozilla/memory/jemalloc/Makefile.in	2010-03-18 20:48:06 +0900
@@ -55,7 +55,13 @@
 	$(INSTALL) $< $(FINAL_TARGET)
 
 # patch if necessary
-$(CRT_OBJ_DIR)/jemalloc.c: $(srcdir)/crtsp1.diff
+ifeq ($(CC_VERSION), 14.00.50727.762)
+CRTDIFF=crtsp1.diff
+else
+CRTDIFF=crtvc9sp1.diff
+endif
+
+$(CRT_OBJ_DIR)/jemalloc.c: $(srcdir)/$(CRTDIFF)
 	rm -rf $(CRT_OBJ_DIR)
 	cp -R "$(WIN32_CRT_SRC_DIR)" .
 	# per http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1189363&SiteID=1
@@ -64,7 +70,7 @@
 	done
 	# truly awful
 	#XXX: get ed into mozillabuild, bug 415123
-	$(PERL) $(srcdir)/apply-ed-patches.pl $(srcdir)/crtsp1.diff \
+	$(PERL) $(srcdir)/apply-ed-patches.pl $(srcdir)/$(CRTDIFF) \
 	$(CRT_OBJ_DIR) $(srcdir)/ed.exe
 
 $(CRT_OBJ_DIR)/build/intel/mozcrt19.dll: \
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/memory/jemalloc/crtvc9sp1.diff mozilla/memory/jemalloc/crtvc9sp1.diff
--- mozilla.orig/memory/jemalloc/crtvc9sp1.diff	1970-01-01 09:00:00 +0900
+++ mozilla/memory/jemalloc/crtvc9sp1.diff	2010-03-18 20:48:08 +0900
@@ -0,0 +1,216 @@
+# The Microsoft C Runtime source code to which this document refers is available
+# directly from Microsoft Corporation, under a separate license.
+# Please ensure that if you are using that source code, you have appropriate
+# rights to use it.  By providing you access to this file, Mozilla Corporation
+# and its affiliates do not purport to grant any rights in that source code. 
+# Binaries are available under separate licenses at 
+# http://www.microsoft.com/downloads/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF&displaylang=en
+diff -re crt/src/_sample_.rc crtsrc/_sample_.rc
+41c
+            VALUE "ProductName", "Mozilla Custom C Runtime"
+.
+39c
+            VALUE "OriginalFilename", "MOZCRT19.DLL"
+.
+37c
+            VALUE "OriginalFilename", "MOZCRT19D.DLL"
+.
+33c
+            VALUE "InternalName", "MOZCRT19.DLL"
+.
+31c
+            VALUE "InternalName", "MOZCRT19D.DLL"
+.
+27c
+            VALUE "CompanyName", "Mozilla Foundation"
+.
+diff -re crt/src/crt0.c crtsrc/crt0.c
+212c
+        /*
+         * this used to happen in _mtinit, but we need it before malloc
+         */
+        _init_pointers();       /* initialize global function pointers */
+
+        if ( malloc_init_hard() )                /* initialize heap */
+.
+87a
+extern BOOL malloc_init_hard(void);
+.
+diff -re crt/src/crt0dat.c crtsrc/crt0dat.c
+837d
+826d
+diff -re crt/src/crtdll.c crtsrc/crtdll.c
+31,40d
+diff -re crt/src/crtexe.c crtsrc/crtexe.c
+322,324d
+35,45d
+diff -re crt/src/crtheap.c crtsrc/crtheap.c
+61c
+    pv = calloc(count, size);
+.
+58,59d
+diff -re crt/src/crtlib.c crtsrc/crtlib.c
+686,693d
+355d
+339a
+                 malloc_shutdown();
+
+.
+298d
+279d
+249,250d
+239d
+226c
+            /*
+             * this used to happen in _mtinit, but we need it before malloc
+             */
+            _init_pointers();       /* initialize global function pointers */
+
+            if ( malloc_init_hard() )   /* initialize heap */
+.
+43a
+extern BOOL malloc_init_hard(void);
+extern void malloc_shutdown(void);
+
+.
+diff -re crt/src/dllcrt0.c crtsrc/dllcrt0.c
+189,190d
+136d
+126d
+111d
+106,108d
+diff -re crt/src/intel/_sample_.def crtsrc/intel/_sample_.def
+1198d
+718,719d
+664a
+    posix_memalign
+.
+638a
+    memalign
+.
+495a
+    malloc_usable_size
+.
+331,336d
+319d
+313,314d
+81d
+9c
+LIBRARY MOZCRT19
+.
+diff -re crt/src/internal.h crtsrc/internal.h
+413a
+#endif
+.
+409c
+#if 0
+.
+diff -re crt/src/makefile crtsrc/makefile
+1873c
+-def:$(DEFFILE2_DIR)\sample_p.def
+.
+1841c
+ $(DEFFILE2_DIR)\sample_p.def $(CPPSRC_OBJS_DLL:*=dll) \
+.
+1771a
+$(DEFFILE_DIR)\$(RETAIL_LIB_NAME).def : $(DEFFILE_DIR)\_sample_.def
+	copy $** $@
+.
+1290d
+1235,1237d
+760c
+dll_ :: $(OBJROOT) $(OBJCPUDIR) $(OBJDIR_DLL) $(OBJDIR_DLL)\$(PURE_OBJ_DIR) \
+   	$(OBJDIR_DLL)\$(CPP_OBJ_DIR) \
+   	$(RELDIR_CPU) $(PDBDIR_CPU_DLL) $(MAKE_DIRS_DLL)
+.
+340c
+CC_OPTS_BASE=-c -nologo -Zlp8 -W3 -GFy -DWIND32
+.
+213d
+21,24c
+RETAIL_DLL_NAME=MOZCRT19
+RETAIL_DLLCPP_NAME=MOZCPP19
+.
+diff -re crt/src/makefile.inc crtsrc/makefile.inc
+1636a
+$(OBJDIR)\unhandld.obj: $(PREOBJDIR)\unhandld.obj
+        copy $(PREOBJDIR)\unhandld.obj $@
+
+.
+623d
+621d
+405d
+344,356c
+        $(OBJDIR)\jemalloc.obj  \
+.
+336,337d
+331,332d
+329d
+325d
+321,322d
+diff -re crt/src/makefile.sub crtsrc/makefile.sub
+66c
+CFLAGS=$(CFLAGS) -O2 -DMOZ_MEMORY=1 -DMOZ_MEMORY_WINDOWS=1
+.
+diff -re crt/src/malloc.h crtsrc/malloc.h
+189a
+#endif
+.
+177a
+
+#if 0
+.
+83a
+#endif
+.
+70a
+#if 0
+.
+diff -re crt/src/mlock.c crtsrc/mlock.c
+274c
+#endif
+.
+262a
+#if 0
+.
+diff -re crt/src/new.cpp crtsrc/new.cpp
+60d
+52,55d
+37,38c
+        break;
+.
+diff -re crt/src/nothrownew.cpp crtsrc/nothrownew.cpp
+38c
+#endif
+.
+31a
+#if 1
+        break;
+#else
+
+.
+diff -re crt/src/sample_p.def crtsrc/sample_p.def
+8c
+LIBRARY mozcpp19
+.
+diff -re crt/src/sample_p.rc crtsrc/sample_p.rc
+41c
+            VALUE "ProductName", "Mozilla Custom C++ Runtime"
+.
+39c
+            VALUE "OriginalFilename", "MOZCPP19.DLL"
+.
+37c
+            VALUE "OriginalFilename", "MOZCPP19D.DLL"
+.
+33c
+            VALUE "InternalName", "MOZCPP19.DLL"
+.
+31c
+            VALUE "InternalName", "MOZCPP19D.DLL"
+.
+27c
+            VALUE "CompanyName", "Mozilla Foundation"
+.
+diff -re crt/src/tidtable.c crtsrc/tidtable.c
+360,361d
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/modules/libimg/png/Makefile.in mozilla/modules/libimg/png/Makefile.in
--- mozilla.orig/modules/libimg/png/Makefile.in	2008-01-19 10:09:37 +0900
+++ mozilla/modules/libimg/png/Makefile.in	2010-03-18 20:48:06 +0900
@@ -49,13 +49,6 @@
 endif
 LIBXUL_LIBRARY = 1
 
-ifndef GNU_CC
-ifeq ($(OS_ARCH),WINNT)
-# FIXME: bug 413019
-OS_COMPILE_CFLAGS += -GL-
-endif
-endif
-
 REQUIRES	= $(ZLIB_REQUIRES) \
 		  $(NULL)
 
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/mozconfig mozilla/mozconfig
--- mozilla.orig/mozconfig	1970-01-01 09:00:00 +0900
+++ mozilla/mozconfig	2010-03-18 20:48:08 +0900
@@ -0,0 +1,6 @@
+if [ -e ${topsrcdir}/../../mozconfig ] ; then
+	RF_MOZCONFIG=${topsrcdir}/../../mozconfig
+elif [ -e ${topsrcdir}/../../../mozconfig ] ; then
+	RF_MOZCONFIG=${topsrcdir}/../../../mozconfig
+fi
+. ${RF_MOZCONFIG}/mozconfig.sh
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/security/coreconf/Darwin.mk mozilla/security/coreconf/Darwin.mk
--- mozilla.orig/security/coreconf/Darwin.mk	2009-03-20 16:19:35 +0900
+++ mozilla/security/coreconf/Darwin.mk	2010-03-18 20:48:06 +0900
@@ -108,12 +108,16 @@
 OS_CFLAGS	= $(DSO_CFLAGS) $(OS_REL_CFLAGS) -Wmost -fpascal-strings -fno-common -pipe -DDARWIN -DHAVE_STRERROR -DHAVE_BSD_FLOCK $(DARWIN_SDK_CFLAGS)
 
 ifdef BUILD_OPT
+ifeq ($(MOZ_OPTIMIZE),2)
+	OPTIMIZER	= $(MOZ_OPTIMIZE_FLAGS)
+else
 ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE))
 	OPTIMIZER       = -Oz
 else
 	OPTIMIZER	= -O2
 endif
 endif
+endif
 
 ARCH		= darwin
 
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/security/coreconf/Linux.mk mozilla/security/coreconf/Linux.mk
--- mozilla.orig/security/coreconf/Linux.mk	2008-09-06 08:17:23 +0900
+++ mozilla/security/coreconf/Linux.mk	2010-03-18 20:48:06 +0900
@@ -153,12 +153,16 @@
 endif
 
 ifdef BUILD_OPT
+ifeq ($(MOZ_OPTIMIZE),2)
+	OPTIMIZER = $(MOZ_OPTIMIZE_FLAGS)
+else
 ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE))
 	OPTIMIZER = -Os
 else
 	OPTIMIZER = -O2
 endif
 endif
+endif
 
 ifeq ($(USE_PTHREADS),1)
 OS_PTHREAD = -lpthread 
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/security/coreconf/OS2.mk mozilla/security/coreconf/OS2.mk
--- mozilla.orig/security/coreconf/OS2.mk	2008-04-03 07:54:05 +0900
+++ mozilla/security/coreconf/OS2.mk	2010-03-18 20:48:07 +0900
@@ -52,7 +52,7 @@
 
 
 CCC			= gcc
-LINK			= gcc
+LD			= gcc
 AR                      = emxomfar r $@
 # Keep AR_FLAGS blank so that we do not have to change rules.mk
 AR_FLAGS                = 
@@ -100,11 +100,15 @@
 OS_CFLAGS          = -Wall -W -Wno-unused -Wpointer-arith -Wcast-align -Wno-switch -Zomf -DDEBUG -DTRACING -g
 
 ifdef BUILD_OPT
+ifeq ($(MOZ_OPTIMIZE),2)
+	OPTIMIZER += $(MOZ_OPTIMIZE_FLAGS)
+else
 ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE))
 	OPTIMIZER += -Os -s
 else
 	OPTIMIZER += -O2 -s
 endif
+endif
 DEFINES 		+= -UDEBUG -U_DEBUG -DNDEBUG
 DLLFLAGS		= -DLL -OUT:$@ -MAP:$(@:.dll=.map) $(HIGHMEM_LDFLAG)
 EXEFLAGS    		= -PMTYPE:VIO -OUT:$@ -MAP:$(@:.exe=.map) -nologo -NOE $(HIGHMEM_LDFLAG)
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/security/coreconf/WIN32.mk mozilla/security/coreconf/WIN32.mk
--- mozilla.orig/security/coreconf/WIN32.mk	2009-04-01 09:49:48 +0900
+++ mozilla/security/coreconf/WIN32.mk	2010-03-18 20:48:07 +0900
@@ -45,7 +45,7 @@
 ifdef NS_USE_GCC
 	CC           = gcc
 	CCC          = g++
-	LINK         = ld
+	LD           = ld
 	AR           = ar
 	AR          += cr $@
 	RANLIB       = ranlib
@@ -55,7 +55,7 @@
 else
 	CC           = cl
 	CCC          = cl
-	LINK         = link
+	LD           = link
 	AR           = lib
 	AR          += -NOLOGO -OUT:"$@"
 	RANLIB       = echo
@@ -101,11 +101,15 @@
     _GEN_IMPORT_LIB=-Wl,--out-implib,$(IMPORT_LIBRARY)
     DLLFLAGS  += -mno-cygwin -o $@ -shared -Wl,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB))
     ifdef BUILD_OPT
+	ifeq ($(MOZ_OPTIMIZE),2)
+		OPTIMIZER += $(MOZ_OPTIMIZE_FLAGS)
+	else
 	ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE))
 		OPTIMIZER += -Os
 	else
 		OPTIMIZER += -O2
 	endif
+	endif
 	DEFINES    += -UDEBUG -U_DEBUG -DNDEBUG
     else
 	OPTIMIZER  += -g
@@ -125,11 +129,15 @@
     endif
     ifdef BUILD_OPT
 	OS_CFLAGS  += -MD
+	ifeq ($(MOZ_OPTIMIZE),2)
+		OPTIMIZER += $(MOZ_OPTIMIZE_FLAGS)
+	else
 	ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE))
 		OPTIMIZER += -O1
 	else
 		OPTIMIZER += -O2
 	endif
+	endif
 	DEFINES    += -UDEBUG -U_DEBUG -DNDEBUG
 	DLLFLAGS   += -OUT:"$@"
 	ifdef MOZ_DEBUG_SYMBOLS
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/security/coreconf/WINCE.mk mozilla/security/coreconf/WINCE.mk
--- mozilla.orig/security/coreconf/WINCE.mk	2008-11-20 13:39:56 +0900
+++ mozilla/security/coreconf/WINCE.mk	2010-03-18 20:48:07 +0900
@@ -54,7 +54,7 @@
 endif
 endif
 
-LINK         = link
+LD           = link
 AR           = lib
 AR          += -NOLOGO -OUT:"$@"
 RANLIB       = echo
@@ -85,7 +85,11 @@
 
 ifdef BUILD_OPT
 #   OS_CFLAGS  += -MD
+    ifeq ($(MOZ_OPTIMIZE),2)
+    OPTIMIZER  += $(MOZ_OPTIMIZE_FLAGS)
+    else
     OPTIMIZER  += -O2
+    endif
     DEFINES    += -UDEBUG -U_DEBUG -DNDEBUG
     DLLFLAGS   += -OUT:"$@"
 else
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/security/coreconf/command.mk mozilla/security/coreconf/command.mk
--- mozilla.orig/security/coreconf/command.mk	2007-10-24 06:55:00 +0900
+++ mozilla/security/coreconf/command.mk	2010-03-18 20:48:07 +0900
@@ -43,8 +43,8 @@
 AS            = $(CC)
 ASFLAGS      += $(CFLAGS)
 CCF           = $(CC) $(CFLAGS)
-LINK_DLL      = $(LINK) $(OS_DLLFLAGS) $(DLLFLAGS)
-LINK_EXE      = $(LINK) $(OS_LFLAGS) $(LFLAGS)
+LINK_DLL      = $(LD) $(OS_DLLFLAGS) $(DLLFLAGS)
+LINK_EXE      = $(LD) $(OS_LFLAGS) $(LFLAGS)
 CFLAGS        = $(OPTIMIZER) $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) \
 		$(XCFLAGS)
 PERL          = perl
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/security/manager/Makefile.in mozilla/security/manager/Makefile.in
--- mozilla.orig/security/manager/Makefile.in	2009-08-21 09:44:52 +0900
+++ mozilla/security/manager/Makefile.in	2010-03-18 20:48:07 +0900
@@ -43,6 +43,8 @@
 
 include $(DEPTH)/config/autoconf.mk
 
+export MOZ_OPTIMIZE MOZ_OPTIMIZE_FLAGS MOZ_OPTIMIZE_LDFLAGS MOZ_OPTIMIZE_SIZE_TWEAK
+
 MODULE = psm
 
 PACKAGE_FILE = psm.pkg
@@ -234,7 +236,7 @@
 	NATIVE_CC="$(HOST_CC)" \
 	CC="$(CC)" \
 	CCC="$(CXX)" \
-	LINK="$(LD)" \
+	LD="$(LD)" \
 	AS="$(AS)" \
 	AR='$(AR) $(AR_FLAGS:$@=$$@)' \
 	RANLIB="$(RANLIB)" \
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/security/nss/lib/freebl/config.mk mozilla/security/nss/lib/freebl/config.mk
--- mozilla.orig/security/nss/lib/freebl/config.mk	2009-02-03 06:57:23 +0900
+++ mozilla/security/nss/lib/freebl/config.mk	2010-03-18 20:48:07 +0900
@@ -85,8 +85,13 @@
 RESNAME = freebl.rc
 
 ifndef WINCE
+ifdef NS_USE_GCC
+OS_LIBS += -lshell32
+DEFINES += -D_WIN32_IE=0x0500
+else # ! NS_USE_GCC
 OS_LIBS += shell32.lib
 endif
+endif
 
 ifdef NS_USE_GCC
 EXTRA_SHARED_LIBS += \
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/toolkit/components/places/src/Makefile.in mozilla/toolkit/components/places/src/Makefile.in
--- mozilla.orig/toolkit/components/places/src/Makefile.in	2008-04-09 03:41:05 +0900
+++ mozilla/toolkit/components/places/src/Makefile.in	2010-09-01 17:33:51 +0900
@@ -43,8 +43,10 @@
 
 include $(DEPTH)/config/autoconf.mk
 
+ifneq (1_WINNT,$(GNU_CC)_$(OS_ARCH))
 # FIXME: bug 419893
 NO_PROFILE_GUIDED_OPTIMIZE = 1
+endif
 
 MODULE = places
 LIBRARY_NAME  = places
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/toolkit/mozapps/installer/packager.mk mozilla/toolkit/mozapps/installer/packager.mk
--- mozilla.orig/toolkit/mozapps/installer/packager.mk	2008-04-29 04:14:12 +0900
+++ mozilla/toolkit/mozapps/installer/packager.mk	2010-03-18 20:48:07 +0900
@@ -112,9 +112,9 @@
 ifeq ($(MOZ_PKG_FORMAT),DMG)
 ifndef _APPNAME
 ifdef MOZ_DEBUG
-_APPNAME	= $(MOZ_APP_DISPLAYNAME)Debug.app
+_APPNAME	= $(MOZ_APP_NAME)Debug.app
 else
-_APPNAME	= $(MOZ_APP_DISPLAYNAME).app
+_APPNAME	= $(MOZ_APP_NAME).app
 endif
 endif
 ifndef _BINPATH
@@ -146,7 +146,7 @@
 endif
 MAKE_PACKAGE	= $(_ABS_TOPSRCDIR)/build/package/mac_osx/pkg-dmg \
   --source "$(PKG_DMG_SOURCE)" --target "$(PACKAGE)" \
-  --volname "$(MOZ_APP_DISPLAYNAME)" $(PKG_DMG_FLAGS)
+  --volname "$(MOZ_APP_NAME)" $(PKG_DMG_FLAGS)
 UNMAKE_PACKAGE	= \
   set -ex; \
   function cleanup() { \
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/toolkit/mozapps/update/src/updater/updater.cpp mozilla/toolkit/mozapps/update/src/updater/updater.cpp
--- mozilla.orig/toolkit/mozapps/update/src/updater/updater.cpp	2009-07-23 11:34:38 +0900
+++ mozilla/toolkit/mozapps/update/src/updater/updater.cpp	2010-03-18 20:48:07 +0900
@@ -1537,3 +1537,15 @@
   list.Finish(rv);
   return rv;
 }
+
+#if defined( XP_WIN ) && defined(__GNUC__)
+int main(int argc, char **argv){
+	wchar_t **argv_ = new wchar_t*[argc];
+	for(int i = 0; i < argc; i++){
+		int ws = MultiByteToWideChar(0, 0, argv[i], -1, NULL, 0);
+		argv_[i] = new wchar_t[ws];
+		MultiByteToWideChar(0, 0, argv[i], -1, argv_[i], ws);
+	}
+	return wmain(argc, argv_);
+}
+#endif
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/widget/src/windows/nsBidiKeyboard.cpp mozilla/widget/src/windows/nsBidiKeyboard.cpp
--- mozilla.orig/widget/src/windows/nsBidiKeyboard.cpp	2008-03-12 07:46:31 +0900
+++ mozilla/widget/src/windows/nsBidiKeyboard.cpp	2010-03-18 20:48:07 +0900
@@ -156,11 +156,11 @@
   while (keyboards--) {
     locale = buf[keyboards];
     if (IsRTLLanguage(locale)) {
-      sprintf(mRTLKeyboard, "%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID(locale));
+      sprintf(mRTLKeyboard, "%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID((DWORD)locale));
       isRTLKeyboardSet = PR_TRUE;
     }
     else {
-      sprintf(mLTRKeyboard, "%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID(locale));
+      sprintf(mLTRKeyboard, "%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID((DWORD)locale));
       isLTRKeyboardSet = PR_TRUE;
     }
   }
@@ -210,7 +210,7 @@
 PRBool nsBidiKeyboard::IsRTLLanguage(HKL aLocale)
 {
   LOCALESIGNATURE localesig;
-  return (::GetLocaleInfoW(PRIMARYLANGID(aLocale),
+  return (::GetLocaleInfoW(PRIMARYLANGID((DWORD)aLocale),
                            LOCALE_FONTSIGNATURE,
                            (LPWSTR)&localesig,
                            (sizeof(localesig)/sizeof(WCHAR))) &&
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/widget/src/windows/nsNativeThemeWin.cpp mozilla/widget/src/windows/nsNativeThemeWin.cpp
--- mozilla.orig/widget/src/windows/nsNativeThemeWin.cpp	2008-08-15 18:42:35 +0900
+++ mozilla/widget/src/windows/nsNativeThemeWin.cpp	2010-03-18 20:48:07 +0900
@@ -1681,8 +1681,10 @@
     case NS_THEME_MENUITEMTEXT:
         // There seem to be exactly 4 pixels from the edge
         // of the gutter to the text: 2px margin (CSS) + 2px padding (here)
+        {
         SIZE size(GetGutterSize(theme, NULL));
         left = size.cx + 2;
+        }
         break;
     case NS_THEME_MENUSEPARATOR:
         {
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/widget/src/windows/nsWindow.cpp mozilla/widget/src/windows/nsWindow.cpp
--- mozilla.orig/widget/src/windows/nsWindow.cpp	2009-01-08 13:08:56 +0900
+++ mozilla/widget/src/windows/nsWindow.cpp	2010-03-18 20:48:07 +0900
@@ -3127,7 +3127,7 @@
     return PR_FALSE;
 
   nsCaseInsensitiveStringComparator comp;
-  return comp(aChars1, aChars2, aNumChars1) == 0;
+  return comp((PRUnichar*)aChars1, (PRUnichar*)aChars2, aNumChars1) == 0;
 }
 
 /**
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/xulrunner/app/Makefile.in mozilla/xulrunner/app/Makefile.in
--- mozilla.orig/xulrunner/app/Makefile.in	2008-04-09 15:49:41 +0900
+++ mozilla/xulrunner/app/Makefile.in	2010-05-21 19:45:36 +0900
@@ -146,6 +146,7 @@
 # Always enter a Windows program through wmain, whether or not we're
 # a console application.
 WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
+WIN7_MANIFEST = 1
 endif
 
 ifdef NS_TRACE_MALLOC
diff -urN --strip-trailing-cr -x CVS -x '*.pyc' -x '*.stackdump' mozilla.orig/xulrunner/stub/Makefile.in mozilla/xulrunner/stub/Makefile.in
--- mozilla.orig/xulrunner/stub/Makefile.in	2008-03-12 08:32:26 +0900
+++ mozilla/xulrunner/stub/Makefile.in	2010-03-18 20:48:07 +0900
@@ -95,6 +95,7 @@
 
 ifdef _MSC_VER
 WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
+WIN7_MANIFEST = 1
 endif
 
 include $(topsrcdir)/config/rules.mk

