[PATCH] D114098: Use BinaryCacheRoot calling IsSharedObject()

Pavel Kosov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 17 08:28:50 PST 2021


kpdev42 created this revision.
kpdev42 added reviewers: cmatthews, thopre, danilaml.
kpdev42 added a project: LLVM.
Herald added a subscriber: dkolesnichenko.
kpdev42 requested review of this revision.

https://reviews.llvm.org/D110839 introduced BinaryCacheRoot.
It must be used calling IsSharedObject() too.

OS Laboratory, Huawei Russian Research Institute (Saint-Petersburg)


Repository:
  rLNT LNT

https://reviews.llvm.org/D114098

Files:
  lnt/testing/profile/cPerf.cpp


Index: lnt/testing/profile/cPerf.cpp
===================================================================
--- lnt/testing/profile/cPerf.cpp
+++ lnt/testing/profile/cPerf.cpp
@@ -132,7 +132,7 @@
 
 // Returns true if the ELF file given by filename
 // is a shared object (DYN).
-bool IsSharedObject(char *Fname) {
+bool IsSharedObject(std::string Fname) {
   // We replicate the first part of an ELF header here
   // so as not to rely on <elf.h>.
   struct PartialElfHeader {
@@ -141,7 +141,7 @@
   };
   const int ET_DYN = 3;
 
-  FILE *stream = fopen(Fname, "r");
+  FILE *stream = fopen(Fname.c_str(), "r");
   if (stream == NULL)
     return false;
 
@@ -664,7 +664,7 @@
     // EXEC ELF objects aren't relocated. DYN ones are,
     // so if it's a DYN object adjust by subtracting the
     // map base.
-    bool IsSO = IsSharedObject(E->filename);
+    bool IsSO = IsSharedObject(BinaryCacheRoot + std::string(E->filename));
     Maps.push_back({E->start, E->start + E->extent,
                     IsSO ? E->start - E->pgoff : 0, E->filename});
 
@@ -684,7 +684,7 @@
     // EXEC ELF objects aren't relocated. DYN ones are,
     // so if it's a DYN object adjust by subtracting the
     // map base.
-    bool IsSO = IsSharedObject(E->filename);
+    bool IsSO = IsSharedObject(BinaryCacheRoot + std::string(E->filename));
     Maps.push_back({E->start, E->start + E->extent,
                     IsSO ? E->start - E->pgoff : 0, E->filename});
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114098.387954.patch
Type: text/x-patch
Size: 1452 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211117/17a40231/attachment.bin>


More information about the llvm-commits mailing list