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

Ádám Kallai via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 24 07:03:59 PST 2025


================
@@ -4849,9 +5016,13 @@ void RewriteInstance::patchELFSectionHeaderTable(ELFObjectFile<ELFT> *File) {
   ELFEhdrTy NewEhdr = Obj.getHeader();
 
   if (BC->HasRelocations) {
-    if (RuntimeLibrary *RtLibrary = BC->getRuntimeLibrary())
+    RuntimeLibrary *RtLibrary = BC->getRuntimeLibrary();
+    if (RtLibrary && opts::RuntimeLibInitHook == opts::RLIH_ENTRY_POINT) {
----------------
kaadam wrote:

Elf e_entry takes precedence when an ELF file has _INTERP_ header. If an ELF file has no _INTERP_ header, and we run the bolt instrumentation with the default RuntimeLibInitHook value, Bolt prints this message even if for example init_array is used for hooking. Maybe an '!BC->HasInterpHeader' should be added here?

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


More information about the llvm-commits mailing list