[PATCH] D103178: [CSSPGO][llvm-profgen] Allow multiple executable load segments.

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 1 12:58:05 PDT 2021


hoy added inline comments.


================
Comment at: llvm/tools/llvm-profgen/ProfiledBinary.cpp:149
+        // Segments will always be loaded at a page boundary.
+        PreferredBaseAddresses.push_back(Phdr.p_vaddr & ~(Phdr.p_align - 1U));
+        ExeSegmentOffsets.push_back(Phdr.p_offset & ~(Phdr.p_align - 1U));
----------------
wlei wrote:
> Could you teach me on the difference of `Phdr.p_vaddr` and `Phdr.p_offset`? why the MMP event's offset is supposed to be equal to the first `Phdr.p_offset`?
`p_vaddr` stands for the preferred base virtual address of the segment. `p_offset` is the offset of the segment from the start of the image. Mostly `p_vaddr - vaddr of first segment == p_offset`. However, they are sections that do not take physical space in an image, such as the .BSS section which contains zero values for some globals, but they will have an allocated space at runtime.  Sections after .BSS will have a mismatched vaddr and offset.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103178



More information about the llvm-commits mailing list