[llvm] [profgen] Use a 64bit integer for &'ing the loadable address (PR #79930)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 29 17:46:32 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-pgo

Author: Nathan Lanza (lanza)

<details>
<summary>Changes</summary>

For the linux kernel, the loadable segments start at 0xffff... and thus the 32 bit integer here was truncating all the meaningful bits. Grow it to 64 bits.

---
Full diff: https://github.com/llvm/llvm-project/pull/79930.diff


1 Files Affected:

- (modified) llvm/tools/llvm-profgen/ProfiledBinary.cpp (+1-1) 


``````````diff
diff --git a/llvm/tools/llvm-profgen/ProfiledBinary.cpp b/llvm/tools/llvm-profgen/ProfiledBinary.cpp
index b40c5f8cbbe068..f62228627b8f1e 100644
--- a/llvm/tools/llvm-profgen/ProfiledBinary.cpp
+++ b/llvm/tools/llvm-profgen/ProfiledBinary.cpp
@@ -317,7 +317,7 @@ void ProfiledBinary::setPreferredTextSegmentAddresses(const ELFFile<ELFT> &Obj,
   // 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.
-  uint32_t PageSize = 0x1000;
+  uint64_t PageSize = 0x1000;
   for (const typename ELFT::Phdr &Phdr : PhdrRange) {
     if (Phdr.p_type == ELF::PT_LOAD) {
       if (!FirstLoadableAddress)

``````````

</details>


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


More information about the llvm-commits mailing list