[llvm] [BOLT] Support runtime library hook via DT_INIT_ARRAY (PR #167467)
Maksim Panchenko via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 25 00:11:35 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(
----------------
maksfb wrote:
Do you consider this an "expert" option, i.e. only used by < 1% of the users? If so, let's make it `cl::Hidden`.
https://github.com/llvm/llvm-project/pull/167467
More information about the llvm-commits
mailing list