Skip to content

Commit

Permalink
[CHERI] Fix DEBUG_CAP_(RELOCS/TABLE) build
Browse files Browse the repository at this point in the history
  • Loading branch information
veselypeta committed Jul 11, 2024
1 parent 0621ed3 commit 879896b
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions lld/ELF/Arch/Cheri.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 879896b

Please sign in to comment.