[llvm] [llvm-profgen] Support AArch64 BRBE branch profiles (PR #209769)

Sergey Shcherbinin via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 27 07:13:44 PDT 2026


================
@@ -362,17 +377,28 @@ template <class ELFT>
 void ProfiledBinary::setPreferredTextSegmentAddresses(const ELFFile<ELFT> &Obj,
                                                       StringRef FileName) {
   const auto &PhdrRange = unwrapOrError(Obj.program_headers(), FileName);
-  // FIXME: This should be the page size of the system running profiling.
-  // However such info isn't available at post-processing time, assuming
-  // 4K page now. Note that we don't use EXEC_PAGESIZE from <linux/param.h>
-  // because we may build the tools on non-linux.
-  uint64_t PageSize = 0x1000;
+  // FIXME: Read the page size from the perf.data header when available.
+  // Keep the default independent of the post-processing host so profiles can
+  // be processed on a system with a different page size.
+  // Note that we don't use EXEC_PAGESIZE from <linux/param.h> because we may
+  // build the tools on non-linux.
+  if (UseSystemPageSize && ProfPageSize.getNumOccurrences())
+    exitWithError(
+        "--page-size and --use-system-page-size cannot be used together");
+  uint64_t PageSize = UseSystemPageSize
+                          ? llvm::sys::Process::getPageSizeEstimate()
+                          : ProfPageSize;
+  if (!isPowerOf2_64(PageSize))
+    exitWithError("--page-size must be a power of two");
+  bool SeenFirstLoadableSegment = false;
----------------
SergeyShch01 wrote:

Yes - that's the PT_LOAD bug fix. I've split it out into #212258.

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


More information about the llvm-commits mailing list