Merge m-c to b-s.
authorKyle Huey <khuey@kylehuey.com>
Mon, 01 Aug 2011 08:06:23 -0400
changeset 73558 2cdff940a6c86f817688cfb2ceb0779400bd34ce
parent 73552 f92e021f1f44f0d15b109a47453a7fad5e449f08 (current diff)
parent 73557 d0978a2e87fd099e51cc04df3fdb21d7647f2f2c (diff)
child 73559 030c419226ed013199d59b9049c7e2e09e933f04
push idunknown
push userunknown
push dateunknown
milestone8.0a1
Merge m-c to b-s.
configure.in
js/src/configure.in
--- a/build/manifestparser.py
+++ b/build/manifestparser.py
@@ -50,20 +50,20 @@ Mozilla universal manifest parser
 
 import os
 import re
 import shutil
 import sys
 from fnmatch import fnmatch
 from optparse import OptionParser
 
-version = '0.5.2' # package version
+version = '0.5.3' # package version
 try:
     from setuptools import setup
-except ImportError:
+except:
     setup = None
 
 # we need relpath, but it is introduced in python 2.6
 # http://docs.python.org/library/os.path.html
 try:
     relpath = os.path.relpath
 except AttributeError:
     def relpath(path, start):
--- a/configure.in
+++ b/configure.in
@@ -4282,18 +4282,21 @@ AC_CACHE_CHECK(for trouble comparing to 
                                [Foo<int> f; return (0 != f);],
                                ac_cv_trouble_comparing_to_zero=no,
                                ac_cv_trouble_comparing_to_zero=yes)])
 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
 fi
 
 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
+# We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
+# enabled, the linker in xcode 4.1 will crash. Without this it would crash when
+# linking XUL.
 _SAVE_LDFLAGS=$LDFLAGS
-LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
+LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
 AC_CACHE_CHECK(for __thread keyword for TLS variables,
                ac_cv_thread_keyword,
                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
                             [return tlsIsMainThread;],
                             ac_cv_thread_keyword=yes,
                             ac_cv_thread_keyword=no)])
 LDFLAGS=$_SAVE_LDFLAGS
 if test "$ac_cv_thread_keyword" = yes; then
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -4197,18 +4197,21 @@ AC_CACHE_CHECK(for trouble comparing to 
                                [Foo<int> f; return (0 != f);],
                                ac_cv_trouble_comparing_to_zero=no,
                                ac_cv_trouble_comparing_to_zero=yes)])
 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
 fi
 
 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
+# We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
+# enabled, the linker in xcode 4.1 will crash. Without this it would crash when
+# linking XUL.
 _SAVE_LDFLAGS=$LDFLAGS
-LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
+LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
 AC_CACHE_CHECK(for __thread keyword for TLS variables,
                ac_cv_thread_keyword,
                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
                             [return tlsIsMainThread;],
                             ac_cv_thread_keyword=yes,
                             ac_cv_thread_keyword=no)])
 LDFLAGS=$_SAVE_LDFLAGS
 if test "$ac_cv_thread_keyword" = yes; then
--- a/toolkit/crashreporter/google-breakpad/src/client/mac/handler/minidump_generator.cc
+++ b/toolkit/crashreporter/google-breakpad/src/client/mac/handler/minidump_generator.cc
@@ -28,26 +28,30 @@
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #include <algorithm>
 #include <cstdio>
 
 #include <mach/host_info.h>
 #include <mach/i386/thread_status.h>
 #include <mach/mach_vm.h>
-#include <mach/ppc/thread_status.h>
 #include <mach/vm_statistics.h>
 #include <mach-o/dyld.h>
 #include <mach-o/loader.h>
 #include <sys/sysctl.h>
 #include <sys/resource.h>
 
 #include <CoreFoundation/CoreFoundation.h>
 
 #include "client/mac/handler/minidump_generator.h"
+
+#ifdef HAS_PPC_SUPPORT
+#include <mach/ppc/thread_status.h>
+#endif
+
 #include "client/minidump_file_writer-inl.h"
 #include "common/mac/file_id.h"
 #include "common/mac/string_utilities.h"
 
 using MacStringUtils::ConvertToString;
 using MacStringUtils::IntegerValueAtIndex;
 
 namespace google_breakpad {
@@ -331,62 +335,69 @@ bool MinidumpGenerator::WriteStackFromSt
   stack_location->memory = memory.location();
 
   return result;
 }
 
 bool MinidumpGenerator::WriteStack(breakpad_thread_state_data_t state,
                                    MDMemoryDescriptor *stack_location) {
   switch (cpu_type_) {
+#ifdef HAS_PPC_SUUPORT
     case CPU_TYPE_POWERPC:
       return WriteStackPPC(state, stack_location);
     case CPU_TYPE_POWERPC64:
       return WriteStackPPC64(state, stack_location);
+#endif
     case CPU_TYPE_I386:
       return WriteStackX86(state, stack_location);
     case CPU_TYPE_X86_64:
       return WriteStackX86_64(state, stack_location);
     default:
       return false;
   }
 }
 
 bool MinidumpGenerator::WriteContext(breakpad_thread_state_data_t state,
                                      MDLocationDescriptor *register_location) {
   switch (cpu_type_) {
+#ifdef HAS_PPC_SUPPORT
     case CPU_TYPE_POWERPC:
       return WriteContextPPC(state, register_location);
     case CPU_TYPE_POWERPC64:
       return WriteContextPPC64(state, register_location);
+#endif
     case CPU_TYPE_I386:
       return WriteContextX86(state, register_location);
     case CPU_TYPE_X86_64:
       return WriteContextX86_64(state, register_location);
     default:
       return false;
   }
 }
 
 u_int64_t MinidumpGenerator::CurrentPCForStack(
     breakpad_thread_state_data_t state) {
   switch (cpu_type_) {
+#ifdef HAS_PPC_SUPPORT
     case CPU_TYPE_POWERPC:
       return CurrentPCForStackPPC(state);
     case CPU_TYPE_POWERPC64:
       return CurrentPCForStackPPC64(state);
+#endif
     case CPU_TYPE_I386:
       return CurrentPCForStackX86(state);
     case CPU_TYPE_X86_64:
       return CurrentPCForStackX86_64(state);
     default:
       assert("Unknown CPU type!");
       return 0;
   }
 }
 
+#ifdef HAS_PCC_SUPPORT
 bool MinidumpGenerator::WriteStackPPC(breakpad_thread_state_data_t state,
                                       MDMemoryDescriptor *stack_location) {
   ppc_thread_state_t *machine_state =
       reinterpret_cast<ppc_thread_state_t *>(state);
   mach_vm_address_t start_addr = REGISTER_FROM_THREADSTATE(machine_state, r1);
   return WriteStackFromStartAddress(start_addr, stack_location);
 }
 
@@ -534,16 +545,18 @@ bool MinidumpGenerator::WriteContextPPC6
   AddGPR(30);
   AddGPR(31);
 #undef AddReg
 #undef AddGPR
 
   return true;
 }
 
+#endif
+
 bool MinidumpGenerator::WriteStackX86(breakpad_thread_state_data_t state,
                                    MDMemoryDescriptor *stack_location) {
   i386_thread_state_t *machine_state =
       reinterpret_cast<i386_thread_state_t *>(state);
 
   mach_vm_address_t start_addr = REGISTER_FROM_THREADSTATE(machine_state, esp);
   return WriteStackFromStartAddress(start_addr, stack_location);
 }
@@ -658,22 +671,24 @@ bool MinidumpGenerator::WriteContextX86_
   return true;
 }
 
 bool MinidumpGenerator::GetThreadState(thread_act_t target_thread,
                                        thread_state_t state,
                                        mach_msg_type_number_t *count) {
   thread_state_flavor_t flavor;
   switch (cpu_type_) {
+#ifdef HAS_PPC_SUPPORT
     case CPU_TYPE_POWERPC:
       flavor = PPC_THREAD_STATE;
       break;
     case CPU_TYPE_POWERPC64:
       flavor = PPC_THREAD_STATE64;
       break;
+#endif
     case CPU_TYPE_I386:
       flavor = i386_THREAD_STATE;
       break;
     case CPU_TYPE_X86_64:
       flavor = x86_THREAD_STATE64;
       break;
     default:
       return false;
--- a/toolkit/crashreporter/google-breakpad/src/client/mac/handler/minidump_generator.h
+++ b/toolkit/crashreporter/google-breakpad/src/client/mac/handler/minidump_generator.h
@@ -38,16 +38,20 @@
 
 #include "client/minidump_file_writer.h"
 #include "common/memory.h"
 #include "common/mac/macho_utilities.h"
 #include "google_breakpad/common/minidump_format.h"
 
 #include "dynamic_images.h"
 
+#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7
+  #define HAS_PPC_SUPPORT
+#endif
+
 namespace google_breakpad {
 
 using std::string;
 
 const u_int64_t TOP_OF_THREAD0_STACK_64BIT = 0x00007fff5fbff000LL;
 const u_int32_t TOP_OF_THREAD0_STACK_32BIT = 0xbffff000;
 
 // Use the REGISTER_FROM_THREADSTATE to access a register name from the
@@ -123,26 +127,28 @@ class MinidumpGenerator {
   bool WriteThreadStream(mach_port_t thread_id, MDRawThread *thread);
   bool WriteCVRecord(MDRawModule *module, int cpu_type, 
                      const char *module_path);
   bool WriteModuleStream(unsigned int index, MDRawModule *module);
   size_t CalculateStackSize(mach_vm_address_t start_addr);
   int  FindExecutableModule();
 
   // Per-CPU implementations of these methods
+#ifdef HAS_PPC_SUPPORT
   bool WriteStackPPC(breakpad_thread_state_data_t state,
                      MDMemoryDescriptor *stack_location);
   bool WriteContextPPC(breakpad_thread_state_data_t state,
                        MDLocationDescriptor *register_location);
   u_int64_t CurrentPCForStackPPC(breakpad_thread_state_data_t state);
   bool WriteStackPPC64(breakpad_thread_state_data_t state,
                        MDMemoryDescriptor *stack_location);
   bool WriteContextPPC64(breakpad_thread_state_data_t state,
                        MDLocationDescriptor *register_location);
   u_int64_t CurrentPCForStackPPC64(breakpad_thread_state_data_t state);
+#endif
   bool WriteStackX86(breakpad_thread_state_data_t state,
                        MDMemoryDescriptor *stack_location);
   bool WriteContextX86(breakpad_thread_state_data_t state,
                        MDLocationDescriptor *register_location);
   u_int64_t CurrentPCForStackX86(breakpad_thread_state_data_t state);
   bool WriteStackX86_64(breakpad_thread_state_data_t state,
                         MDMemoryDescriptor *stack_location);
   bool WriteContextX86_64(breakpad_thread_state_data_t state,
--- a/xpcom/typelib/xpt/tools/xpt.py
+++ b/xpcom/typelib/xpt/tools/xpt.py
@@ -1113,57 +1113,60 @@ class Typelib(object):
             for m in i.methods:
                 for n, p in enumerate(m.params):
                     if isinstance(p, InterfaceType) and \
                         p.iface not in self.interfaces:
                         raise DataError, "Interface method %s::%s, parameter %d references interface %s not present in typelib!" % (i.name, m.name, n, p.iface.name)
                 if isinstance(m.result, InterfaceType) and m.result.iface not in self.interfaces:
                     raise DataError, "Interface method %s::%s, result references interface %s not present in typelib!" % (i.name, m.name, m.result.iface.name)
 
+    def writefd(self, fd):
+        # write out space for a header + one empty annotation,
+        # padded to 4-byte alignment.
+        headersize = (Typelib._header.size + 1)
+        if headersize % 4:
+            headersize += 4 - headersize % 4
+        fd.write("\x00" * headersize)
+        # save this offset, it's the interface directory offset.
+        interface_directory_offset = fd.tell()
+        # write out space for an interface directory
+        fd.write("\x00" * Interface._direntry.size * len(self.interfaces))
+        # save this offset, it's the data pool offset.
+        data_pool_offset = fd.tell()
+        # write out all the interface descriptors to the data pool
+        for i in self.interfaces:
+            i.write_names(fd, data_pool_offset)
+            i.write(self, fd, data_pool_offset)
+        # now, seek back and write the header
+        file_len = fd.tell()
+        fd.seek(0)
+        fd.write(Typelib._header.pack(XPT_MAGIC,
+                                      TYPELIB_VERSION[0],
+                                      TYPELIB_VERSION[1],
+                                      len(self.interfaces),
+                                      file_len,
+                                      interface_directory_offset,
+                                      data_pool_offset))
+        # write an empty annotation
+        fd.write(struct.pack(">B", 0x80))
+        # now write the interface directory
+        #XXX: bug-compatible with existing xpt lib, put it one byte
+        # ahead of where it's supposed to be.
+        fd.seek(interface_directory_offset - 1)
+        for i in self.interfaces:
+            i.write_directory_entry(fd)
+
     def write(self, filename):
         """
         Write the contents of this typelib to the file named |filename|.
 
         """
         self._sanityCheck()
         with open(filename, "wb") as f:
-            # write out space for a header + one empty annotation,
-            # padded to 4-byte alignment.
-            headersize = (Typelib._header.size + 1)
-            if headersize % 4:
-                headersize += 4 - headersize % 4
-            f.write("\x00" * headersize)
-            # save this offset, it's the interface directory offset.
-            interface_directory_offset = f.tell()
-            # write out space for an interface directory
-            f.write("\x00" * Interface._direntry.size * len(self.interfaces))
-            # save this offset, it's the data pool offset.
-            data_pool_offset = f.tell()
-            # write out all the interface descriptors to the data pool
-            for i in self.interfaces:
-                i.write_names(f, data_pool_offset)
-                i.write(self, f, data_pool_offset)
-            # now, seek back and write the header
-            file_len = f.tell()
-            f.seek(0)
-            f.write(Typelib._header.pack(XPT_MAGIC,
-                                         TYPELIB_VERSION[0],
-                                         TYPELIB_VERSION[1],
-                                         len(self.interfaces),
-                                         file_len,
-                                         interface_directory_offset,
-                                         data_pool_offset))
-            # write an empty annotation
-            f.write(struct.pack(">B", 0x80))
-            # now write the interface directory
-            #XXX: bug-compatible with existing xpt lib, put it one byte
-            # ahead of where it's supposed to be.
-            f.seek(interface_directory_offset - 1)
-            for i in self.interfaces:
-                i.write_directory_entry(f)
+            self.writefd(f)
 
     def merge(self, other, sanitycheck=True):
         """
         Merge the contents of Typelib |other| into this typelib.
         If |sanitycheck| is False, don't sort the interface table
         after merging.
 
         """