[llvm] [llvm-readobj][COFF] Implement --coff-pseudoreloc in llvm-readobj to dump runtime pseudo-relocation records (PR #151816)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 11 01:15:03 PDT 2025
================
@@ -2180,31 +2207,45 @@ void COFFDumper::printCOFFPseudoReloc() {
DenseMap<uint32_t, StringRef> ImportedSymbols;
};
CachingImportedSymbolLookup ImportedSymbols(Obj);
+ llvm::stable_sort(RVASymbolMap, [](const auto &x, const auto &y) {
+ return x.RVA < y.RVA;
+ });
+ RVASymbolMap.erase(llvm::unique(RVASymbolMap,
+ [](const auto &x, const auto &y) {
+ return x.RVA == y.RVA;
+ }),
+ RVASymbolMap.end());
- ListScope D(W, "PseudoReloc");
for (const auto &Reloc : RelocRecords) {
DictScope Entry(W, "Entry");
W.printHex("Symbol", Reloc.Symbol);
- if (const auto *Sym = ImportedSymbols.find(Reloc.Symbol))
- W.printString("SymbolName", *Sym);
+ if (Expected<StringRef> SymOrErr = ImportedSymbols.find(Reloc.Symbol))
+ W.printString("SymbolName", *SymOrErr);
+ else {
+ reportWarning(SymOrErr.takeError(), Obj->getFileName());
+ W.printString("SymbolName", "(missing)");
+ }
W.printHex("Target", Reloc.Target);
- if (auto Ite = RVASymbolMap.upper_bound(Reloc.Target.value());
+ if (auto Ite = llvm::upper_bound(
----------------
jh7370 wrote:
Same comment as above re. braces.
https://github.com/llvm/llvm-project/pull/151816
More information about the llvm-commits
mailing list