[llvm] [llvm-objcopy] Fix unaligned `p_offset` after copy. (PR #79889)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 29 11:59:51 PST 2024
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 eac8d713a6682417d06f5ee7f90a8ce54a281df8 5e0e4a0e208cd8d6ad7f35de2527e764a2d394a5 -- llvm/lib/ObjCopy/ELF/ELFObject.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/ObjCopy/ELF/ELFObject.cpp b/llvm/lib/ObjCopy/ELF/ELFObject.cpp
index a2fb5f321a..f4f1dc3e11 100644
--- a/llvm/lib/ObjCopy/ELF/ELFObject.cpp
+++ b/llvm/lib/ObjCopy/ELF/ELFObject.cpp
@@ -2287,11 +2287,10 @@ static uint64_t layoutSegments(std::vector<Segment *> &Segments,
// already be set and we can set our offset relative to it.
if (Seg->ParentSegment != nullptr) {
Segment *Parent = Seg->ParentSegment;
- Seg->Offset =
- alignTo(Parent->Offset, SegAlign) + Seg->OriginalOffset - Parent->OriginalOffset;
+ Seg->Offset = alignTo(Parent->Offset, SegAlign) + Seg->OriginalOffset -
+ Parent->OriginalOffset;
} else {
- Seg->Offset =
- alignTo(Offset, SegAlign, Seg->VAddr);
+ Seg->Offset = alignTo(Offset, SegAlign, Seg->VAddr);
}
Offset = std::max(Offset, Seg->Offset + Seg->FileSize);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/79889
More information about the llvm-commits
mailing list