[llvm] [BOLT] Support runtime library hook via DT_INIT_ARRAY (PR #167467)

Vasily Leonenko via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 25 07:43:48 PST 2025


================
@@ -294,6 +295,28 @@ cl::bits<GadgetScannerKind> GadgetScannersToRun(
         clEnumValN(GS_ALL, "all", "All implemented scanners")),
     cl::ZeroOrMore, cl::CommaSeparated, cl::cat(BinaryAnalysisCategory));
 
+// Primary targets for hooking runtime library initialization hooking
+// with fallback to next item in case if current item is not available
+// in the input binary.
+enum RuntimeLibInitHookTarget : char {
+  RLIH_ENTRY_POINT = 0, /// Use ELF Header Entry Point
+  RLIH_INIT = 1,        /// Use ELF DT_INIT entry
+  RLIH_INIT_ARRAY = 2,  /// Use ELF 1st entry of .init_array
+};
+
+cl::opt<RuntimeLibInitHookTarget> RuntimeLibInitHook(
----------------
vleonen wrote:

Done, switched this option to Hidden

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


More information about the llvm-commits mailing list