[llvm-branch-commits] [BOLT][NFCI] Fix return type of BC::getSignedValueAtAddress (PR #91664)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu May 9 14:51:06 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-bolt
Author: Amir Ayupov (aaupov)
<details>
<summary>Changes</summary>
getSignedValueAtAddress calls DataExtractor::getSigned which naturally
returns a signed value.
Test Plan: NFCI
---
Full diff: https://github.com/llvm/llvm-project/pull/91664.diff
3 Files Affected:
- (modified) bolt/include/bolt/Core/BinaryContext.h (+1-2)
- (modified) bolt/lib/Core/BinaryContext.cpp (+1-1)
- (modified) bolt/lib/Rewrite/LinuxKernelRewriter.cpp (+1-1)
``````````diff
diff --git a/bolt/include/bolt/Core/BinaryContext.h b/bolt/include/bolt/Core/BinaryContext.h
index 75765819ac464..4a59a581dfedb 100644
--- a/bolt/include/bolt/Core/BinaryContext.h
+++ b/bolt/include/bolt/Core/BinaryContext.h
@@ -1217,8 +1217,7 @@ class BinaryContext {
/// Return a signed value of \p Size stored at \p Address. The address has
/// to be a valid statically allocated address for the binary.
- ErrorOr<uint64_t> getSignedValueAtAddress(uint64_t Address,
- size_t Size) const;
+ ErrorOr<int64_t> getSignedValueAtAddress(uint64_t Address, size_t Size) const;
/// Special case of getUnsignedValueAtAddress() that uses a pointer size.
ErrorOr<uint64_t> getPointerAtAddress(uint64_t Address) const {
diff --git a/bolt/lib/Core/BinaryContext.cpp b/bolt/lib/Core/BinaryContext.cpp
index ad2eb18caf109..507b203ea9d8b 100644
--- a/bolt/lib/Core/BinaryContext.cpp
+++ b/bolt/lib/Core/BinaryContext.cpp
@@ -2212,7 +2212,7 @@ ErrorOr<uint64_t> BinaryContext::getUnsignedValueAtAddress(uint64_t Address,
return DE.getUnsigned(&ValueOffset, Size);
}
-ErrorOr<uint64_t> BinaryContext::getSignedValueAtAddress(uint64_t Address,
+ErrorOr<int64_t> BinaryContext::getSignedValueAtAddress(uint64_t Address,
size_t Size) const {
const ErrorOr<const BinarySection &> Section = getSectionForAddress(Address);
if (!Section)
diff --git a/bolt/lib/Rewrite/LinuxKernelRewriter.cpp b/bolt/lib/Rewrite/LinuxKernelRewriter.cpp
index 99775ccfe38d3..b2c8b2446f7e1 100644
--- a/bolt/lib/Rewrite/LinuxKernelRewriter.cpp
+++ b/bolt/lib/Rewrite/LinuxKernelRewriter.cpp
@@ -393,7 +393,7 @@ void LinuxKernelRewriter::processLKKSymtab(bool IsGPL) {
for (uint64_t I = 0; I < SectionSize; I += 4) {
const uint64_t EntryAddress = SectionAddress + I;
- ErrorOr<uint64_t> Offset = BC.getSignedValueAtAddress(EntryAddress, 4);
+ ErrorOr<int64_t> Offset = BC.getSignedValueAtAddress(EntryAddress, 4);
assert(Offset && "Reading valid PC-relative offset for a ksymtab entry");
const int32_t SignedOffset = *Offset;
const uint64_t RefAddress = EntryAddress + SignedOffset;
``````````
</details>
https://github.com/llvm/llvm-project/pull/91664
More information about the llvm-branch-commits
mailing list