@@ -81,6 +81,7 @@ extern cl::list<std::string> HotTextMoveSections;
8181extern cl::opt<bool > Hugify;
8282extern cl::opt<bool > Instrument;
8383extern cl::opt<bool > InstrumentNoUseEntryPoint;
84+ extern cl::opt<uint32_t > InstrumentationSleepTime;
8485extern cl::opt<bool > KeepNops;
8586extern cl::opt<bool > Lite;
8687extern cl::list<std::string> ReorderData;
@@ -1470,6 +1471,10 @@ Error RewriteInstance::discoverRtFiniAddress() {
14701471 }
14711472
14721473 if (!BC->FiniArrayAddress || !BC->FiniArraySize ) {
1474+ // It is still possible to generate profile without fini hook if
1475+ // InstrumentationSleepTime is set
1476+ if (opts::InstrumentationSleepTime > 0 )
1477+ return Error::success ();
14731478 return createStringError (
14741479 std::errc::not_supported,
14751480 " Instrumentation needs either DT_FINI or DT_FINI_ARRAY" );
@@ -1560,6 +1565,13 @@ void RewriteInstance::updateRtFiniReloc() {
15601565 if (!RT || !RT->getRuntimeFiniAddress ())
15611566 return ;
15621567
1568+ // It is still possible to generate profile without fini hook if
1569+ // InstrumentationSleepTime is set
1570+ if ((!BC->FiniArrayAddress || !BC->FiniArraySize ) &&
1571+ opts::InstrumentationSleepTime > 0 ) {
1572+ return ;
1573+ }
1574+
15631575 assert (BC->FiniArrayAddress && BC->FiniArraySize &&
15641576 " inconsistent .fini_array state" );
15651577
0 commit comments