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

Vasily Leonenko via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 24 12:46:15 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) {
----------------
vleonen wrote:

Instead of adding a `HasInterpHeader` check, I have decided to make an explicit correction to `RuntimeLibInitHook` in `adjustCommandLineOptions()'. Please let me know if this change is looks fine for you.

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


More information about the llvm-commits mailing list