[llvm] [llvm-objcopy][llvm-mt] Support updating the resources of PE images (PR #225163)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 05:31:01 PDT 2026


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 origin/main HEAD --extensions h,cpp -- llvm/include/llvm/ObjCopy/COFF/COFFConfig.h llvm/include/llvm/Object/COFF.h llvm/include/llvm/Object/WindowsResource.h llvm/lib/ObjCopy/COFF/COFFObjcopy.cpp llvm/lib/ObjCopy/COFF/COFFObject.cpp llvm/lib/ObjCopy/COFF/COFFObject.h llvm/lib/ObjCopy/COFF/COFFWriter.cpp llvm/lib/ObjCopy/ConfigManager.cpp llvm/lib/Object/COFFObjectFile.cpp llvm/lib/Object/WindowsResource.cpp llvm/tools/llvm-mt/llvm-mt.cpp llvm/tools/llvm-objcopy/ObjcopyOptions.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/llvm/lib/ObjCopy/COFF/COFFObjcopy.cpp b/llvm/lib/ObjCopy/COFF/COFFObjcopy.cpp
index 004617dcc..349a15f69 100644
--- a/llvm/lib/ObjCopy/COFF/COFFObjcopy.cpp
+++ b/llvm/lib/ObjCopy/COFF/COFFObjcopy.cpp
@@ -405,8 +405,9 @@ static Error handleResources(const COFFConfig &COFFConfig,
     uint64_t ResourcesEnd =
         uint64_t(Offset) + Obj.DataDirectories[RESOURCE_TABLE].Size;
     if (ResourcesEnd < OldContents.size() &&
-        !llvm::all_of(OldContents.drop_front(ResourcesEnd),
-                      [](uint8_t Byte) { return Byte == 0; }))
+        !llvm::all_of(
+            OldContents.drop_front(ResourcesEnd),
+            [](uint8_t Byte) { return Byte == 0; }))
       return createStringError(errc::invalid_argument,
                                "section '%s' contains data after its "
                                "resources that cannot be preserved",

``````````

</details>


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


More information about the llvm-commits mailing list