@@ -80,6 +80,7 @@ namespace opts {
8080extern cl::list<std::string> HotTextMoveSections;
8181extern cl::opt<bool > Hugify;
8282extern cl::opt<bool > Instrument;
83+ extern cl::opt<uint32_t > InstrumentationSleepTime;
8384extern cl::opt<bool > KeepNops;
8485extern cl::opt<bool > Lite;
8586extern cl::list<std::string> ReorderData;
@@ -1497,6 +1498,10 @@ Error RewriteInstance::discoverRtFiniAddress() {
14971498 }
14981499
14991500 if (!BC->FiniArrayAddress || !BC->FiniArraySize ) {
1501+ // It is still possible to generate profile without fini hook if
1502+ // InstrumentationSleepTime is set
1503+ if (opts::InstrumentationSleepTime > 0 )
1504+ return Error::success ();
15001505 return createStringError (
15011506 std::errc::not_supported,
15021507 " Instrumentation needs either DT_FINI or DT_FINI_ARRAY" );
@@ -1597,6 +1602,13 @@ void RewriteInstance::updateRtFiniReloc() {
15971602 if (!RT || !RT->getRuntimeFiniAddress ())
15981603 return ;
15991604
1605+ // It is still possible to generate profile without fini hook if
1606+ // InstrumentationSleepTime is set
1607+ if ((!BC->FiniArrayAddress || !BC->FiniArraySize ) &&
1608+ opts::InstrumentationSleepTime > 0 ) {
1609+ return ;
1610+ }
1611+
16001612 assert (BC->FiniArrayAddress && BC->FiniArraySize &&
16011613 " inconsistent .fini_array state" );
16021614
0 commit comments