[llvm] [BOLT] Skip out-of-range pending relocations (PR #116964)

Maksim Panchenko via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 17:15:26 PST 2024


================
@@ -165,11 +165,17 @@ void BinarySection::flushPendingRelocations(raw_pwrite_stream &OS,
     OS.pwrite(Patch.Bytes.data(), Patch.Bytes.size(),
               SectionFileOffset + Patch.Offset);
 
+  uint64_t SkippedPendingRelocations = 0;
   for (Relocation &Reloc : PendingRelocations) {
     uint64_t Value = Reloc.Addend;
     if (Reloc.Symbol)
       Value += Resolver(Reloc.Symbol);
 
+    if (!Relocation::canEncodeValue(Reloc.Type, Value,
----------------
maksfb wrote:

Agreed, we need a predicate for skipping. I.e. define a condition when it's safe to skip processing relocations.

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


More information about the llvm-commits mailing list