Bug 1557570 - Make baseprofiler/core/shared-libraries-linux.cc compile on Android. r=glandium
authorMarkus Stange <mstange@themasta.com>
Tue, 17 Mar 2020 03:26:57 +0000
changeset 519093 e3d33877f9de9b50fe24577d14759e33c5086ebe
parent 519092 daf1993b5140b4106abdef8b22c9d184740b3c02
child 519094 fc259e08c46a2e6493fe9e3a35221ea14ce2876b
push id37222
push useropoprus@mozilla.com
push dateTue, 17 Mar 2020 16:13:04 +0000
treeherdermozilla-central@5100681103a8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1557570
milestone76.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 1557570 - Make baseprofiler/core/shared-libraries-linux.cc compile on Android. r=glandium Stop including "Linker.h" and always include <link.h> instead, which also comes with ElfW() and other things that this code needs. Also fix up "!/" path detection code. Differential Revision: https://phabricator.services.mozilla.com/D64997
mozglue/baseprofiler/core/shared-libraries-linux.cc
tools/profiler/core/shared-libraries-linux.cc
--- a/mozglue/baseprofiler/core/shared-libraries-linux.cc
+++ b/mozglue/baseprofiler/core/shared-libraries-linux.cc
@@ -30,19 +30,19 @@
 #  include <features.h>
 #  include <sys/mman.h>
 #  include <sys/stat.h>
 #  include <sys/types.h>
 #  include <vector>
 
 #  if defined(MOZ_LINKER)
 #    include "AutoObjectMapper.h"
-#    include "Linker.h"  // dl_phdr_info
-#  elif defined(GP_OS_linux) || defined(GP_OS_android)
-#    include <link.h>  // dl_phdr_info
+#  endif
+#  if defined(GP_OS_linux) || defined(GP_OS_android)
+#    include <link.h>  // dl_phdr_info, ElfW()
 #  else
 #    error "Unexpected configuration"
 #  endif
 
 #  if defined(GP_OS_android)
 extern "C" MOZ_EXPORT __attribute__((weak)) int dl_iterate_phdr(
     int (*callback)(struct dl_phdr_info* info, size_t size, void* data),
     void* data);
@@ -664,17 +664,17 @@ static std::string IDtoUUIDString(const 
 }
 
 // Get the breakpad Id for the binary file pointed by bin_name
 static std::string getId(const char* bin_name) {
   std::vector<uint8_t> identifier;
   identifier.reserve(kDefaultBuildIdSize);
 
 #  if defined(MOZ_LINKER)
-  if (nsDependentCString(bin_name).Find("!/") != kNotFound) {
+  if (std::string(bin_name).find(std::string("!/")) != std::string::npos) {
     AutoObjectMapperFaultyLib mapper(outputMapperLog);
     void* image = nullptr;
     size_t size = 0;
     if (mapper.Map(&image, &size, bin_name) && image && size) {
       if (FileID::ElfFileIdentifierFromMappedFile(image, identifier)) {
         return IDtoUUIDString(identifier);
       }
     }
--- a/tools/profiler/core/shared-libraries-linux.cc
+++ b/tools/profiler/core/shared-libraries-linux.cc
@@ -25,18 +25,18 @@
 #include "common/linux/file_id.h"
 #include <algorithm>
 #include <dlfcn.h>
 #include <features.h>
 #include <sys/types.h>
 
 #if defined(MOZ_LINKER)
 #  include "AutoObjectMapper.h"
-#  include "Linker.h"  // dl_phdr_info
-#elif defined(GP_OS_linux) || defined(GP_OS_android)
+#endif
+#if defined(GP_OS_linux) || defined(GP_OS_android)
 #  include <link.h>  // dl_phdr_info
 #else
 #  error "Unexpected configuration"
 #endif
 
 #if defined(GP_OS_android)
 extern "C" MOZ_EXPORT __attribute__((weak)) int dl_iterate_phdr(
     int (*callback)(struct dl_phdr_info* info, size_t size, void* data),