[Lldb-commits] [lldb] [LLDB][DYLD] Remove logic around not rebasing when main executable has a load address (PR #110885)

Jacob Lalonde via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 2 09:53:05 PDT 2024


https://github.com/Jlalond created https://github.com/llvm/llvm-project/pull/110885

This is a part of #109477 that I'm making into it's own patch. Here we remove logic from the DYLD that prevents it's logic from running if the main executable already has a load address. Instead we let the DYLD fully determine what should be loaded and what shouldn't.

>From 5ed6e20b50f70754efbaa157720a7ef120bb6b1e Mon Sep 17 00:00:00 2001
From: Jacob Lalonde <jalalonde at fb.com>
Date: Wed, 2 Oct 2024 09:50:26 -0700
Subject: [PATCH] Remove additional logic to disable the dynamic loader when
 the main executable already has a load address

---
 .../POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp         | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
index 51e4b3e6728f23..b9c0e174c3be68 100644
--- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -108,21 +108,6 @@ void DynamicLoaderPOSIXDYLD::DidAttach() {
   // if we dont have a load address we cant re-base
   bool rebase_exec = load_offset != LLDB_INVALID_ADDRESS;
 
-  // if we have a valid executable
-  if (executable_sp.get()) {
-    lldb_private::ObjectFile *obj = executable_sp->GetObjectFile();
-    if (obj) {
-      // don't rebase if the module already has a load address
-      Target &target = m_process->GetTarget();
-      Address addr = obj->GetImageInfoAddress(&target);
-      if (addr.GetLoadAddress(&target) != LLDB_INVALID_ADDRESS)
-        rebase_exec = false;
-    }
-  } else {
-    // no executable, nothing to re-base
-    rebase_exec = false;
-  }
-
   // if the target executable should be re-based
   if (rebase_exec) {
     ModuleList module_list;



More information about the lldb-commits mailing list