[llvm] [llvm-objcopy] Apply encryptable offset to first segment, not section (PR #130517)

via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 9 14:18:45 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 df570dadcb93a32c308d31c2ab54d2f46c8ae0c0 cc61c283640a43dbbb8d22c6eab9d35380802296 --extensions cpp -- llvm/lib/ObjCopy/MachO/MachOLayoutBuilder.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/ObjCopy/MachO/MachOLayoutBuilder.cpp b/llvm/lib/ObjCopy/MachO/MachOLayoutBuilder.cpp
index 91f73b59db..d2c47ca94e 100644
--- a/llvm/lib/ObjCopy/MachO/MachOLayoutBuilder.cpp
+++ b/llvm/lib/ObjCopy/MachO/MachOLayoutBuilder.cpp
@@ -118,7 +118,8 @@ uint64_t MachOLayoutBuilder::layoutSegments() {
   uint64_t Offset = IsObjectFile ? (HeaderSize + O.Header.SizeOfCmds) : 0;
   // If we are emitting an encryptable binary, our load commands must have a
   // separate (non-encrypted) page to themselves.
-  bool FirstSectExtraEncryptableOffset = O.EncryptionInfoCommandIndex.has_value();
+  bool FirstSectExtraEncryptableOffset =
+      O.EncryptionInfoCommandIndex.has_value();
   for (LoadCommand &LC : O.LoadCommands) {
     auto &MLC = LC.MachOLoadCommand;
     StringRef Segname;
@@ -173,7 +174,7 @@ uint64_t MachOLayoutBuilder::layoutSegments() {
           Sec->Offset = 0;
         } else {
           if (FirstSectExtraEncryptableOffset) {
-            SectOffset =  alignToPowerOf2(SectOffset, PageSize);
+            SectOffset = alignToPowerOf2(SectOffset, PageSize);
             FirstSectExtraEncryptableOffset = false;
           }
           Sec->Offset = SegOffset + SectOffset;

``````````

</details>


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


More information about the llvm-commits mailing list