Skip to content

Commit c460e45

Browse files
authored
[BOLT][NFCI] Fix return type of BC::getSignedValueAtAddress (#91664)
1 parent c26847d commit c460e45

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

bolt/include/bolt/Core/BinaryContext.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,8 +1224,7 @@ class BinaryContext {
12241224

12251225
/// Return a signed value of \p Size stored at \p Address. The address has
12261226
/// to be a valid statically allocated address for the binary.
1227-
ErrorOr<uint64_t> getSignedValueAtAddress(uint64_t Address,
1228-
size_t Size) const;
1227+
ErrorOr<int64_t> getSignedValueAtAddress(uint64_t Address, size_t Size) const;
12291228

12301229
/// Special case of getUnsignedValueAtAddress() that uses a pointer size.
12311230
ErrorOr<uint64_t> getPointerAtAddress(uint64_t Address) const {

bolt/lib/Core/BinaryContext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2217,8 +2217,8 @@ ErrorOr<uint64_t> BinaryContext::getUnsignedValueAtAddress(uint64_t Address,
22172217
return DE.getUnsigned(&ValueOffset, Size);
22182218
}
22192219

2220-
ErrorOr<uint64_t> BinaryContext::getSignedValueAtAddress(uint64_t Address,
2221-
size_t Size) const {
2220+
ErrorOr<int64_t> BinaryContext::getSignedValueAtAddress(uint64_t Address,
2221+
size_t Size) const {
22222222
const ErrorOr<const BinarySection &> Section = getSectionForAddress(Address);
22232223
if (!Section)
22242224
return std::make_error_code(std::errc::bad_address);

bolt/lib/Rewrite/LinuxKernelRewriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ void LinuxKernelRewriter::processLKKSymtab(bool IsGPL) {
393393

394394
for (uint64_t I = 0; I < SectionSize; I += 4) {
395395
const uint64_t EntryAddress = SectionAddress + I;
396-
ErrorOr<uint64_t> Offset = BC.getSignedValueAtAddress(EntryAddress, 4);
396+
ErrorOr<int64_t> Offset = BC.getSignedValueAtAddress(EntryAddress, 4);
397397
assert(Offset && "Reading valid PC-relative offset for a ksymtab entry");
398398
const int32_t SignedOffset = *Offset;
399399
const uint64_t RefAddress = EntryAddress + SignedOffset;

0 commit comments

Comments
 (0)