Skip to content

Commit 77b06dc

Browse files
committed
[BOLT][NFC] Switch logging in LinuxKernelRewriter
Use journaling streams introduced in llvm#81524 for LinuxKernelRewriter.
1 parent 2646dcc commit 77b06dc

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

bolt/lib/Rewrite/LinuxKernelRewriter.cpp

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -484,11 +484,11 @@ void LinuxKernelRewriter::updateLKMarkers() {
484484
LKPatcher->addLE64Patch(LKMarkerInfo.SectionOffset, NewAddress);
485485
}
486486
}
487-
outs() << "BOLT-INFO: patching linux kernel sections. Total patches per "
488-
"section are as follows:\n";
487+
BC.outs() << "BOLT-INFO: patching linux kernel sections. Total patches per "
488+
"section are as follows:\n";
489489
for (const std::pair<const std::string, uint64_t> &KV : PatchCounts)
490-
outs() << " Section: " << KV.first << ", patch-counts: " << KV.second
491-
<< '\n';
490+
BC.outs() << " Section: " << KV.first << ", patch-counts: " << KV.second
491+
<< '\n';
492492
}
493493

494494
Error LinuxKernelRewriter::readORCTables() {
@@ -530,8 +530,8 @@ Error LinuxKernelRewriter::readORCTables() {
530530
"out of bounds while reading ORC IP table");
531531

532532
if (IP < PrevIP && opts::Verbosity)
533-
errs() << "BOLT-WARNING: out of order IP 0x" << Twine::utohexstr(IP)
534-
<< " detected while reading ORC\n";
533+
BC.errs() << "BOLT-WARNING: out of order IP 0x" << Twine::utohexstr(IP)
534+
<< " detected while reading ORC\n";
535535

536536
PrevIP = IP;
537537

@@ -564,8 +564,8 @@ Error LinuxKernelRewriter::readORCTables() {
564564

565565
if (!BF) {
566566
if (opts::Verbosity)
567-
errs() << "BOLT-WARNING: no binary function found matching ORC 0x"
568-
<< Twine::utohexstr(IP) << ": " << Entry.ORC << '\n';
567+
BC.errs() << "BOLT-WARNING: no binary function found matching ORC 0x"
568+
<< Twine::utohexstr(IP) << ": " << Entry.ORC << '\n';
569569
continue;
570570
}
571571

@@ -591,15 +591,15 @@ Error LinuxKernelRewriter::readORCTables() {
591591
BC.MIB->addAnnotation(*Inst, "ORC", Entry.ORC);
592592
}
593593

594-
outs() << "BOLT-INFO: parsed " << NumORCEntries << " ORC entries\n";
594+
BC.outs() << "BOLT-INFO: parsed " << NumORCEntries << " ORC entries\n";
595595

596596
if (opts::DumpORC) {
597-
outs() << "BOLT-INFO: ORC unwind information:\n";
597+
BC.outs() << "BOLT-INFO: ORC unwind information:\n";
598598
for (const ORCListEntry &E : ORCEntries) {
599-
outs() << "0x" << Twine::utohexstr(E.IP) << ": " << E.ORC;
599+
BC.outs() << "0x" << Twine::utohexstr(E.IP) << ": " << E.ORC;
600600
if (E.BF)
601-
outs() << ": " << *E.BF;
602-
outs() << '\n';
601+
BC.outs() << ": " << *E.BF;
602+
BC.outs() << '\n';
603603
}
604604
}
605605

@@ -632,12 +632,12 @@ Error LinuxKernelRewriter::readORCTables() {
632632
llvm::sort(ORCEntries);
633633

634634
if (opts::DumpORC) {
635-
outs() << "BOLT-INFO: amended ORC unwind information:\n";
635+
BC.outs() << "BOLT-INFO: amended ORC unwind information:\n";
636636
for (const ORCListEntry &E : ORCEntries) {
637-
outs() << "0x" << Twine::utohexstr(E.IP) << ": " << E.ORC;
637+
BC.outs() << "0x" << Twine::utohexstr(E.IP) << ": " << E.ORC;
638638
if (E.BF)
639-
outs() << ": " << *E.BF;
640-
outs() << '\n';
639+
BC.outs() << ": " << *E.BF;
640+
BC.outs() << '\n';
641641
}
642642
}
643643

@@ -684,8 +684,8 @@ Error LinuxKernelRewriter::processORCPostCFG() {
684684
"ORC info at function entry expected.");
685685

686686
if (It->ORC == NullORC && BF.hasORC()) {
687-
errs() << "BOLT-WARNING: ORC unwind info excludes prologue for "
688-
<< BF << '\n';
687+
BC.errs() << "BOLT-WARNING: ORC unwind info excludes prologue for "
688+
<< BF << '\n';
689689
}
690690

691691
It->BF = &BF;
@@ -878,9 +878,10 @@ Error LinuxKernelRewriter::readStaticCalls() {
878878
++EntryID;
879879

880880
if (opts::DumpStaticCalls) {
881-
outs() << "Static Call Site: " << EntryID << '\n';
882-
outs() << "\tCallAddress: 0x" << Twine::utohexstr(CallAddress) << '\n'
883-
<< "\tKeyAddress: 0x" << Twine::utohexstr(KeyAddress) << '\n';
881+
BC.outs() << "Static Call Site: " << EntryID << '\n';
882+
BC.outs() << "\tCallAddress: 0x" << Twine::utohexstr(CallAddress)
883+
<< "\n\tKeyAddress: 0x" << Twine::utohexstr(KeyAddress)
884+
<< '\n';
884885
}
885886

886887
BinaryFunction *BF = BC.getBinaryFunctionContainingAddress(CallAddress);
@@ -916,8 +917,8 @@ Error LinuxKernelRewriter::readStaticCalls() {
916917
StaticCallEntries.push_back({EntryID, BF, Label});
917918
}
918919

919-
outs() << "BOLT-INFO: parsed " << StaticCallEntries.size()
920-
<< " static call entries\n";
920+
BC.outs() << "BOLT-INFO: parsed " << StaticCallEntries.size()
921+
<< " static call entries\n";
921922

922923
return Error::success();
923924
}

0 commit comments

Comments
 (0)