[PATCH] D150335: [BOLT] Fix flush pending relocs
Rafael Auler via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 11 11:07:54 PDT 2023
rafauler updated this revision to Diff 521374.
rafauler added a comment.
clang-format
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150335/new/
https://reviews.llvm.org/D150335
Files:
bolt/include/bolt/Core/Relocation.h
bolt/lib/Core/BinarySection.cpp
bolt/lib/Core/Relocation.cpp
Index: bolt/lib/Core/Relocation.cpp
===================================================================
--- bolt/lib/Core/Relocation.cpp
+++ bolt/lib/Core/Relocation.cpp
@@ -262,10 +262,11 @@
return false;
}
-static uint64_t adjustValueX86(uint64_t Type, uint64_t Value, uint64_t PC) {
+static uint64_t encodeValueX86(uint64_t Type, uint64_t Value, uint64_t PC) {
switch (Type) {
default:
- llvm_unreachable("not supported relocation");
+ llvm_unreachable("unsupported relocation");
+ case ELF::R_X86_64_64:
case ELF::R_X86_64_32:
break;
case ELF::R_X86_64_PC32:
@@ -275,10 +276,10 @@
return Value;
}
-static uint64_t adjustValueAArch64(uint64_t Type, uint64_t Value, uint64_t PC) {
+static uint64_t encodeValueAArch64(uint64_t Type, uint64_t Value, uint64_t PC) {
switch (Type) {
default:
- llvm_unreachable("not supported relocation");
+ llvm_unreachable("unsupported relocation");
case ELF::R_AARCH64_ABS32:
break;
case ELF::R_AARCH64_PREL16:
@@ -566,11 +567,10 @@
return skipRelocationProcessX86(Type, Contents);
}
-uint64_t Relocation::adjustValue(uint64_t Type, uint64_t Value,
- uint64_t PC) {
+uint64_t Relocation::encodeValue(uint64_t Type, uint64_t Value, uint64_t PC) {
if (Arch == Triple::aarch64)
- return adjustValueAArch64(Type, Value, PC);
- return adjustValueX86(Type, Value, PC);
+ return encodeValueAArch64(Type, Value, PC);
+ return encodeValueX86(Type, Value, PC);
}
uint64_t Relocation::extractValue(uint64_t Type, uint64_t Contents,
Index: bolt/lib/Core/BinarySection.cpp
===================================================================
--- bolt/lib/Core/BinarySection.cpp
+++ bolt/lib/Core/BinarySection.cpp
@@ -146,7 +146,7 @@
if (Reloc.Symbol)
Value += Resolver(Reloc.Symbol);
- Value = Relocation::adjustValue(Reloc.Type, Value,
+ Value = Relocation::encodeValue(Reloc.Type, Value,
SectionAddress + Reloc.Offset);
OS.pwrite(reinterpret_cast<const char *>(&Value),
Index: bolt/include/bolt/Core/Relocation.h
===================================================================
--- bolt/include/bolt/Core/Relocation.h
+++ bolt/include/bolt/Core/Relocation.h
@@ -64,8 +64,7 @@
static bool skipRelocationProcess(uint64_t &Type, uint64_t Contents);
// Adjust value depending on relocation type (make it PC relative or not)
- static uint64_t adjustValue(uint64_t Type, uint64_t Value,
- uint64_t PC);
+ static uint64_t encodeValue(uint64_t Type, uint64_t Value, uint64_t PC);
/// Extract current relocated value from binary contents. This is used for
/// RISC architectures where values are encoded in specific bits depending
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150335.521374.patch
Type: text/x-patch
Size: 2772 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230511/d65fb9de/attachment.bin>
More information about the llvm-commits
mailing list