From 54dfaaf46ecab9fefcb2b65817c67b5a926464ae Mon Sep 17 00:00:00 2001 From: wjx Date: Mon, 15 Dec 2025 10:50:52 +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 4755f758a828..ec3577f1f6b6 100644 --- a/llvm/tools/llvm-profgen/ProfiledBinary.cpp +++ b/llvm/tools/llvm-profgen/ProfiledBinary.cpp @@ -55,6 +55,11 @@ static cl::list DisassembleFunctions( cl::desc("List of functions to print disassembly for. Accept demangled " "names only. Only work with show-disassembly-only")); +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; @@ -316,7 +321,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. - uint32_t PageSize = 0x1000; + uint32_t PageSize = Pagesize; for (const typename ELFT::Phdr &Phdr : PhdrRange) { if (Phdr.p_type == ELF::PT_LOAD) { if (!FirstLoadableAddress) -- Gitee