[all-commits] [llvm/llvm-project] b0b960: [lldb][ObjectFileELF] Set ModuleSpec file offset a...

Kazuki Sakamoto via All-commits all-commits at lists.llvm.org
Tue Jun 20 15:19:42 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b0b9605a544dbf26940a48777af401a419f4e4f1
      https://github.com/llvm/llvm-project/commit/b0b9605a544dbf26940a48777af401a419f4e4f1
  Author: Kazuki Sakamoto <sakamoto at splhack.org>
  Date:   2023-06-20 (Tue, 20 Jun 2023)

  Changed paths:
    M lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
    M lldb/unittests/ObjectFile/ELF/CMakeLists.txt
    A lldb/unittests/ObjectFile/ELF/Inputs/liboffset-test.so
    A lldb/unittests/ObjectFile/ELF/Inputs/offset-test.bin
    M lldb/unittests/ObjectFile/ELF/TestObjectFileELF.cpp

  Log Message:
  -----------
  [lldb][ObjectFileELF] Set ModuleSpec file offset and size

In Android API level 23 and above, dynamic loader is able to load .so file
directly from APK.
https://android.googlesource.com/platform/bionic/+/master/
android-changes-for-ndk-developers.md#
opening-shared-libraries-directly-from-an-apk

ObjectFileELF::GetModuleSpecifications will load a .so file, which is page
aligned and uncompressed, directly from a zip file. However it does not
set the .so file offset and size to the ModuleSpec. Also crc32 calculation
uses more data than the .so file size.

Set the .so file offset and size to the ModuleSpec, and set the size to
MapFileData length argument. For normal file, file_offset should be zero,
and length should be the size of the file.

Differential Revision: https://reviews.llvm.org/D152757




More information about the All-commits mailing list