[Lldb-commits] [PATCH] D62501: Implement GetSharedLibraryInfoAddress

António Afonso via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 4 22:00:32 PDT 2019


aadsm marked an inline comment as done.
aadsm added inline comments.


================
Comment at: lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp:2122
+  size_t phdr_num_entries = *maybe_phdr_num_entries;
+  lldb::addr_t load_base = phdr_addr - sizeof(ELF_EHDR);
+
----------------
labath wrote:
> This innocent-looking line assumes that the program headers will be the very next thing coming after the elf header, and that the elf header will be contained in the lowest-located segment. Although they are usually true, neither of the two assumptions are really guaranteed.  I spent a bunch of time figuring out if there's a way to avoid that, but I haven't come up with anything... :/
Ah, I thought that was always true. I checked gdb and they're actually using the PT_PHDR entry (which gives the location of the program table itself) to calculate the relocation. We should probably do the same.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62501/new/

https://reviews.llvm.org/D62501





More information about the lldb-commits mailing list