Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 1 addition & 36 deletions lld/ELF/Relocations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,9 +761,7 @@ static void reportUndefinedSymbol(Ctx &ctx, const UndefinedDiag &undef,

// Provide a spelling-like hint when we fail to resolve a local symbol but
// find a corresponding export in another compartment.
// FIXME: Is there a better way to test for cheriot here?
if (ctx.arg.isCheriAbi && ctx.arg.emachine == EM_RISCV &&
ctx.arg.capabilitySize == 8) {
if (ctx.arg.eflags & EF_RISCV_CHERIOT) {
StringRef SymName = sym.getName();
for (auto GlobalSymbol : ctx.symtab->getSymbols()) {
if (!GlobalSymbol->isGlobal())
Expand Down Expand Up @@ -792,39 +790,6 @@ static void reportUndefinedSymbol(Ctx &ctx, const UndefinedDiag &undef,
}
}

// Provide a spelling-like hint when we fail to resolve a local symbol but
// find a corresponding export in another compartment.
// FIXME: Is there a better way to test for cheriot here?
if (ctx.arg.isCheriAbi && ctx.arg.emachine == EM_RISCV &&
ctx.arg.capabilitySize == 8) {
StringRef SymName = sym.getName();
for (auto GlobalSymbol : ctx.symtab->getSymbols()) {
if (!GlobalSymbol->isGlobal())
continue;
if (!GlobalSymbol->isDefined())
continue;

StringRef GlobalName = GlobalSymbol->getName();
if (!GlobalName.consume_front("__export_"))
continue;
size_t functionNameStart = GlobalName.find("__Z");
if (functionNameStart == StringRef::npos)
continue;

StringRef GlobalCompartmentName =
GlobalName.take_front(functionNameStart);
StringRef GlobalFunctionName = GlobalName.substr(functionNameStart + 1);
if (GlobalFunctionName == SymName) {
msg << "\n>>> did you mean the \"" << toStr(ctx, sym)
<< "\" export from compartment \"" << GlobalCompartmentName
<< "\"?\n"
<< ">>> defined in: " << toStr(ctx, GlobalSymbol->file) << "\n"
<< ">>> the declaration may be missing a compartment annotation";
break;
}
}
}

if (sym.getName().starts_with("_ZTV"))
msg << "\n>>> the vtable symbol may be undefined because the class is "
"missing its key function "
Expand Down