Skip to content

Commit c13258a

Browse files
committed
[ELF] Replace log with Log(ctx)
1 parent ef8d88c commit c13258a

11 files changed

+20
-20
lines changed

lld/ELF/AArch64ErrataFix.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,8 +553,8 @@ static void implementPatch(Ctx &ctx, uint64_t adrpAddr, uint64_t patcheeOffset,
553553
(relIt->type == R_AARCH64_JUMP26 || relIt->expr == R_RELAX_TLS_IE_TO_LE))
554554
return;
555555

556-
log("detected cortex-a53-843419 erratum sequence starting at " +
557-
utohexstr(adrpAddr) + " in unpatched output.");
556+
Log(ctx) << "detected cortex-a53-843419 erratum sequence starting at " <<
557+
utohexstr(adrpAddr) << " in unpatched output.";
558558

559559
auto *ps = make<Patch843419Section>(ctx, isec, patcheeOffset);
560560
patches.push_back(ps);

lld/ELF/ARMErrataFix.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,8 @@ void ARMErr657417Patcher::insertPatches(
420420
static void implementPatch(ScanResult sr, InputSection *isec,
421421
std::vector<Patch657417Section *> &patches) {
422422
Ctx &ctx = isec->getCtx();
423-
log("detected cortex-a8-657419 erratum sequence starting at " +
424-
utohexstr(isec->getVA(sr.off)) + " in unpatched output.");
423+
Log(ctx) << "detected cortex-a8-657419 erratum sequence starting at " <<
424+
utohexstr(isec->getVA(sr.off)) << " in unpatched output";
425425
Patch657417Section *psec;
426426
// We have two cases to deal with.
427427
// Case 1. There is a relocation at patcheeOffset to a symbol. The

lld/ELF/Arch/LoongArch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ bool LoongArch::relaxOnce(int pass) const {
839839
}
840840

841841
void LoongArch::finalizeRelax(int passes) const {
842-
log("relaxation passes: " + Twine(passes));
842+
Log(ctx) << "relaxation passes: " << Twine(passes);
843843
SmallVector<InputSection *, 0> storage;
844844
for (OutputSection *osec : ctx.outputSections) {
845845
if (!(osec->flags & SHF_EXECINSTR))

lld/ELF/Arch/RISCV.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ bool RISCV::relaxOnce(int pass) const {
934934

935935
void RISCV::finalizeRelax(int passes) const {
936936
llvm::TimeTraceScope timeScope("Finalize RISC-V relaxation");
937-
log("relaxation passes: " + Twine(passes));
937+
Log(ctx) << "relaxation passes: " << Twine(passes);
938938
SmallVector<InputSection *, 0> storage;
939939
for (OutputSection *osec : ctx.outputSections) {
940940
if (!(osec->flags & SHF_EXECINSTR))

lld/ELF/Driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1724,7 +1724,7 @@ static void readConfigs(Ctx &ctx, opt::InputArgList &args) {
17241724
parallel::strategy = hardware_concurrency(threads);
17251725
ctx.arg.thinLTOJobs = v;
17261726
} else if (parallel::strategy.compute_thread_count() > 16) {
1727-
log("set maximum concurrency to 16, specify --threads= to change");
1727+
Log(ctx) << "set maximum concurrency to 16, specify --threads= to change";
17281728
parallel::strategy = hardware_concurrency(16);
17291729
}
17301730
if (auto *arg = args.getLastArg(OPT_thinlto_jobs_eq))

lld/ELF/ICF.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ template <class ELFT> void ICF<ELFT>::run() {
542542
});
543543
} while (repeat);
544544

545-
log("ICF needed " + Twine(cnt) + " iterations");
545+
Log(ctx) << "ICF needed " << Twine(cnt) << " iterations";
546546

547547
// Merge sections by the equivalence class.
548548
forEachClassRange(0, sections.size(), [&](size_t begin, size_t end) {

lld/ELF/InputFiles.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ std::optional<MemoryBufferRef> elf::readFile(Ctx &ctx, StringRef path) {
247247
#endif
248248
}
249249

250-
log(path);
250+
Log(ctx) << path;
251251
ctx.arg.dependencyFiles.insert(llvm::CachedHashString(path));
252252

253253
auto mbOrErr = MemoryBuffer::getFile(path, /*IsText=*/false,

lld/ELF/LinkerScript.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ void LinkerScript::processSectionCommands() {
752752
if (auto *osd = dyn_cast<OutputDesc>(base)) {
753753
OutputSection *osec = &osd->osec;
754754
if (OutputDesc *overwrite = map.lookup(CachedHashStringRef(osec->name))) {
755-
log(overwrite->osec.location + " overwrites " + osec->name);
755+
Log(ctx) << overwrite->osec.location << " overwrites " << osec->name;
756756
overwrite->osec.sectionIndex = i++;
757757
base = overwrite;
758758
} else if (process(osec)) {

lld/ELF/SyntheticSections.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2116,8 +2116,8 @@ template <class ELFT> bool RelrSection<ELFT>::updateAllocSize(Ctx &ctx) {
21162116
// Don't allow the section to shrink; otherwise the size of the section can
21172117
// oscillate infinitely. Trailing 1s do not decode to more relocations.
21182118
if (relrRelocs.size() < oldSize) {
2119-
log(".relr.dyn needs " + Twine(oldSize - relrRelocs.size()) +
2120-
" padding word(s)");
2119+
Log(ctx) << ".relr.dyn needs " << Twine(oldSize - relrRelocs.size()) <<
2120+
" padding word(s)";
21212121
relrRelocs.resize(oldSize, Elf_Relr(1));
21222122
}
21232123

lld/test/ELF/arm-fix-cortex-a8-blx.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/// will emit these without a relocation, but they could be produced by ELF
88
/// processing tools.
99

10-
// CHECK: ld.lld: detected cortex-a8-657419 erratum sequence starting at 21FFE in unpatched output.
10+
// CHECK: ld.lld: detected cortex-a8-657419 erratum sequence starting at 21FFE in unpatched output
1111

1212
.syntax unified
1313
.text

lld/test/ELF/arm-fix-cortex-a8-recognize.s

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
// RUN: ld.lld --fix-cortex-a8 -verbose -r %t.o -o %t3 2>&1 | FileCheck --check-prefix=CHECK-RELOCATABLE-LLD %s
1414
// RUN: llvm-objdump --no-print-imm-hex --no-show-raw-insn -d %t3 --start-address=0xffa --stop-address=0x1002 | FileCheck --check-prefix=CHECK-RELOCATABLE %s
1515

16-
// CHECK: ld.lld: detected cortex-a8-657419 erratum sequence starting at 22FFE in unpatched output.
17-
// CHECK-NEXT: ld.lld: detected cortex-a8-657419 erratum sequence starting at 23FFE in unpatched output.
18-
// CHECK-NEXT: ld.lld: detected cortex-a8-657419 erratum sequence starting at 24FFE in unpatched output.
19-
// CHECK-NEXT: ld.lld: detected cortex-a8-657419 erratum sequence starting at 25FFE in unpatched output.
20-
// CHECK-NEXT: ld.lld: detected cortex-a8-657419 erratum sequence starting at 26FFE in unpatched output.
21-
// CHECK-NEXT: ld.lld: detected cortex-a8-657419 erratum sequence starting at 27FFE in unpatched output.
22-
// CHECK-NEXT: ld.lld: detected cortex-a8-657419 erratum sequence starting at 28FFE in unpatched output.
16+
// CHECK: ld.lld: detected cortex-a8-657419 erratum sequence starting at 22FFE in unpatched output
17+
// CHECK-NEXT: ld.lld: detected cortex-a8-657419 erratum sequence starting at 23FFE in unpatched output
18+
// CHECK-NEXT: ld.lld: detected cortex-a8-657419 erratum sequence starting at 24FFE in unpatched output
19+
// CHECK-NEXT: ld.lld: detected cortex-a8-657419 erratum sequence starting at 25FFE in unpatched output
20+
// CHECK-NEXT: ld.lld: detected cortex-a8-657419 erratum sequence starting at 26FFE in unpatched output
21+
// CHECK-NEXT: ld.lld: detected cortex-a8-657419 erratum sequence starting at 27FFE in unpatched output
22+
// CHECK-NEXT: ld.lld: detected cortex-a8-657419 erratum sequence starting at 28FFE in unpatched output
2323

2424
/// We do not detect errors when doing a relocatable link as we don't know what
2525
/// the final addresses are.

0 commit comments

Comments
 (0)