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

Paschalis Mpeis via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 20 04:56:33 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,
----------------
paschalis-mpeis wrote:

If some pending relocations are added for correctness reasons, and not for optimization (like the external-references opt), then we may need to mark them with a flag so we consider skipping only those.

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


More information about the llvm-commits mailing list