From 8cb3e2ae8d34c5488a2fb242c28520ebf7e6a8e6 Mon Sep 17 00:00:00 2001 From: wjx Date: Mon, 15 Dec 2025 11:32:20 +0800 Subject: [PATCH] [Sample Profile] make page size configurable for ProfiledBinary --- llvm/tools/llvm-profgen/ProfiledBinary.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/llvm/tools/llvm-profgen/ProfiledBinary.cpp b/llvm/tools/llvm-profgen/ProfiledBinary.cpp index 632ddc7b50f5..35187c409f6e 100644 --- a/llvm/tools/llvm-profgen/ProfiledBinary.cpp +++ b/llvm/tools/llvm-profgen/ProfiledBinary.cpp @@ -60,6 +60,11 @@ static cl::opt KernelBinary("kernel", cl::desc("Generate the profile for Linux kernel binary.")); +static cl::opt + Pagesize("page-size", + cl::desc("page size"), cl::init(0x1000), + cl::desc("target system pagee size.")); + extern cl::opt ShowDetailedWarning; extern cl::opt InferMissingFrames; @@ -326,7 +331,7 @@ void ProfiledBinary::setPreferredTextSegmentAddresses(const ELFFile &Obj, // However such info isn't available at post-processing time, assuming // 4K page now. Note that we don't use EXEC_PAGESIZE from // because we may build the tools on non-linux. - uint64_t PageSize = 0x1000; + uint64_t PageSize = Pagesize; for (const typename ELFT::Phdr &Phdr : PhdrRange) { if (Phdr.p_type == ELF::PT_LOAD) { if (!FirstLoadableAddress) -- Gitee