[llvm] [BOLT] Support instrumentation hook via DT_FINI_ARRAY (PR #67348)

Job Noorman via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 01:05:52 PDT 2023


================
@@ -1276,6 +1280,60 @@ void RewriteInstance::discoverFileObjects() {
   registerFragments();
 }
 
+Error RewriteInstance::discoverFiniAddress() {
+  // If FiniFunctionAddress is already set, we got if from DT_FINI. We use
+  // DT_FINI instead of DT_FINI_ARRAY if it's available.
+  if (BC->FiniFunctionAddress)
+    return Error::success();
+
+  if (BC->IsStaticExecutable)
----------------
mtvec wrote:

> Is it because InstrumentationSleepTime is possible ?

Indeed. It also mimics how errors were generated before.

> Maybe we should still return error here and check for this option separately?

That makes sense, done!

https://github.com/llvm/llvm-project/pull/67348


More information about the llvm-commits mailing list