[llvm] [llvm-profgen] Handle perf mmaps with page sizes larger than 4 KiB (PR #217887)

via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 30 16:18:54 PDT 2026


================
@@ -594,30 +594,42 @@ void PerfScriptReader::updateBinaryAddress(const MMapEvent &Event) {
   if (PIDFilter && Event.PID != *PIDFilter)
     return;
 
-  // Drop the event if its image is loaded at the same address
-  if (Event.Address == Binary->getBaseAddress()) {
-    Binary->setIsLoadedByMMap(true);
-    return;
-  }
+  // Check if the target file offset is covered by the mmap event.
+  auto MMapContainsFileOffset = [&](uint64_t FileOffset) {
+    return Event.Offset == FileOffset ||
+           (Event.MemProtectionFlag.contains("x") &&
----------------
HighW4y2H3ll wrote:

Can you double check on the `MemProtectionFlag`? I don't have `x` on my end for kernel `_text` section. maybe we don't need to enforce page prot here?

https://github.com/llvm/llvm-project/pull/217887


More information about the llvm-commits mailing list