Skip to content

Commit 40cb83a

Browse files
author
Pavel Kosov
committed
Use BinaryCacheRoot calling IsSharedObject()
https://reviews.llvm.org/D110839 introduced BinaryCacheRoot. It must be used calling IsSharedObject() too. OS Laboratory, Huawei Russian Research Institute (Saint-Petersburg) Reviewed By: thopre, danilaml Differential Revision: https://reviews.llvm.org/D114098
1 parent 76b5400 commit 40cb83a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lnt/testing/profile/cPerf.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ void Assert(bool Expr, const char *ExprStr, const char *File, int Line) {
132132

133133
// Returns true if the ELF file given by filename
134134
// is a shared object (DYN).
135-
bool IsSharedObject(char *Fname) {
135+
bool IsSharedObject(const std::string &Fname) {
136136
// We replicate the first part of an ELF header here
137137
// so as not to rely on <elf.h>.
138138
struct PartialElfHeader {
@@ -141,7 +141,7 @@ bool IsSharedObject(char *Fname) {
141141
};
142142
const int ET_DYN = 3;
143143

144-
FILE *stream = fopen(Fname, "r");
144+
FILE *stream = fopen(Fname.c_str(), "r");
145145
if (stream == NULL)
146146
return false;
147147

@@ -664,7 +664,7 @@ unsigned char *PerfReader::readEvent(unsigned char *Buf) {
664664
// EXEC ELF objects aren't relocated. DYN ones are,
665665
// so if it's a DYN object adjust by subtracting the
666666
// map base.
667-
bool IsSO = IsSharedObject(E->filename);
667+
bool IsSO = IsSharedObject(BinaryCacheRoot + std::string(E->filename));
668668
Maps.push_back({E->start, E->start + E->extent,
669669
IsSO ? E->start - E->pgoff : 0, E->filename});
670670

@@ -684,7 +684,7 @@ unsigned char *PerfReader::readEvent(unsigned char *Buf) {
684684
// EXEC ELF objects aren't relocated. DYN ones are,
685685
// so if it's a DYN object adjust by subtracting the
686686
// map base.
687-
bool IsSO = IsSharedObject(E->filename);
687+
bool IsSO = IsSharedObject(BinaryCacheRoot + std::string(E->filename));
688688
Maps.push_back({E->start, E->start + E->extent,
689689
IsSO ? E->start - E->pgoff : 0, E->filename});
690690

0 commit comments

Comments
 (0)