Skip to content

[LLDB][DYLD] Remove logic around not rebasing when main executable has a load address #110885

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 7, 2024

Conversation

Jlalond
Copy link
Contributor

@Jlalond Jlalond commented Oct 2, 2024

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.

@Jlalond Jlalond requested a review from JDevlieghere as a code owner October 2, 2024 16:52
@llvmbot llvmbot added the lldb label Oct 2, 2024
@llvmbot
Copy link
Member

llvmbot commented Oct 2, 2024

@llvm/pr-subscribers-lldb

Author: Jacob Lalonde (Jlalond)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/110885.diff

1 Files Affected:

  • (modified) lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp (-15)
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;

@Jlalond Jlalond force-pushed the posix-dyld-remove-rebase-noop branch from 6f409ea to 071b7fa Compare October 2, 2024 18:28
@Jlalond Jlalond requested a review from jeffreytan81 October 4, 2024 19:45
@Jlalond Jlalond merged commit 5d372ea into llvm:main Oct 7, 2024
7 checks passed
@Jlalond Jlalond deleted the posix-dyld-remove-rebase-noop branch March 7, 2025 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants