Skip to content

Commit 1c199be

Browse files
Vasily Leonenkovleonen
authored andcommitted
[BOLT] Don't fail if instrumentation-sleep-time>0 and input binary don't have fini & fini_array
1 parent 857fec8 commit 1c199be

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ namespace opts {
8080
extern cl::list<std::string> HotTextMoveSections;
8181
extern cl::opt<bool> Hugify;
8282
extern cl::opt<bool> Instrument;
83+
extern cl::opt<uint32_t> InstrumentationSleepTime;
8384
extern cl::opt<bool> KeepNops;
8485
extern cl::opt<bool> Lite;
8586
extern cl::list<std::string> PrintOnly;
@@ -1501,6 +1502,10 @@ Error RewriteInstance::discoverRtFiniAddress() {
15011502
}
15021503

15031504
if (!BC->FiniArrayAddress || !BC->FiniArraySize) {
1505+
// It is still possible to generate profile without fini hook if
1506+
// InstrumentationSleepTime is set
1507+
if (opts::InstrumentationSleepTime > 0)
1508+
return Error::success();
15041509
return createStringError(
15051510
std::errc::not_supported,
15061511
"Instrumentation needs either DT_FINI or DT_FINI_ARRAY");
@@ -1601,6 +1606,13 @@ void RewriteInstance::updateRtFiniReloc() {
16011606
if (!RT || !RT->getRuntimeFiniAddress())
16021607
return;
16031608

1609+
// It is still possible to generate profile without fini hook if
1610+
// InstrumentationSleepTime is set
1611+
if ((!BC->FiniArrayAddress || !BC->FiniArraySize) &&
1612+
opts::InstrumentationSleepTime > 0) {
1613+
return;
1614+
}
1615+
16041616
assert(BC->FiniArrayAddress && BC->FiniArraySize &&
16051617
"inconsistent .fini_array state");
16061618

0 commit comments

Comments
 (0)