From 879896b722f46558e4217633d3542a4d662f6fa5 Mon Sep 17 00:00:00 2001 From: Petr Vesely Date: Thu, 11 Jul 2024 17:12:01 +0200 Subject: [PATCH] [CHERI] Fix DEBUG_CAP_(RELOCS/TABLE) build --- lld/ELF/Arch/Cheri.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/lld/ELF/Arch/Cheri.cpp b/lld/ELF/Arch/Cheri.cpp index 0891f3f8f812..f53b389807a8 100644 --- a/lld/ELF/Arch/Cheri.cpp +++ b/lld/ELF/Arch/Cheri.cpp @@ -286,9 +286,9 @@ void CheriCapRelocsSection::addCapReloc(CheriCapRelocLocation loc, if (targetNeedsDynReloc) { #ifdef DEBUG_CAP_RELOCS message("Adding dyn reloc at " + toString(this) + "+0x" + - utohexstr(CurrentEntryOffset) + " against " + - Target.verboseToString()); - message("Symbol preemptible:" + Twine(Target.Sym->IsPreemptible)); + utohexstr(currentEntryOffset) + " against " + + target.verboseToString()); + message("Symbol preemptible:" + Twine(target.sym()->isPreemptible)); #endif bool relativeToLoadAddress = false; @@ -398,10 +398,10 @@ static uint64_t getTargetSize(const CheriCapRelocLocation &location, if (offsetInOS <= os->size) { targetSize = os->size - offsetInOS; #ifdef DEBUG_CAP_RELOCS - if (Config->verboseCapRelocs) - errs() << " OS OFFSET 0x" << utohexstr(OS->Addr) << "SYM OFFSET 0x" - << utohexstr(OffsetInOS) << " SECLEN 0x" << utohexstr(OS->Size) - << " -> target size 0x" << utohexstr(TargetSize) << "\n"; + if (config->verboseCapRelocs) + errs() << " OS OFFSET 0x" << utohexstr(os->addr) << "SYM OFFSET 0x" + << utohexstr(offsetInOS) << " SECLEN 0x" << utohexstr(os->size) + << " -> target size 0x" << utohexstr(targetSize) << "\n"; #endif UnknownSectionSize = false; } @@ -633,14 +633,14 @@ void CheriCapTableSection::addEntry(Symbol &sym, RelExpr expr, it.first->second.usedInCallExpr = false; } #if defined(DEBUG_CAP_TABLE) - std::string DbgContext; - if (Config->CapTableScope == CapTableScopePolicy::File) { - DbgContext = " for file '" + toString(IS->File) + "'"; - } else if (Config->CapTableScope == CapTableScopePolicy::Function) { - DbgContext = " for function '" + toString(*findMatchingFunction(IS, Offset)) + "'"; + std::string dbgContext; + if (config->capTableScope == CapTableScopePolicy::File) { + dbgContext = " for file '" + toString(isec->file) + "'"; + } else if (config->capTableScope == CapTableScopePolicy::Function) { + dbgContext = " for function '" + toString(*findMatchingFunction(isec, offset)) + "'"; } - llvm::errs() << "Added symbol " << toString(Sym) << " to .captable" - << DbgContext << ". Total count " << Entries.size() << "\n"; + llvm::errs() << "Added symbol " << toString(sym) << " to .captable" + << dbgContext << ". Total count " << entries.size() << "\n"; #endif } @@ -672,10 +672,10 @@ uint32_t CheriCapTableSection::getIndex(const Symbol &sym, // case). When using per-function tables the first index in every function // will always be zero. #if defined(DEBUG_CAP_TABLE) - message("captable index for " + toString(Sym) + " is " + - Twine(*it->second.Index) + " - " + - Twine(Entries.FirstIndex) + ": " + - Twine(*it->second.Index - Entries.FirstIndex)); + message("captable index for " + toString(sym) + " is " + + Twine(*it->second.index) + " - " + + Twine(entries.firstIndex) + ": " + + Twine(*it->second.index - entries.firstIndex)); #endif return *it->second.index - entries.firstIndex; }