================ @@ -174,11 +175,31 @@ 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); + // Safely skip any optional pending relocation that cannot be encoded. + if (Reloc.isOptional() && + !Relocation::canEncodeValue(Reloc.Type, Value, + SectionAddress + Reloc.Offset)) { + + // A successful run of 'scanExternalRefs' means that all pending + // relocations are flushed. Otherwise, PatchEntries should run. + if (!opts::ForcePatch) { + BC.errs() + << "BOLT-ERROR: Cannot fully run scanExternalRefs as pending " + "relocation for symbol " ---------------- maksfb wrote:
Let's rephrase the message in a more user-oriented way, i.e. drop `scanExternalRefs()`. https://github.com/llvm/llvm-project/pull/116964 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits