[llvm] [BOLT] Add --custom-allocation-vma flag (PR #136385)

via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 18 16:07:53 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- bolt/lib/Rewrite/RewriteInstance.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp
index 518c8150d..8fd65198c 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -237,12 +237,11 @@ UseGnuStack("use-gnu-stack",
   cl::ZeroOrMore,
   cl::cat(BoltCategory));
 
-static cl::opt<uint64_t>
-CustomAllocationVMA("custom-allocation-vma",
-           cl::desc("use a custom address at which new code will be put, "
-                    "bypassing BOLT's logic to detect where to put code"),
-  cl::ZeroOrMore,
-  cl::cat(BoltCategory));
+static cl::opt<uint64_t> CustomAllocationVMA(
+    "custom-allocation-vma",
+    cl::desc("use a custom address at which new code will be put, "
+             "bypassing BOLT's logic to detect where to put code"),
+    cl::ZeroOrMore, cl::cat(BoltCategory));
 
 static cl::opt<bool>
 SequentialDisassembly("sequential-disassembly",
@@ -607,14 +606,14 @@ Error RewriteInstance::discoverStorage() {
     // seems off.
     for (const ELF64LE::Phdr &Phdr : PHs) {
       switch (Phdr.p_type) {
-        case ELF::PT_LOAD:
-          if (NextAvailableAddress >= Phdr.p_vaddr &&
-              NextAvailableAddress < Phdr.p_vaddr + Phdr.p_memsz) {
-            BC->errs() << "BOLT-WARNING: user-supplied allocation vma 0x"
-                       << Twine::utohexstr(NextAvailableAddress)
-                       << " conflicts with ELF segment at 0x"
-                       << Twine::utohexstr(Phdr.p_vaddr) << "\n";
-          }
+      case ELF::PT_LOAD:
+        if (NextAvailableAddress >= Phdr.p_vaddr &&
+            NextAvailableAddress < Phdr.p_vaddr + Phdr.p_memsz) {
+          BC->errs() << "BOLT-WARNING: user-supplied allocation vma 0x"
+                     << Twine::utohexstr(NextAvailableAddress)
+                     << " conflicts with ELF segment at 0x"
+                     << Twine::utohexstr(Phdr.p_vaddr) << "\n";
+        }
       }
     }
   }

``````````

</details>


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


More information about the llvm-commits mailing list