Bug 677897 - Use objcopy from the NDK in symbolstore.py. r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 06 Oct 2011 09:08:14 +0200
changeset 78201 348e1615398703badcb0dd1c819c91c9c75c934d
parent 78200 ac1d5e94097a71f4e0f58f99c28b72a7e125b9f7
child 78202 73fbf78ad335fe1983b5c8b5ce62886dd666492e
push id2428
push usermh@glandium.org
push dateThu, 06 Oct 2011 07:08:58 +0000
treeherdermozilla-inbound@348e16153987 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs677897
milestone10.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 677897 - Use objcopy from the NDK in symbolstore.py. r=ted
Makefile.in
config/autoconf.mk.in
configure.in
toolkit/crashreporter/tools/symbolstore.py
--- a/Makefile.in
+++ b/Makefile.in
@@ -167,16 +167,17 @@ buildsymbols:
 ifdef MOZ_CRASHREPORTER
 ifdef USE_ELF_HACK
 	$(MAKE) -C $(MOZ_BUILD_APP)/installer elfhack
 endif
 	echo building symbol store
 	$(RM) -r $(DIST)/crashreporter-symbols
 	$(RM) "$(DIST)/$(SYMBOL_ARCHIVE_BASENAME).zip"
 	$(NSINSTALL) -D $(DIST)/crashreporter-symbols
+	OBJCOPY="$(OBJCOPY)" \
 	$(PYTHON) $(topsrcdir)/toolkit/crashreporter/tools/symbolstore.py \
 	  $(MAKE_SYM_STORE_ARGS)                                          \
 	  $(foreach dir,$(SYM_STORE_SOURCE_DIRS),-s $(dir))               \
 	  $(DUMP_SYMS_BIN)                                                \
 	  $(DIST)/crashreporter-symbols                                   \
 	  $(MAKE_SYM_STORE_PATH) >                                        \
 	  $(DIST)/crashreporter-symbols/$(SYMBOL_INDEX_NAME)
 	echo packing symbols
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -411,16 +411,17 @@ TARGET_OS	= @TARGET_OS@
 TARGET_MD_ARCH	= @TARGET_MD_ARCH@
 TARGET_XPCOM_ABI = @TARGET_XPCOM_ABI@
 
 AUTOCONF	= @AUTOCONF@
 GMAKE		= @GMAKE@
 PERL		= @PERL@
 PYTHON		= @PYTHON@
 RANLIB		= @RANLIB@
+OBJCOPY		= @OBJCOPY@
 UNZIP		= @UNZIP@
 ZIP		= @ZIP@
 XARGS		= @XARGS@
 STRIP		= @STRIP@
 DOXYGEN		= @DOXYGEN@
 PBBUILD_BIN	= @PBBUILD@
 SDP		= @SDP@
 NSINSTALL_BIN	= @NSINSTALL_BIN@
--- a/configure.in
+++ b/configure.in
@@ -366,16 +366,17 @@ case "$target" in
     AS="$android_toolchain"/bin/"$android_tool_prefix"-as
     CC="$android_toolchain"/bin/"$android_tool_prefix"-gcc
     CXX="$android_toolchain"/bin/"$android_tool_prefix"-g++
     CPP="$android_toolchain"/bin/"$android_tool_prefix"-cpp
     LD="$android_toolchain"/bin/"$android_tool_prefix"-ld
     AR="$android_toolchain"/bin/"$android_tool_prefix"-ar
     RANLIB="$android_toolchain"/bin/"$android_tool_prefix"-ranlib
     STRIP="$android_toolchain"/bin/"$android_tool_prefix"-strip
+    OBJCOPY="$android_toolchain"/bin/"$android_tool_prefix"-objcopy
 
     case "${target_cpu}" in
     arm*)
       ANDROID_CPU_ARCH=armeabi-v7a
       ;;
     i?86)
       ANDROID_CPU_ARCH=x86
       ;;
@@ -438,24 +439,28 @@ case "$target" in
 
     AC_DEFINE(ANDROID)
     AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
     AC_SUBST(ANDROID_VERSION)
     CROSS_COMPILE=1
     MOZ_CHROME_FILE_FORMAT=omni
     ZLIB_DIR=yes
     ;;
+*-linux*)
+    AC_PATH_PROG(OBJCOPY,objcopy)
+    ;;
 esac
 
 AC_SUBST(ANDROID_NDK)
 AC_SUBST(ANDROID_TOOLCHAIN)
 AC_SUBST(ANDROID_PLATFORM)
 AC_SUBST(ANDROID_SDK)
 AC_SUBST(ANDROID_PLATFORM_TOOLS)
 AC_SUBST(ANDROID_PACKAGE_NAME)
+AC_SUBST(OBJCOPY)
 
 dnl ========================================================
 dnl Checks for compilers.
 dnl ========================================================
 dnl Set CROSS_COMPILE in the environment when running configure
 dnl to use the cross-compile setup for now
 dnl ========================================================
 
--- a/toolkit/crashreporter/tools/symbolstore.py
+++ b/toolkit/crashreporter/tools/symbolstore.py
@@ -629,32 +629,33 @@ class Dumper_Win32(Dumper):
             call([pdbstr, "-w", "-p:" + os.path.basename(debug_file),
                   "-i:" + os.path.basename(streamFilename), "-s:srcsrv"],
                  cwd=os.path.dirname(stream_output_path))
             # clean up all the .stream files when done
             os.remove(stream_output_path)
         return result
 
 class Dumper_Linux(Dumper):
+    objcopy = os.environ['OBJCOPY'] if 'OBJCOPY' in os.environ else 'objcopy'
     def ShouldProcess(self, file):
         """This function will allow processing of files that are
         executable, or end with the .so extension, and additionally
         file(1) reports as being ELF files.  It expects to find the file
         command in PATH."""
         if file.endswith(".so") or os.access(file, os.X_OK):
             return self.RunFileCommand(file).startswith("ELF")
         return False
 
     def CopyDebug(self, file, debug_file, guid):
         # We want to strip out the debug info, and add a
         # .gnu_debuglink section to the object, so the debugger can
         # actually load our debug info later.
         file_dbg = file + ".dbg"
-        if call(['objcopy', '--only-keep-debug', file, file_dbg]) == 0 and \
-           call(['objcopy', '--add-gnu-debuglink=%s' % file_dbg, file]) == 0:
+        if call([self.objcopy, '--only-keep-debug', file, file_dbg]) == 0 and \
+           call([self.objcopy, '--add-gnu-debuglink=%s' % file_dbg, file]) == 0:
             rel_path = os.path.join(debug_file,
                                     guid,
                                     debug_file + ".dbg")
             full_path = os.path.normpath(os.path.join(self.symbol_path,
                                                       rel_path))
             shutil.move(file_dbg, full_path)
             # gzip the shipped debug files
             os.system("gzip %s" % full_path)